Bug 1860685 - Vendor libwebrtc from 9d8fb97b3c

We already cherry-picked this when we vendored 70aa7e99e4.

Upstream commit: https://webrtc.googlesource.com/src/+/9d8fb97b3ca56ec9920271d8e545ae2ac76b143c
    CHECK against overwrites in send_modules_map_

    No-try: true
    Bug: chromium:1477075
    Change-Id: Ia05a868bfab9e99ef66704e8d6bce516a7a43b0a
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/318440
    Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
    Commit-Queue: Harald Alvestrand <hta@webrtc.org>
    Cr-Commit-Position: refs/heads/main@{#40673}
This commit is contained in:
Byron Campen 2023-10-27 15:35:56 -05:00
Родитель b341da2609
Коммит 31f62a5bb9
108 изменённых файлов: 47247 добавлений и 47278 удалений

3
third_party/libwebrtc/README.moz-ff-commit поставляемый
Просмотреть файл

@ -25725,3 +25725,6 @@ fe57cecdfe
# MOZ_LIBWEBRTC_SRC=/home/bcampen/checkouts/elm/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
# base of lastest vendoring
9acda0b8ac
# MOZ_LIBWEBRTC_SRC=/home/bcampen/checkouts/elm/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
# base of lastest vendoring
9d8fb97b3c

2
third_party/libwebrtc/README.mozilla поставляемый
Просмотреть файл

@ -17174,3 +17174,5 @@ libwebrtc updated from /home/bcampen/checkouts/elm/.moz-fast-forward/moz-libwebr
libwebrtc updated from /home/bcampen/checkouts/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-10-27T20:34:02.344690.
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /home/bcampen/checkouts/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
libwebrtc updated from /home/bcampen/checkouts/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-10-27T20:34:57.144048.
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /home/bcampen/checkouts/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
libwebrtc updated from /home/bcampen/checkouts/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-10-27T20:35:46.655013.

1727
third_party/libwebrtc/moz-patch-stack/0001.patch поставляемый

Разница между файлами не показана из-за своего большого размера Загрузить разницу

1713
third_party/libwebrtc/moz-patch-stack/0002.patch поставляемый

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,43 +1,34 @@
From: Nico Grunbaum <na-g@nostrum.com>
Date: Sat, 13 Feb 2021 04:20:00 -0800
Subject: Bug 1654112 - Add pid_t to desktop_capture_types.h; r=pehrsons
From: Michael Froman <mfroman@mozilla.com>
Date: Fri, 9 Jul 2021 18:14:00 -0500
Subject: Bug 1654112 - mutex changes to fix tsan errors. r=ng
Upstreaming bug 1697385
Also includes:
Bug 1654112 - Clarifying prev. rev that moved pid_t into the global namespace; r=dminor
Differential Revision: https://phabricator.services.mozilla.com/D107897
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/539b69f0e21118a1898f1ef689577c7193ff7be7
Differential Revision: https://phabricator.services.mozilla.com/D119674
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/3d5503acf9a4b22e02c4300f29e4fbfed406ea2c
---
modules/desktop_capture/desktop_capture_types.h | 4 ++++
modules/video_capture/video_capture.h | 1 +
2 files changed, 5 insertions(+)
rtc_base/logging.cc | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/modules/desktop_capture/desktop_capture_types.h b/modules/desktop_capture/desktop_capture_types.h
index a4e3e897fd..e777a45f92 100644
--- a/modules/desktop_capture/desktop_capture_types.h
+++ b/modules/desktop_capture/desktop_capture_types.h
@@ -13,6 +13,10 @@
diff --git a/rtc_base/logging.cc b/rtc_base/logging.cc
index ad2303735e..9c2d3b0a39 100644
--- a/rtc_base/logging.cc
+++ b/rtc_base/logging.cc
@@ -275,8 +275,8 @@ void LogMessage::LogTimestamps(bool on) {
}
#include <stdint.h>
void LogMessage::LogToDebug(LoggingSeverity min_sev) {
- g_dbg_sev = min_sev;
webrtc::MutexLock lock(&GetLoggingLock());
+ g_dbg_sev = min_sev;
UpdateMinLogSeverity();
}
+#ifdef XP_WIN // Moving this into the global namespace
+typedef int pid_t; // matching what used to be in
+#endif // video_capture_defines.h
+
namespace webrtc {
@@ -460,6 +460,9 @@ void LogMessage::OutputToDebug(const LogLineRef& log_line) {
enum class CaptureType { kWindow, kScreen, kAnyScreenContent };
diff --git a/modules/video_capture/video_capture.h b/modules/video_capture/video_capture.h
index e207598d68..58485f28e9 100644
--- a/modules/video_capture/video_capture.h
+++ b/modules/video_capture/video_capture.h
@@ -13,6 +13,7 @@
#include "api/video/video_rotation.h"
#include "api/video/video_sink_interface.h"
+#include "modules/desktop_capture/desktop_capture_types.h"
#include "modules/video_capture/raw_video_sink_interface.h"
#include "modules/video_capture/video_capture_defines.h"
#include <set>
// static
bool LogMessage::IsNoop(LoggingSeverity severity) {
+ // Added MutexLock to fix tsan warnings on accessing g_dbg_sev. (mjf)
+ // See https://bugs.chromium.org/p/chromium/issues/detail?id=1228729
+ webrtc::MutexLock lock(&GetLoggingLock());
if (severity >= g_dbg_sev || severity >= g_min_sev)
return false;
return streams_empty_.load(std::memory_order_relaxed);

Просмотреть файл

@ -1,34 +1,46 @@
From: Michael Froman <mfroman@mozilla.com>
Date: Fri, 9 Jul 2021 18:14:00 -0500
Subject: Bug 1654112 - mutex changes to fix tsan errors. r=ng
From: Dan Minor <dminor@mozilla.com>
Date: Wed, 18 Nov 2020 13:33:00 -0500
Subject: Bug 1654112 - Suppress -Wclass-varargs warning in logging.h. r=ng
Differential Revision: https://phabricator.services.mozilla.com/D119674
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/3d5503acf9a4b22e02c4300f29e4fbfed406ea2c
This needs some investigation to see why we get this warning when it is not
present upstream.
Since both were doing the same thing for different compiler chains,
also includes:
Bug 1654112 - linux build fix (pragmas) for base-toolchains* . r=ng
Differential Revision: https://phabricator.services.mozilla.com/D130086
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/8d832e832ffe513246c0763a56376a8022b2447b
---
rtc_base/logging.cc | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
rtc_base/logging.h | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/rtc_base/logging.cc b/rtc_base/logging.cc
index ad2303735e..9c2d3b0a39 100644
--- a/rtc_base/logging.cc
+++ b/rtc_base/logging.cc
@@ -275,8 +275,8 @@ void LogMessage::LogTimestamps(bool on) {
}
diff --git a/rtc_base/logging.h b/rtc_base/logging.h
index df7f173f58..a3733d7543 100644
--- a/rtc_base/logging.h
+++ b/rtc_base/logging.h
@@ -48,6 +48,14 @@
#ifndef RTC_BASE_LOGGING_H_
#define RTC_BASE_LOGGING_H_
void LogMessage::LogToDebug(LoggingSeverity min_sev) {
- g_dbg_sev = min_sev;
webrtc::MutexLock lock(&GetLoggingLock());
+ g_dbg_sev = min_sev;
UpdateMinLogSeverity();
}
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvarargs"
+
+#if defined(__clang__)
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wclass-varargs"
+#endif
+
#include <errno.h>
@@ -460,6 +460,9 @@ void LogMessage::OutputToDebug(const LogLineRef& log_line) {
#include <atomic>
@@ -764,4 +772,9 @@ inline const char* AdaptString(const std::string& str) {
// static
bool LogMessage::IsNoop(LoggingSeverity severity) {
+ // Added MutexLock to fix tsan warnings on accessing g_dbg_sev. (mjf)
+ // See https://bugs.chromium.org/p/chromium/issues/detail?id=1228729
+ webrtc::MutexLock lock(&GetLoggingLock());
if (severity >= g_dbg_sev || severity >= g_min_sev)
return false;
return streams_empty_.load(std::memory_order_relaxed);
} // namespace rtc
+#pragma GCC diagnostic pop
+#if defined(__clang__)
+# pragma clang diagnostic pop
+#endif
+
#endif // RTC_BASE_LOGGING_H_

Просмотреть файл

@ -1,46 +1,49 @@
From: Dan Minor <dminor@mozilla.com>
Date: Wed, 18 Nov 2020 13:33:00 -0500
Subject: Bug 1654112 - Suppress -Wclass-varargs warning in logging.h. r=ng
Date: Tue, 27 Mar 2018 15:43:00 -0400
Subject: Bug 1376873 - Disable Mid support in RtpDemuxer; r=mjf
This needs some investigation to see why we get this warning when it is not
present upstream.
The only use of Mid in the current webrtc.org code is in the unit tests.
RtpStreamReceiverController only allows adding sinks using SSRCs. Because
of this, we'll end up dropping packets in the RtpDemuxer with the current
code as none of our Mids will be recognized.
Since both were doing the same thing for different compiler chains,
also includes:
Bug 1654112 - linux build fix (pragmas) for base-toolchains* . r=ng
Tip of webrtc.org fully supports using Mids, so we'll be able to enable this
code again after the next update.
Differential Revision: https://phabricator.services.mozilla.com/D130086
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/8d832e832ffe513246c0763a56376a8022b2447b
Differential Revision: https://phabricator.services.mozilla.com/D7442
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/b3ba8452e77105c72f6ddbc49cbe5a53dbea1507
---
rtc_base/logging.h | 13 +++++++++++++
1 file changed, 13 insertions(+)
call/rtp_demuxer.cc | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/rtc_base/logging.h b/rtc_base/logging.h
index df7f173f58..a3733d7543 100644
--- a/rtc_base/logging.h
+++ b/rtc_base/logging.h
@@ -48,6 +48,14 @@
#ifndef RTC_BASE_LOGGING_H_
#define RTC_BASE_LOGGING_H_
diff --git a/call/rtp_demuxer.cc b/call/rtp_demuxer.cc
index 0b74f2ac0a..5c53f48144 100644
--- a/call/rtp_demuxer.cc
+++ b/call/rtp_demuxer.cc
@@ -272,13 +272,17 @@ RtpPacketSinkInterface* RtpDemuxer::ResolveSink(
// RSID and RRID are routed to the same sinks. If an RSID is specified on a
// repair packet, it should be ignored and the RRID should be used.
std::string packet_mid, packet_rsid;
- bool has_mid = use_mid_ && packet.GetExtension<RtpMid>(&packet_mid);
+ //bool has_mid = use_mid_ && packet.GetExtension<RtpMid>(&packet_mid);
bool has_rsid = packet.GetExtension<RepairedRtpStreamId>(&packet_rsid);
if (!has_rsid) {
has_rsid = packet.GetExtension<RtpStreamId>(&packet_rsid);
}
uint32_t ssrc = packet.Ssrc();
+ // Mid support is half-baked in branch 64. RtpStreamReceiverController only
+ // supports adding sinks by ssrc, so our mids will never show up in
+ // known_mids_, causing us to drop packets here.
+#if 0
// The BUNDLE spec says to drop any packets with unknown MIDs, even if the
// SSRC is known/latched.
if (has_mid && known_mids_.find(packet_mid) == known_mids_.end()) {
@@ -352,6 +356,7 @@ RtpPacketSinkInterface* RtpDemuxer::ResolveSink(
}
}
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvarargs"
+
+#if defined(__clang__)
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wclass-varargs"
+#endif
+
#include <errno.h>
#include <atomic>
@@ -764,4 +772,9 @@ inline const char* AdaptString(const std::string& str) {
} // namespace rtc
+#pragma GCC diagnostic pop
+#if defined(__clang__)
+# pragma clang diagnostic pop
+#endif
+
#endif // RTC_BASE_LOGGING_H_
// We trust signaled SSRC more than payload type which is likely to conflict
// between streams.
const auto ssrc_sink_it = sink_by_ssrc_.find(ssrc);

Просмотреть файл

@ -1,49 +1,139 @@
From: Dan Minor <dminor@mozilla.com>
Date: Tue, 27 Mar 2018 15:43:00 -0400
Subject: Bug 1376873 - Disable Mid support in RtpDemuxer; r=mjf
Date: Wed, 7 Feb 2018 15:00:00 -0500
Subject: Bug 1376873 - Fix GetRTCPSenderReport; r=ng
The only use of Mid in the current webrtc.org code is in the unit tests.
RtpStreamReceiverController only allows adding sinks using SSRCs. Because
of this, we'll end up dropping packets in the RtpDemuxer with the current
code as none of our Mids will be recognized.
Tip of webrtc.org fully supports using Mids, so we'll be able to enable this
code again after the next update.
Differential Revision: https://phabricator.services.mozilla.com/D7442
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/b3ba8452e77105c72f6ddbc49cbe5a53dbea1507
Differential Revision: https://phabricator.services.mozilla.com/D7431
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/b55b0368d9f21849fa465fa9b3f028285c9ea6ae
---
call/rtp_demuxer.cc | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
call/video_receive_stream.h | 3 +++
modules/rtp_rtcp/source/rtcp_receiver.cc | 7 +++++++
modules/rtp_rtcp/source/rtcp_receiver.h | 4 ++++
modules/rtp_rtcp/source/rtp_rtcp_impl.cc | 5 +++++
modules/rtp_rtcp/source/rtp_rtcp_impl.h | 3 +++
modules/rtp_rtcp/source/rtp_rtcp_impl2.cc | 5 +++++
modules/rtp_rtcp/source/rtp_rtcp_impl2.h | 3 +++
modules/rtp_rtcp/source/rtp_rtcp_interface.h | 4 ++++
8 files changed, 34 insertions(+)
diff --git a/call/rtp_demuxer.cc b/call/rtp_demuxer.cc
index 0b74f2ac0a..5c53f48144 100644
--- a/call/rtp_demuxer.cc
+++ b/call/rtp_demuxer.cc
@@ -272,13 +272,17 @@ RtpPacketSinkInterface* RtpDemuxer::ResolveSink(
// RSID and RRID are routed to the same sinks. If an RSID is specified on a
// repair packet, it should be ignored and the RRID should be used.
std::string packet_mid, packet_rsid;
- bool has_mid = use_mid_ && packet.GetExtension<RtpMid>(&packet_mid);
+ //bool has_mid = use_mid_ && packet.GetExtension<RtpMid>(&packet_mid);
bool has_rsid = packet.GetExtension<RepairedRtpStreamId>(&packet_rsid);
if (!has_rsid) {
has_rsid = packet.GetExtension<RtpStreamId>(&packet_rsid);
}
uint32_t ssrc = packet.Ssrc();
diff --git a/call/video_receive_stream.h b/call/video_receive_stream.h
index 542067d30c..500ca1447f 100644
--- a/call/video_receive_stream.h
+++ b/call/video_receive_stream.h
@@ -151,6 +151,9 @@ class VideoReceiveStreamInterface : public MediaReceiveStreamInterface {
RtcpPacketTypeCounter rtcp_packet_type_counts;
absl::optional<RtpReceiveStats> rtx_rtp_stats;
+ // Mid support is half-baked in branch 64. RtpStreamReceiverController only
+ // supports adding sinks by ssrc, so our mids will never show up in
+ // known_mids_, causing us to drop packets here.
+#if 0
// The BUNDLE spec says to drop any packets with unknown MIDs, even if the
// SSRC is known/latched.
if (has_mid && known_mids_.find(packet_mid) == known_mids_.end()) {
@@ -352,6 +356,7 @@ RtpPacketSinkInterface* RtpDemuxer::ResolveSink(
}
}
+ uint32_t rtcp_sender_packets_sent;
+ uint32_t rtcp_sender_octets_sent;
+
// Timing frame info: all important timestamps for a full lifetime of a
// single 'timing frame'.
absl::optional<webrtc::TimingFrameInfo> timing_frame_info;
diff --git a/modules/rtp_rtcp/source/rtcp_receiver.cc b/modules/rtp_rtcp/source/rtcp_receiver.cc
index ba5b951f4d..61b88c89b8 100644
--- a/modules/rtp_rtcp/source/rtcp_receiver.cc
+++ b/modules/rtp_rtcp/source/rtcp_receiver.cc
@@ -361,6 +361,13 @@ RTCPReceiver::ConsumeReceivedXrReferenceTimeInfo() {
return last_xr_rtis;
}
+#endif
// We trust signaled SSRC more than payload type which is likely to conflict
// between streams.
const auto ssrc_sink_it = sink_by_ssrc_.find(ssrc);
+void RTCPReceiver::RemoteRTCPSenderInfo(uint32_t* packet_count,
+ uint32_t* octet_count) const {
+ MutexLock lock(&rtcp_receiver_lock_);
+ *packet_count = remote_sender_packet_count_;
+ *octet_count = remote_sender_octet_count_;
+}
+
std::vector<ReportBlockData> RTCPReceiver::GetLatestReportBlockData() const {
std::vector<ReportBlockData> result;
MutexLock lock(&rtcp_receiver_lock_);
diff --git a/modules/rtp_rtcp/source/rtcp_receiver.h b/modules/rtp_rtcp/source/rtcp_receiver.h
index a6175d0774..59e0258df5 100644
--- a/modules/rtp_rtcp/source/rtcp_receiver.h
+++ b/modules/rtp_rtcp/source/rtcp_receiver.h
@@ -117,6 +117,10 @@ class RTCPReceiver final {
std::vector<rtcp::ReceiveTimeInfo> ConsumeReceivedXrReferenceTimeInfo();
+ // Get received sender packet and octet counts
+ void RemoteRTCPSenderInfo(uint32_t* packet_count,
+ uint32_t* octet_count) const;
+
absl::optional<TimeDelta> AverageRtt() const;
absl::optional<TimeDelta> LastRtt() const;
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
index 3f9e093ff0..8ca6b7ecb5 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
@@ -500,6 +500,11 @@ void ModuleRtpRtcpImpl::GetSendStreamDataCounters(
}
// Received RTCP report.
+void ModuleRtpRtcpImpl::RemoteRTCPSenderInfo(uint32_t* packet_count,
+ uint32_t* octet_count) const {
+ return rtcp_receiver_.RemoteRTCPSenderInfo(packet_count, octet_count);
+}
+
std::vector<ReportBlockData> ModuleRtpRtcpImpl::GetLatestReportBlockData()
const {
return rtcp_receiver_.GetLatestReportBlockData();
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.h b/modules/rtp_rtcp/source/rtp_rtcp_impl.h
index d298081432..dd706e569d 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl.h
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.h
@@ -182,6 +182,9 @@ class ABSL_DEPRECATED("") ModuleRtpRtcpImpl
StreamDataCounters* rtp_counters,
StreamDataCounters* rtx_counters) const override;
+ void RemoteRTCPSenderInfo(uint32_t* packet_count,
+ uint32_t* octet_count) const override;
+
// A snapshot of the most recent Report Block with additional data of
// interest to statistics. Used to implement RTCRemoteInboundRtpStreamStats.
// Within this list, the `ReportBlockData::source_ssrc()`, which is the SSRC
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc
index 800ec77d3e..0df8543497 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc
@@ -503,6 +503,11 @@ void ModuleRtpRtcpImpl2::GetSendStreamDataCounters(
}
// Received RTCP report.
+void ModuleRtpRtcpImpl2::RemoteRTCPSenderInfo(uint32_t* packet_count,
+ uint32_t* octet_count) const {
+ return rtcp_receiver_.RemoteRTCPSenderInfo(packet_count, octet_count);
+}
+
std::vector<ReportBlockData> ModuleRtpRtcpImpl2::GetLatestReportBlockData()
const {
return rtcp_receiver_.GetLatestReportBlockData();
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl2.h b/modules/rtp_rtcp/source/rtp_rtcp_impl2.h
index 36e6deffba..663b28af3e 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl2.h
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl2.h
@@ -194,6 +194,9 @@ class ModuleRtpRtcpImpl2 final : public RtpRtcpInterface,
StreamDataCounters* rtp_counters,
StreamDataCounters* rtx_counters) const override;
+ void RemoteRTCPSenderInfo(uint32_t* packet_count,
+ uint32_t* octet_count) const override;
+
// A snapshot of the most recent Report Block with additional data of
// interest to statistics. Used to implement RTCRemoteInboundRtpStreamStats.
// Within this list, the `ReportBlockData::source_ssrc()`, which is the SSRC
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_interface.h b/modules/rtp_rtcp/source/rtp_rtcp_interface.h
index d366bb77a2..5ad7680d61 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_interface.h
+++ b/modules/rtp_rtcp/source/rtp_rtcp_interface.h
@@ -388,6 +388,10 @@ class RtpRtcpInterface : public RtcpFeedbackSenderInterface {
StreamDataCounters* rtp_counters,
StreamDataCounters* rtx_counters) const = 0;
+
+ // Returns packet count and octet count from RTCP sender report.
+ virtual void RemoteRTCPSenderInfo(uint32_t* packet_count,
+ uint32_t* octet_count) const = 0;
// A snapshot of Report Blocks with additional data of interest to statistics.
// Within this list, the sender-source SSRC pair is unique and per-pair the
// ReportBlockData represents the latest Report Block that was received for

Просмотреть файл

@ -1,139 +1,145 @@
From: Dan Minor <dminor@mozilla.com>
Date: Wed, 7 Feb 2018 15:00:00 -0500
Subject: Bug 1376873 - Fix GetRTCPSenderReport; r=ng
From: Nico Grunbaum <na-g@nostrum.com>
Date: Fri, 5 Jun 2020 11:41:00 +0000
Subject: Bug 1615191 - P0 - implement remoteTimestamp for
RTCRemoteOutboundRtpStreamStats in libwebrtc;r=dminor
Differential Revision: https://phabricator.services.mozilla.com/D7431
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/b55b0368d9f21849fa465fa9b3f028285c9ea6ae
Differential Revision: https://phabricator.services.mozilla.com/D78004
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/cd901e96d23e004e4bee19b96c8c2f1ca3b42830
This patch also absorbs two additional patches that collapse into using ms for the remote timestamp:
Bug 1654112 - Plumb RemoteRTCPSenderInfo through also for audio and change unit to ms. r=ng
Bug 1654112 - Replace custom upstream code for remote received audio stats with cherry-pick. r=ng
---
call/video_receive_stream.h | 3 +++
modules/rtp_rtcp/source/rtcp_receiver.cc | 7 +++++++
modules/rtp_rtcp/source/rtcp_receiver.h | 4 ++++
modules/rtp_rtcp/source/rtp_rtcp_impl.cc | 5 +++++
modules/rtp_rtcp/source/rtp_rtcp_impl.h | 3 +++
modules/rtp_rtcp/source/rtp_rtcp_impl2.cc | 5 +++++
modules/rtp_rtcp/source/rtp_rtcp_impl2.h | 3 +++
modules/rtp_rtcp/source/rtp_rtcp_interface.h | 4 ++++
8 files changed, 34 insertions(+)
call/video_receive_stream.h | 1 +
modules/rtp_rtcp/source/rtcp_receiver.cc | 4 +++-
modules/rtp_rtcp/source/rtcp_receiver.h | 3 ++-
modules/rtp_rtcp/source/rtp_rtcp_impl.cc | 6 ++++--
modules/rtp_rtcp/source/rtp_rtcp_impl.h | 3 ++-
modules/rtp_rtcp/source/rtp_rtcp_impl2.cc | 6 ++++--
modules/rtp_rtcp/source/rtp_rtcp_impl2.h | 3 ++-
modules/rtp_rtcp/source/rtp_rtcp_interface.h | 5 +++--
8 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/call/video_receive_stream.h b/call/video_receive_stream.h
index 542067d30c..500ca1447f 100644
index 500ca1447f..95f1a47f4e 100644
--- a/call/video_receive_stream.h
+++ b/call/video_receive_stream.h
@@ -151,6 +151,9 @@ class VideoReceiveStreamInterface : public MediaReceiveStreamInterface {
RtcpPacketTypeCounter rtcp_packet_type_counts;
absl::optional<RtpReceiveStats> rtx_rtp_stats;
@@ -153,6 +153,7 @@ class VideoReceiveStreamInterface : public MediaReceiveStreamInterface {
uint32_t rtcp_sender_packets_sent;
uint32_t rtcp_sender_octets_sent;
+ int64_t rtcp_sender_ntp_timestamp_ms;
+ uint32_t rtcp_sender_packets_sent;
+ uint32_t rtcp_sender_octets_sent;
+
// Timing frame info: all important timestamps for a full lifetime of a
// single 'timing frame'.
absl::optional<webrtc::TimingFrameInfo> timing_frame_info;
diff --git a/modules/rtp_rtcp/source/rtcp_receiver.cc b/modules/rtp_rtcp/source/rtcp_receiver.cc
index ba5b951f4d..61b88c89b8 100644
index 61b88c89b8..a98b200c05 100644
--- a/modules/rtp_rtcp/source/rtcp_receiver.cc
+++ b/modules/rtp_rtcp/source/rtcp_receiver.cc
@@ -361,6 +361,13 @@ RTCPReceiver::ConsumeReceivedXrReferenceTimeInfo() {
return last_xr_rtis;
@@ -362,10 +362,12 @@ RTCPReceiver::ConsumeReceivedXrReferenceTimeInfo() {
}
+void RTCPReceiver::RemoteRTCPSenderInfo(uint32_t* packet_count,
+ uint32_t* octet_count) const {
+ MutexLock lock(&rtcp_receiver_lock_);
+ *packet_count = remote_sender_packet_count_;
+ *octet_count = remote_sender_octet_count_;
+}
+
std::vector<ReportBlockData> RTCPReceiver::GetLatestReportBlockData() const {
std::vector<ReportBlockData> result;
void RTCPReceiver::RemoteRTCPSenderInfo(uint32_t* packet_count,
- uint32_t* octet_count) const {
+ uint32_t* octet_count,
+ int64_t* ntp_timestamp_ms) const {
MutexLock lock(&rtcp_receiver_lock_);
*packet_count = remote_sender_packet_count_;
*octet_count = remote_sender_octet_count_;
+ *ntp_timestamp_ms = remote_sender_ntp_time_.ToMs();
}
std::vector<ReportBlockData> RTCPReceiver::GetLatestReportBlockData() const {
diff --git a/modules/rtp_rtcp/source/rtcp_receiver.h b/modules/rtp_rtcp/source/rtcp_receiver.h
index a6175d0774..59e0258df5 100644
index 59e0258df5..e748b257e8 100644
--- a/modules/rtp_rtcp/source/rtcp_receiver.h
+++ b/modules/rtp_rtcp/source/rtcp_receiver.h
@@ -117,6 +117,10 @@ class RTCPReceiver final {
@@ -119,7 +119,8 @@ class RTCPReceiver final {
std::vector<rtcp::ReceiveTimeInfo> ConsumeReceivedXrReferenceTimeInfo();
// Get received sender packet and octet counts
void RemoteRTCPSenderInfo(uint32_t* packet_count,
- uint32_t* octet_count) const;
+ uint32_t* octet_count,
+ int64_t* ntp_timestamp_ms) const;
+ // Get received sender packet and octet counts
+ void RemoteRTCPSenderInfo(uint32_t* packet_count,
+ uint32_t* octet_count) const;
+
absl::optional<TimeDelta> AverageRtt() const;
absl::optional<TimeDelta> LastRtt() const;
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
index 3f9e093ff0..8ca6b7ecb5 100644
index 8ca6b7ecb5..83690f160c 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
@@ -500,6 +500,11 @@ void ModuleRtpRtcpImpl::GetSendStreamDataCounters(
}
@@ -501,8 +501,10 @@ void ModuleRtpRtcpImpl::GetSendStreamDataCounters(
// Received RTCP report.
+void ModuleRtpRtcpImpl::RemoteRTCPSenderInfo(uint32_t* packet_count,
+ uint32_t* octet_count) const {
+ return rtcp_receiver_.RemoteRTCPSenderInfo(packet_count, octet_count);
+}
+
void ModuleRtpRtcpImpl::RemoteRTCPSenderInfo(uint32_t* packet_count,
- uint32_t* octet_count) const {
- return rtcp_receiver_.RemoteRTCPSenderInfo(packet_count, octet_count);
+ uint32_t* octet_count,
+ int64_t* ntp_timestamp_ms) const {
+ return rtcp_receiver_.RemoteRTCPSenderInfo(packet_count, octet_count,
+ ntp_timestamp_ms);
}
std::vector<ReportBlockData> ModuleRtpRtcpImpl::GetLatestReportBlockData()
const {
return rtcp_receiver_.GetLatestReportBlockData();
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.h b/modules/rtp_rtcp/source/rtp_rtcp_impl.h
index d298081432..dd706e569d 100644
index dd706e569d..742a69cce3 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl.h
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.h
@@ -182,6 +182,9 @@ class ABSL_DEPRECATED("") ModuleRtpRtcpImpl
StreamDataCounters* rtp_counters,
@@ -183,7 +183,8 @@ class ABSL_DEPRECATED("") ModuleRtpRtcpImpl
StreamDataCounters* rtx_counters) const override;
+ void RemoteRTCPSenderInfo(uint32_t* packet_count,
+ uint32_t* octet_count) const override;
+
void RemoteRTCPSenderInfo(uint32_t* packet_count,
- uint32_t* octet_count) const override;
+ uint32_t* octet_count,
+ int64_t* ntp_timestamp_ms) const override;
// A snapshot of the most recent Report Block with additional data of
// interest to statistics. Used to implement RTCRemoteInboundRtpStreamStats.
// Within this list, the `ReportBlockData::source_ssrc()`, which is the SSRC
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc
index 800ec77d3e..0df8543497 100644
index 0df8543497..31a1b764b3 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc
@@ -503,6 +503,11 @@ void ModuleRtpRtcpImpl2::GetSendStreamDataCounters(
}
@@ -504,8 +504,10 @@ void ModuleRtpRtcpImpl2::GetSendStreamDataCounters(
// Received RTCP report.
+void ModuleRtpRtcpImpl2::RemoteRTCPSenderInfo(uint32_t* packet_count,
+ uint32_t* octet_count) const {
+ return rtcp_receiver_.RemoteRTCPSenderInfo(packet_count, octet_count);
+}
+
void ModuleRtpRtcpImpl2::RemoteRTCPSenderInfo(uint32_t* packet_count,
- uint32_t* octet_count) const {
- return rtcp_receiver_.RemoteRTCPSenderInfo(packet_count, octet_count);
+ uint32_t* octet_count,
+ int64_t* ntp_timestamp_ms) const {
+ return rtcp_receiver_.RemoteRTCPSenderInfo(packet_count, octet_count,
+ ntp_timestamp_ms);
}
std::vector<ReportBlockData> ModuleRtpRtcpImpl2::GetLatestReportBlockData()
const {
return rtcp_receiver_.GetLatestReportBlockData();
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl2.h b/modules/rtp_rtcp/source/rtp_rtcp_impl2.h
index 36e6deffba..663b28af3e 100644
index 663b28af3e..a9d18ec44a 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl2.h
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl2.h
@@ -194,6 +194,9 @@ class ModuleRtpRtcpImpl2 final : public RtpRtcpInterface,
StreamDataCounters* rtp_counters,
@@ -195,7 +195,8 @@ class ModuleRtpRtcpImpl2 final : public RtpRtcpInterface,
StreamDataCounters* rtx_counters) const override;
+ void RemoteRTCPSenderInfo(uint32_t* packet_count,
+ uint32_t* octet_count) const override;
+
void RemoteRTCPSenderInfo(uint32_t* packet_count,
- uint32_t* octet_count) const override;
+ uint32_t* octet_count,
+ int64_t* ntp_timestamp_ms) const override;
// A snapshot of the most recent Report Block with additional data of
// interest to statistics. Used to implement RTCRemoteInboundRtpStreamStats.
// Within this list, the `ReportBlockData::source_ssrc()`, which is the SSRC
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_interface.h b/modules/rtp_rtcp/source/rtp_rtcp_interface.h
index d366bb77a2..5ad7680d61 100644
index 5ad7680d61..dc86f92bf5 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_interface.h
+++ b/modules/rtp_rtcp/source/rtp_rtcp_interface.h
@@ -388,6 +388,10 @@ class RtpRtcpInterface : public RtcpFeedbackSenderInterface {
StreamDataCounters* rtp_counters,
@@ -389,9 +389,10 @@ class RtpRtcpInterface : public RtcpFeedbackSenderInterface {
StreamDataCounters* rtx_counters) const = 0;
+
+ // Returns packet count and octet count from RTCP sender report.
+ virtual void RemoteRTCPSenderInfo(uint32_t* packet_count,
+ uint32_t* octet_count) const = 0;
- // Returns packet count and octet count from RTCP sender report.
+ // Returns packet count, octet count, and timestamp from RTCP sender report.
virtual void RemoteRTCPSenderInfo(uint32_t* packet_count,
- uint32_t* octet_count) const = 0;
+ uint32_t* octet_count,
+ int64_t* ntp_timestamp_ms) const = 0;
// A snapshot of Report Blocks with additional data of interest to statistics.
// Within this list, the sender-source SSRC pair is unique and per-pair the
// ReportBlockData represents the latest Report Block that was received for

Просмотреть файл

@ -1,145 +1,65 @@
From: Nico Grunbaum <na-g@nostrum.com>
Date: Fri, 5 Jun 2020 11:41:00 +0000
Subject: Bug 1615191 - P0 - implement remoteTimestamp for
RTCRemoteOutboundRtpStreamStats in libwebrtc;r=dminor
From: Dan Minor <dminor@mozilla.com>
Date: Tue, 31 Jul 2018 13:32:00 -0400
Subject: Bug 1376873 - OS X desktop capture fixes; r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D78004
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/cd901e96d23e004e4bee19b96c8c2f1ca3b42830
This patch also absorbs two additional patches that collapse into using ms for the remote timestamp:
Bug 1654112 - Plumb RemoteRTCPSenderInfo through also for audio and change unit to ms. r=ng
Bug 1654112 - Replace custom upstream code for remote received audio stats with cherry-pick. r=ng
Differential Revision: https://phabricator.services.mozilla.com/D7464
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/02c038eca65c1218b56fdf8937fdeab3d8767fe6
---
call/video_receive_stream.h | 1 +
modules/rtp_rtcp/source/rtcp_receiver.cc | 4 +++-
modules/rtp_rtcp/source/rtcp_receiver.h | 3 ++-
modules/rtp_rtcp/source/rtp_rtcp_impl.cc | 6 ++++--
modules/rtp_rtcp/source/rtp_rtcp_impl.h | 3 ++-
modules/rtp_rtcp/source/rtp_rtcp_impl2.cc | 6 ++++--
modules/rtp_rtcp/source/rtp_rtcp_impl2.h | 3 ++-
modules/rtp_rtcp/source/rtp_rtcp_interface.h | 5 +++--
8 files changed, 21 insertions(+), 10 deletions(-)
modules/desktop_capture/mac/screen_capturer_mac.h | 7 +++++++
modules/desktop_capture/mac/screen_capturer_mac.mm | 4 +++-
modules/desktop_capture/mouse_cursor_monitor_mac.mm | 2 +-
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/call/video_receive_stream.h b/call/video_receive_stream.h
index 500ca1447f..95f1a47f4e 100644
--- a/call/video_receive_stream.h
+++ b/call/video_receive_stream.h
@@ -153,6 +153,7 @@ class VideoReceiveStreamInterface : public MediaReceiveStreamInterface {
diff --git a/modules/desktop_capture/mac/screen_capturer_mac.h b/modules/desktop_capture/mac/screen_capturer_mac.h
index 7e38b5bd08..e4a2cc2fc9 100644
--- a/modules/desktop_capture/mac/screen_capturer_mac.h
+++ b/modules/desktop_capture/mac/screen_capturer_mac.h
@@ -113,6 +113,13 @@ class ScreenCapturerMac final : public DesktopCapturer {
uint32_t rtcp_sender_packets_sent;
uint32_t rtcp_sender_octets_sent;
+ int64_t rtcp_sender_ntp_timestamp_ms;
// Start, CaptureFrame and destructor have to called in the same thread.
SequenceChecker thread_checker_;
+
+ // Used to force CaptureFrame to update it's screen configuration
+ // and reregister event handlers. This ensure that this
+ // occurs on the ScreenCapture thread. Read and written from
+ // both the VideoCapture thread and ScreenCapture thread.
+ // Protected by desktop_config_monitor_.
+ bool update_screen_configuration_ = false;
};
// Timing frame info: all important timestamps for a full lifetime of a
// single 'timing frame'.
diff --git a/modules/rtp_rtcp/source/rtcp_receiver.cc b/modules/rtp_rtcp/source/rtcp_receiver.cc
index 61b88c89b8..a98b200c05 100644
--- a/modules/rtp_rtcp/source/rtcp_receiver.cc
+++ b/modules/rtp_rtcp/source/rtcp_receiver.cc
@@ -362,10 +362,12 @@ RTCPReceiver::ConsumeReceivedXrReferenceTimeInfo() {
}
} // namespace webrtc
diff --git a/modules/desktop_capture/mac/screen_capturer_mac.mm b/modules/desktop_capture/mac/screen_capturer_mac.mm
index 8f0c68d48b..8b9af35193 100644
--- a/modules/desktop_capture/mac/screen_capturer_mac.mm
+++ b/modules/desktop_capture/mac/screen_capturer_mac.mm
@@ -263,6 +263,7 @@ void ScreenCapturerMac::Start(Callback* callback) {
"webrtc", "ScreenCapturermac::Start", "target display id ", current_display_);
void RTCPReceiver::RemoteRTCPSenderInfo(uint32_t* packet_count,
- uint32_t* octet_count) const {
+ uint32_t* octet_count,
+ int64_t* ntp_timestamp_ms) const {
MutexLock lock(&rtcp_receiver_lock_);
*packet_count = remote_sender_packet_count_;
*octet_count = remote_sender_octet_count_;
+ *ntp_timestamp_ms = remote_sender_ntp_time_.ToMs();
}
callback_ = callback;
+ update_screen_configuration_ = false;
// Start and operate CGDisplayStream handler all from capture thread.
if (!RegisterRefreshAndMoveHandlers()) {
RTC_LOG(LS_ERROR) << "Failed to register refresh and move handlers.";
@@ -283,7 +284,8 @@ void ScreenCapturerMac::CaptureFrame() {
}
std::vector<ReportBlockData> RTCPReceiver::GetLatestReportBlockData() const {
diff --git a/modules/rtp_rtcp/source/rtcp_receiver.h b/modules/rtp_rtcp/source/rtcp_receiver.h
index 59e0258df5..e748b257e8 100644
--- a/modules/rtp_rtcp/source/rtcp_receiver.h
+++ b/modules/rtp_rtcp/source/rtcp_receiver.h
@@ -119,7 +119,8 @@ class RTCPReceiver final {
MacDesktopConfiguration new_config = desktop_config_monitor_->desktop_configuration();
- if (!desktop_config_.Equals(new_config)) {
+ if (update_screen_configuration_ || !desktop_config_.Equals(new_config)) {
+ update_screen_configuration_ = false;
desktop_config_ = new_config;
// If the display configuraiton has changed then refresh capturer data
// structures. Occasionally, the refresh and move handlers are lost when
diff --git a/modules/desktop_capture/mouse_cursor_monitor_mac.mm b/modules/desktop_capture/mouse_cursor_monitor_mac.mm
index 3db4332cd1..512103ab5e 100644
--- a/modules/desktop_capture/mouse_cursor_monitor_mac.mm
+++ b/modules/desktop_capture/mouse_cursor_monitor_mac.mm
@@ -133,7 +133,7 @@ void MouseCursorMonitorMac::CaptureImage(float scale) {
NSSize nssize = [nsimage size]; // DIP size
// Get received sender packet and octet counts
void RemoteRTCPSenderInfo(uint32_t* packet_count,
- uint32_t* octet_count) const;
+ uint32_t* octet_count,
+ int64_t* ntp_timestamp_ms) const;
// No need to caputre cursor image if it's unchanged since last capture.
- if ([[nsimage TIFFRepresentation] isEqual:[last_cursor_ TIFFRepresentation]]) return;
+ if (last_cursor_ && [[nsimage TIFFRepresentation] isEqual:[last_cursor_ TIFFRepresentation]]) return;
last_cursor_ = nsimage;
absl::optional<TimeDelta> AverageRtt() const;
absl::optional<TimeDelta> LastRtt() const;
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
index 8ca6b7ecb5..83690f160c 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
@@ -501,8 +501,10 @@ void ModuleRtpRtcpImpl::GetSendStreamDataCounters(
// Received RTCP report.
void ModuleRtpRtcpImpl::RemoteRTCPSenderInfo(uint32_t* packet_count,
- uint32_t* octet_count) const {
- return rtcp_receiver_.RemoteRTCPSenderInfo(packet_count, octet_count);
+ uint32_t* octet_count,
+ int64_t* ntp_timestamp_ms) const {
+ return rtcp_receiver_.RemoteRTCPSenderInfo(packet_count, octet_count,
+ ntp_timestamp_ms);
}
std::vector<ReportBlockData> ModuleRtpRtcpImpl::GetLatestReportBlockData()
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.h b/modules/rtp_rtcp/source/rtp_rtcp_impl.h
index dd706e569d..742a69cce3 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl.h
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.h
@@ -183,7 +183,8 @@ class ABSL_DEPRECATED("") ModuleRtpRtcpImpl
StreamDataCounters* rtx_counters) const override;
void RemoteRTCPSenderInfo(uint32_t* packet_count,
- uint32_t* octet_count) const override;
+ uint32_t* octet_count,
+ int64_t* ntp_timestamp_ms) const override;
// A snapshot of the most recent Report Block with additional data of
// interest to statistics. Used to implement RTCRemoteInboundRtpStreamStats.
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc
index 0df8543497..31a1b764b3 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc
@@ -504,8 +504,10 @@ void ModuleRtpRtcpImpl2::GetSendStreamDataCounters(
// Received RTCP report.
void ModuleRtpRtcpImpl2::RemoteRTCPSenderInfo(uint32_t* packet_count,
- uint32_t* octet_count) const {
- return rtcp_receiver_.RemoteRTCPSenderInfo(packet_count, octet_count);
+ uint32_t* octet_count,
+ int64_t* ntp_timestamp_ms) const {
+ return rtcp_receiver_.RemoteRTCPSenderInfo(packet_count, octet_count,
+ ntp_timestamp_ms);
}
std::vector<ReportBlockData> ModuleRtpRtcpImpl2::GetLatestReportBlockData()
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl2.h b/modules/rtp_rtcp/source/rtp_rtcp_impl2.h
index 663b28af3e..a9d18ec44a 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl2.h
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl2.h
@@ -195,7 +195,8 @@ class ModuleRtpRtcpImpl2 final : public RtpRtcpInterface,
StreamDataCounters* rtx_counters) const override;
void RemoteRTCPSenderInfo(uint32_t* packet_count,
- uint32_t* octet_count) const override;
+ uint32_t* octet_count,
+ int64_t* ntp_timestamp_ms) const override;
// A snapshot of the most recent Report Block with additional data of
// interest to statistics. Used to implement RTCRemoteInboundRtpStreamStats.
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_interface.h b/modules/rtp_rtcp/source/rtp_rtcp_interface.h
index 5ad7680d61..dc86f92bf5 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_interface.h
+++ b/modules/rtp_rtcp/source/rtp_rtcp_interface.h
@@ -389,9 +389,10 @@ class RtpRtcpInterface : public RtcpFeedbackSenderInterface {
StreamDataCounters* rtx_counters) const = 0;
- // Returns packet count and octet count from RTCP sender report.
+ // Returns packet count, octet count, and timestamp from RTCP sender report.
virtual void RemoteRTCPSenderInfo(uint32_t* packet_count,
- uint32_t* octet_count) const = 0;
+ uint32_t* octet_count,
+ int64_t* ntp_timestamp_ms) const = 0;
// A snapshot of Report Blocks with additional data of interest to statistics.
// Within this list, the sender-source SSRC pair is unique and per-pair the
// ReportBlockData represents the latest Report Block that was received for
DesktopSize size(round(nssize.width * scale),

Просмотреть файл

@ -1,65 +1,53 @@
From: Dan Minor <dminor@mozilla.com>
Date: Tue, 31 Jul 2018 13:32:00 -0400
Subject: Bug 1376873 - OS X desktop capture fixes; r=pehrsons
From: "Byron Campen [:bwc]" <docfaraday@gmail.com>
Date: Fri, 12 Feb 2021 14:27:00 +0000
Subject: Bug 1654112 - Get OS X build working.
r=ng,firefox-build-system-reviewers,glandium
Differential Revision: https://phabricator.services.mozilla.com/D7464
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/02c038eca65c1218b56fdf8937fdeab3d8767fe6
* Pull in sdk/objc/base and sdk/objc/helpers
* Add gclient_args.gni to keep build happy.
* Add a missing include path for libyuv
* Support .m files in build.
Differential Revision: https://phabricator.services.mozilla.com/D105015
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/9314046d89ebc0836a50ab7addece71abbf0b5e4
---
modules/desktop_capture/mac/screen_capturer_mac.h | 7 +++++++
modules/desktop_capture/mac/screen_capturer_mac.mm | 4 +++-
modules/desktop_capture/mouse_cursor_monitor_mac.mm | 2 +-
3 files changed, 11 insertions(+), 2 deletions(-)
modules/desktop_capture/mac/screen_capturer_mac.mm | 3 ++-
modules/desktop_capture/mac/window_list_utils.cc | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/modules/desktop_capture/mac/screen_capturer_mac.h b/modules/desktop_capture/mac/screen_capturer_mac.h
index 7e38b5bd08..e4a2cc2fc9 100644
--- a/modules/desktop_capture/mac/screen_capturer_mac.h
+++ b/modules/desktop_capture/mac/screen_capturer_mac.h
@@ -113,6 +113,13 @@ class ScreenCapturerMac final : public DesktopCapturer {
// Start, CaptureFrame and destructor have to called in the same thread.
SequenceChecker thread_checker_;
+
+ // Used to force CaptureFrame to update it's screen configuration
+ // and reregister event handlers. This ensure that this
+ // occurs on the ScreenCapture thread. Read and written from
+ // both the VideoCapture thread and ScreenCapture thread.
+ // Protected by desktop_config_monitor_.
+ bool update_screen_configuration_ = false;
};
} // namespace webrtc
diff --git a/modules/desktop_capture/mac/screen_capturer_mac.mm b/modules/desktop_capture/mac/screen_capturer_mac.mm
index 8f0c68d48b..8b9af35193 100644
index 8b9af35193..76fec13a39 100644
--- a/modules/desktop_capture/mac/screen_capturer_mac.mm
+++ b/modules/desktop_capture/mac/screen_capturer_mac.mm
@@ -263,6 +263,7 @@ void ScreenCapturerMac::Start(Callback* callback) {
"webrtc", "ScreenCapturermac::Start", "target display id ", current_display_);
callback_ = callback;
+ update_screen_configuration_ = false;
// Start and operate CGDisplayStream handler all from capture thread.
if (!RegisterRefreshAndMoveHandlers()) {
RTC_LOG(LS_ERROR) << "Failed to register refresh and move handlers.";
@@ -283,7 +284,8 @@ void ScreenCapturerMac::CaptureFrame() {
@@ -357,7 +357,8 @@ bool ScreenCapturerMac::GetSourceList(SourceList* screens) {
for (MacDisplayConfigurations::iterator it = desktop_config_.displays.begin();
it != desktop_config_.displays.end();
++it) {
- screens->push_back({it->id, std::string()});
+ Source value = {it->id, 0, std::string()};
+ screens->push_back(value);
}
MacDesktopConfiguration new_config = desktop_config_monitor_->desktop_configuration();
- if (!desktop_config_.Equals(new_config)) {
+ if (update_screen_configuration_ || !desktop_config_.Equals(new_config)) {
+ update_screen_configuration_ = false;
desktop_config_ = new_config;
// If the display configuraiton has changed then refresh capturer data
// structures. Occasionally, the refresh and move handlers are lost when
diff --git a/modules/desktop_capture/mouse_cursor_monitor_mac.mm b/modules/desktop_capture/mouse_cursor_monitor_mac.mm
index 3db4332cd1..512103ab5e 100644
--- a/modules/desktop_capture/mouse_cursor_monitor_mac.mm
+++ b/modules/desktop_capture/mouse_cursor_monitor_mac.mm
@@ -133,7 +133,7 @@ void MouseCursorMonitorMac::CaptureImage(float scale) {
NSSize nssize = [nsimage size]; // DIP size
// No need to caputre cursor image if it's unchanged since last capture.
- if ([[nsimage TIFFRepresentation] isEqual:[last_cursor_ TIFFRepresentation]]) return;
+ if (last_cursor_ && [[nsimage TIFFRepresentation] isEqual:[last_cursor_ TIFFRepresentation]]) return;
last_cursor_ = nsimage;
DesktopSize size(round(nssize.width * scale),
return true;
}
diff --git a/modules/desktop_capture/mac/window_list_utils.cc b/modules/desktop_capture/mac/window_list_utils.cc
index 5d881662ea..989ec7ea54 100644
--- a/modules/desktop_capture/mac/window_list_utils.cc
+++ b/modules/desktop_capture/mac/window_list_utils.cc
@@ -198,7 +198,7 @@ bool GetWindowList(DesktopCapturer::SourceList* windows,
// the check in the map. Also skip the window if owner name is
// empty too.
if (!owner_name.empty() && (itr == pid_itr_map.end())) {
- sources.push_back(DesktopCapturer::Source{window_id, owner_name});
+ sources.push_back(DesktopCapturer::Source{window_id, pid, owner_name});
RTC_DCHECK(!sources.empty());
// Get an iterator on the last valid element in the source list.
std::list<DesktopCapturer::Source>::const_iterator last_source =
@@ -209,7 +209,7 @@ bool GetWindowList(DesktopCapturer::SourceList* windows,
pid, last_source));
}
} else {
- sources.push_back(DesktopCapturer::Source{window_id, title});
+ sources.push_back(DesktopCapturer::Source{window_id, pid, title});
// Once the window with empty title has been removed no other empty
// windows are allowed for the same pid.
if (itr != pid_itr_map.end() && (itr->second != sources.end())) {

Просмотреть файл

@ -1,53 +1,23 @@
From: "Byron Campen [:bwc]" <docfaraday@gmail.com>
Date: Fri, 12 Feb 2021 14:27:00 +0000
Subject: Bug 1654112 - Get OS X build working.
r=ng,firefox-build-system-reviewers,glandium
From: Dan Minor <dminor@mozilla.com>
Date: Mon, 13 Aug 2018 08:34:00 -0400
Subject: Bug 1376873 - Allow single channel opus; r=padenot
* Pull in sdk/objc/base and sdk/objc/helpers
* Add gclient_args.gni to keep build happy.
* Add a missing include path for libyuv
* Support .m files in build.
Differential Revision: https://phabricator.services.mozilla.com/D105015
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/9314046d89ebc0836a50ab7addece71abbf0b5e4
Differential Revision: https://phabricator.services.mozilla.com/D7469
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/92a7c3eee9f0c80ffbf79fdab8f8f2b8f6bd7701
---
modules/desktop_capture/mac/screen_capturer_mac.mm | 3 ++-
modules/desktop_capture/mac/window_list_utils.cc | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
modules/audio_coding/codecs/opus/audio_encoder_opus.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/desktop_capture/mac/screen_capturer_mac.mm b/modules/desktop_capture/mac/screen_capturer_mac.mm
index 8b9af35193..76fec13a39 100644
--- a/modules/desktop_capture/mac/screen_capturer_mac.mm
+++ b/modules/desktop_capture/mac/screen_capturer_mac.mm
@@ -357,7 +357,8 @@ bool ScreenCapturerMac::GetSourceList(SourceList* screens) {
for (MacDisplayConfigurations::iterator it = desktop_config_.displays.begin();
it != desktop_config_.displays.end();
++it) {
- screens->push_back({it->id, std::string()});
+ Source value = {it->id, 0, std::string()};
+ screens->push_back(value);
diff --git a/modules/audio_coding/codecs/opus/audio_encoder_opus.cc b/modules/audio_coding/codecs/opus/audio_encoder_opus.cc
index 51b0fcd492..17e0e33b1d 100644
--- a/modules/audio_coding/codecs/opus/audio_encoder_opus.cc
+++ b/modules/audio_coding/codecs/opus/audio_encoder_opus.cc
@@ -240,7 +240,7 @@ std::unique_ptr<AudioEncoder> AudioEncoderOpusImpl::MakeAudioEncoder(
absl::optional<AudioEncoderOpusConfig> AudioEncoderOpusImpl::SdpToConfig(
const SdpAudioFormat& format) {
if (!absl::EqualsIgnoreCase(format.name, "opus") ||
- format.clockrate_hz != kRtpTimestampRateHz || format.num_channels != 2) {
+ format.clockrate_hz != kRtpTimestampRateHz) {
return absl::nullopt;
}
return true;
}
diff --git a/modules/desktop_capture/mac/window_list_utils.cc b/modules/desktop_capture/mac/window_list_utils.cc
index 5d881662ea..989ec7ea54 100644
--- a/modules/desktop_capture/mac/window_list_utils.cc
+++ b/modules/desktop_capture/mac/window_list_utils.cc
@@ -198,7 +198,7 @@ bool GetWindowList(DesktopCapturer::SourceList* windows,
// the check in the map. Also skip the window if owner name is
// empty too.
if (!owner_name.empty() && (itr == pid_itr_map.end())) {
- sources.push_back(DesktopCapturer::Source{window_id, owner_name});
+ sources.push_back(DesktopCapturer::Source{window_id, pid, owner_name});
RTC_DCHECK(!sources.empty());
// Get an iterator on the last valid element in the source list.
std::list<DesktopCapturer::Source>::const_iterator last_source =
@@ -209,7 +209,7 @@ bool GetWindowList(DesktopCapturer::SourceList* windows,
pid, last_source));
}
} else {
- sources.push_back(DesktopCapturer::Source{window_id, title});
+ sources.push_back(DesktopCapturer::Source{window_id, pid, title});
// Once the window with empty title has been removed no other empty
// windows are allowed for the same pid.
if (itr != pid_itr_map.end() && (itr->second != sources.end())) {

Просмотреть файл

@ -1,23 +1,42 @@
From: Dan Minor <dminor@mozilla.com>
Date: Mon, 13 Aug 2018 08:34:00 -0400
Subject: Bug 1376873 - Allow single channel opus; r=padenot
Date: Wed, 19 Sep 2018 15:06:00 -0400
Subject: Bug 1376873 - Fix up rotation in video_capture_impl.cc; r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D7469
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/92a7c3eee9f0c80ffbf79fdab8f8f2b8f6bd7701
This fixes a bug in the upstream code introduced when they removed the
ConvertToI420 helper method from webrtc_libyuv.cc. The buffer size is
passed into libyuv::ConvertI420 incorrectly when rotation is applied, which
causes bad rendering and instabilities.
Differential Revision: https://phabricator.services.mozilla.com/D7478
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/c56cb66f86518dfb046c642ebeb07cf51c23a3cb
---
modules/audio_coding/codecs/opus/audio_encoder_opus.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
modules/video_capture/video_capture_impl.cc | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/modules/audio_coding/codecs/opus/audio_encoder_opus.cc b/modules/audio_coding/codecs/opus/audio_encoder_opus.cc
index 51b0fcd492..17e0e33b1d 100644
--- a/modules/audio_coding/codecs/opus/audio_encoder_opus.cc
+++ b/modules/audio_coding/codecs/opus/audio_encoder_opus.cc
@@ -240,7 +240,7 @@ std::unique_ptr<AudioEncoder> AudioEncoderOpusImpl::MakeAudioEncoder(
absl::optional<AudioEncoderOpusConfig> AudioEncoderOpusImpl::SdpToConfig(
const SdpAudioFormat& format) {
if (!absl::EqualsIgnoreCase(format.name, "opus") ||
- format.clockrate_hz != kRtpTimestampRateHz || format.num_channels != 2) {
+ format.clockrate_hz != kRtpTimestampRateHz) {
return absl::nullopt;
diff --git a/modules/video_capture/video_capture_impl.cc b/modules/video_capture/video_capture_impl.cc
index 66fd0a0ebe..7071776d0a 100644
--- a/modules/video_capture/video_capture_impl.cc
+++ b/modules/video_capture/video_capture_impl.cc
@@ -218,12 +218,21 @@ int32_t VideoCaptureImpl::IncomingFrame(uint8_t* videoFrame,
}
}
+ int dst_width = buffer->width();
+ int dst_height = buffer->height();
+
+ // LibYuv expects pre-rotation_mode values for dst.
+ // Stride values should correspond to the destination values.
+ if (rotation_mode == libyuv::kRotate90 || rotation_mode == libyuv::kRotate270) {
+ std::swap(dst_width, dst_height);
+ }
+
const int conversionResult = libyuv::ConvertToI420(
videoFrame, videoFrameLength, buffer.get()->MutableDataY(),
buffer.get()->StrideY(), buffer.get()->MutableDataU(),
buffer.get()->StrideU(), buffer.get()->MutableDataV(),
buffer.get()->StrideV(), 0, 0, // No Cropping
- width, height, target_width, target_height, rotation_mode,
+ width, height, dst_width, dst_height, rotation_mode,
ConvertVideoType(frameInfo.videoType));
if (conversionResult != 0) {
RTC_LOG(LS_ERROR) << "Failed to convert capture frame from type "

Просмотреть файл

@ -1,42 +1,150 @@
From: Dan Minor <dminor@mozilla.com>
Date: Wed, 19 Sep 2018 15:06:00 -0400
Subject: Bug 1376873 - Fix up rotation in video_capture_impl.cc; r=pehrsons
From: Jan Beich <jbeich@FreeBSD.org>
Date: Fri, 12 Oct 2018 12:56:00 -0400
Subject: Bug 1376873 - Unbreak WebRTC 64 build on BSDs. r=dminor f=gaston
This fixes a bug in the upstream code introduced when they removed the
ConvertToI420 helper method from webrtc_libyuv.cc. The buffer size is
passed into libyuv::ConvertI420 incorrectly when rotation is applied, which
causes bad rendering and instabilities.
Also includes:
Bug 1554949 - Fix WebRTC build failure with newer linux kernel. r=dminor
Differential Revision: https://phabricator.services.mozilla.com/D7478
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/c56cb66f86518dfb046c642ebeb07cf51c23a3cb
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/a636ecdcb91afb1c5d436bbcbd87da4f10f7df78
---
modules/video_capture/video_capture_impl.cc | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
modules/video_capture/linux/device_info_linux.cc | 6 ++++++
modules/video_capture/linux/device_info_v4l2.cc | 8 +++++++-
modules/video_capture/linux/video_capture_linux.cc | 9 ++++++++-
rtc_base/byte_order.h | 2 ++
rtc_base/physical_socket_server.cc | 7 +++++--
system_wrappers/source/cpu_info.cc | 4 ++--
6 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/modules/video_capture/video_capture_impl.cc b/modules/video_capture/video_capture_impl.cc
index 66fd0a0ebe..7071776d0a 100644
--- a/modules/video_capture/video_capture_impl.cc
+++ b/modules/video_capture/video_capture_impl.cc
@@ -218,12 +218,21 @@ int32_t VideoCaptureImpl::IncomingFrame(uint8_t* videoFrame,
}
}
diff --git a/modules/video_capture/linux/device_info_linux.cc b/modules/video_capture/linux/device_info_linux.cc
index 4f8b7c059b..56da475bf3 100644
--- a/modules/video_capture/linux/device_info_linux.cc
+++ b/modules/video_capture/linux/device_info_linux.cc
@@ -16,7 +16,13 @@
#include <sys/ioctl.h>
#include <unistd.h>
// v4l includes
+#if defined(__NetBSD__) || defined(__OpenBSD__) // WEBRTC_BSD
+#include <sys/videoio.h>
+#elif defined(__sun)
+#include <sys/videodev2.h>
+#else
#include <linux/videodev2.h>
+#endif
+ int dst_width = buffer->width();
+ int dst_height = buffer->height();
+
+ // LibYuv expects pre-rotation_mode values for dst.
+ // Stride values should correspond to the destination values.
+ if (rotation_mode == libyuv::kRotate90 || rotation_mode == libyuv::kRotate270) {
+ std::swap(dst_width, dst_height);
+ }
+
const int conversionResult = libyuv::ConvertToI420(
videoFrame, videoFrameLength, buffer.get()->MutableDataY(),
buffer.get()->StrideY(), buffer.get()->MutableDataU(),
buffer.get()->StrideU(), buffer.get()->MutableDataV(),
buffer.get()->StrideV(), 0, 0, // No Cropping
- width, height, target_width, target_height, rotation_mode,
+ width, height, dst_width, dst_height, rotation_mode,
ConvertVideoType(frameInfo.videoType));
if (conversionResult != 0) {
RTC_LOG(LS_ERROR) << "Failed to convert capture frame from type "
#include <vector>
diff --git a/modules/video_capture/linux/device_info_v4l2.cc b/modules/video_capture/linux/device_info_v4l2.cc
index 7397a10625..19b32f16b9 100644
--- a/modules/video_capture/linux/device_info_v4l2.cc
+++ b/modules/video_capture/linux/device_info_v4l2.cc
@@ -18,7 +18,13 @@
#include <sys/ioctl.h>
#include <unistd.h>
// v4l includes
+#if defined(__NetBSD__) || defined(__OpenBSD__) // WEBRTC_BSD
+#include <sys/videoio.h>
+#elif defined(__sun)
+#include <sys/videodev2.h>
+#else
#include <linux/videodev2.h>
+#endif
#include <vector>
@@ -209,8 +215,8 @@ DeviceInfoV4l2::DeviceInfoV4l2() : DeviceInfoImpl()
{
_inotifyEventThread->Start();
}
-}
#endif
+}
int32_t DeviceInfoV4l2::Init() {
return 0;
diff --git a/modules/video_capture/linux/video_capture_linux.cc b/modules/video_capture/linux/video_capture_linux.cc
index a2ea218a8b..23a8f4f3f3 100644
--- a/modules/video_capture/linux/video_capture_linux.cc
+++ b/modules/video_capture/linux/video_capture_linux.cc
@@ -10,7 +10,6 @@
#include <errno.h>
#include <fcntl.h>
-#include <linux/videodev2.h>
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
@@ -18,6 +17,14 @@
#include <sys/select.h>
#include <time.h>
#include <unistd.h>
+// v4l includes
+#if defined(__NetBSD__) || defined(__OpenBSD__) // WEBRTC_BSD
+#include <sys/videoio.h>
+#elif defined(__sun)
+#include <sys/videodev2.h>
+#else
+#include <linux/videodev2.h>
+#endif
#include <new>
#include <string>
diff --git a/rtc_base/byte_order.h b/rtc_base/byte_order.h
index b8f8ae9f7a..382511daeb 100644
--- a/rtc_base/byte_order.h
+++ b/rtc_base/byte_order.h
@@ -90,6 +90,8 @@
#error WEBRTC_ARCH_BIG_ENDIAN or WEBRTC_ARCH_LITTLE_ENDIAN must be defined.
#endif // defined(WEBRTC_ARCH_LITTLE_ENDIAN)
+#elif defined(WEBRTC_BSD) && !defined(__OpenBSD__)
+#include <sys/endian.h>
#elif defined(WEBRTC_POSIX)
#include <endian.h>
#else
diff --git a/rtc_base/physical_socket_server.cc b/rtc_base/physical_socket_server.cc
index d42168249a..33ea941808 100644
--- a/rtc_base/physical_socket_server.cc
+++ b/rtc_base/physical_socket_server.cc
@@ -75,7 +75,10 @@ typedef void* SockOptArg;
#endif // WEBRTC_POSIX
-#if defined(WEBRTC_POSIX) && !defined(WEBRTC_MAC) && !defined(__native_client__)
+#if defined(WEBRTC_POSIX) && !defined(WEBRTC_MAC) && !defined(WEBRTC_BSD) && !defined(__native_client__)
+#if defined(WEBRTC_LINUX)
+#include <linux/sockios.h>
+#endif
int64_t GetSocketRecvTimestamp(int socket) {
struct timeval tv_ioctl;
@@ -643,7 +646,7 @@ int PhysicalSocket::TranslateOption(Option opt, int* slevel, int* sopt) {
*slevel = IPPROTO_IP;
*sopt = IP_DONTFRAGMENT;
break;
-#elif defined(WEBRTC_MAC) || defined(BSD) || defined(__native_client__)
+#elif defined(WEBRTC_MAC) || defined(WEBRTC_BSD) || defined(__native_client__)
RTC_LOG(LS_WARNING) << "Socket::OPT_DONTFRAGMENT not supported.";
return -1;
#elif defined(WEBRTC_POSIX)
diff --git a/system_wrappers/source/cpu_info.cc b/system_wrappers/source/cpu_info.cc
index eff720371a..94aed09c48 100644
--- a/system_wrappers/source/cpu_info.cc
+++ b/system_wrappers/source/cpu_info.cc
@@ -12,7 +12,7 @@
#if defined(WEBRTC_WIN)
#include <windows.h>
-#elif defined(WEBRTC_LINUX)
+#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD)
#include <unistd.h>
#elif defined(WEBRTC_MAC)
#include <sys/sysctl.h>
@@ -30,7 +30,7 @@ static int DetectNumberOfCores() {
SYSTEM_INFO si;
GetNativeSystemInfo(&si);
number_of_cores = static_cast<int>(si.dwNumberOfProcessors);
-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID)
+#elif defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID) || defined(WEBRTC_BSD)
number_of_cores = static_cast<int>(sysconf(_SC_NPROCESSORS_ONLN));
if (number_of_cores <= 0) {
RTC_LOG(LS_ERROR) << "Failed to get number of cores";

Просмотреть файл

@ -1,150 +1,29 @@
From: Jan Beich <jbeich@FreeBSD.org>
Date: Fri, 12 Oct 2018 12:56:00 -0400
Subject: Bug 1376873 - Unbreak WebRTC 64 build on BSDs. r=dminor f=gaston
From: Jed Davis <jld@mozilla.com>
Date: Sun, 17 Nov 2019 03:40:00 +0000
Subject: Bug 1545504 - Strengthen bounds check in WebRTC PhysicalSocketServer.
r=jesup
Also includes:
Bug 1554949 - Fix WebRTC build failure with newer linux kernel. r=dminor
PhysicalSocketServer isn't currently used by Mozilla's WebRTC
integration, but just in case, let's make sure that this array index is
bounds-checked in actual use, not just in debug builds (which tend to
never see realistic test conditions).
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/a636ecdcb91afb1c5d436bbcbd87da4f10f7df78
Differential Revision: https://phabricator.services.mozilla.com/D52745
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/2b079067648bfe0d064a334bf19bdcc233e26b6e
---
modules/video_capture/linux/device_info_linux.cc | 6 ++++++
modules/video_capture/linux/device_info_v4l2.cc | 8 +++++++-
modules/video_capture/linux/video_capture_linux.cc | 9 ++++++++-
rtc_base/byte_order.h | 2 ++
rtc_base/physical_socket_server.cc | 7 +++++--
system_wrappers/source/cpu_info.cc | 4 ++--
6 files changed, 30 insertions(+), 6 deletions(-)
rtc_base/physical_socket_server.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/video_capture/linux/device_info_linux.cc b/modules/video_capture/linux/device_info_linux.cc
index 4f8b7c059b..56da475bf3 100644
--- a/modules/video_capture/linux/device_info_linux.cc
+++ b/modules/video_capture/linux/device_info_linux.cc
@@ -16,7 +16,13 @@
#include <sys/ioctl.h>
#include <unistd.h>
// v4l includes
+#if defined(__NetBSD__) || defined(__OpenBSD__) // WEBRTC_BSD
+#include <sys/videoio.h>
+#elif defined(__sun)
+#include <sys/videodev2.h>
+#else
#include <linux/videodev2.h>
+#endif
#include <vector>
diff --git a/modules/video_capture/linux/device_info_v4l2.cc b/modules/video_capture/linux/device_info_v4l2.cc
index 7397a10625..19b32f16b9 100644
--- a/modules/video_capture/linux/device_info_v4l2.cc
+++ b/modules/video_capture/linux/device_info_v4l2.cc
@@ -18,7 +18,13 @@
#include <sys/ioctl.h>
#include <unistd.h>
// v4l includes
+#if defined(__NetBSD__) || defined(__OpenBSD__) // WEBRTC_BSD
+#include <sys/videoio.h>
+#elif defined(__sun)
+#include <sys/videodev2.h>
+#else
#include <linux/videodev2.h>
+#endif
#include <vector>
@@ -209,8 +215,8 @@ DeviceInfoV4l2::DeviceInfoV4l2() : DeviceInfoImpl()
{
_inotifyEventThread->Start();
}
-}
#endif
+}
int32_t DeviceInfoV4l2::Init() {
return 0;
diff --git a/modules/video_capture/linux/video_capture_linux.cc b/modules/video_capture/linux/video_capture_linux.cc
index a2ea218a8b..23a8f4f3f3 100644
--- a/modules/video_capture/linux/video_capture_linux.cc
+++ b/modules/video_capture/linux/video_capture_linux.cc
@@ -10,7 +10,6 @@
#include <errno.h>
#include <fcntl.h>
-#include <linux/videodev2.h>
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
@@ -18,6 +17,14 @@
#include <sys/select.h>
#include <time.h>
#include <unistd.h>
+// v4l includes
+#if defined(__NetBSD__) || defined(__OpenBSD__) // WEBRTC_BSD
+#include <sys/videoio.h>
+#elif defined(__sun)
+#include <sys/videodev2.h>
+#else
+#include <linux/videodev2.h>
+#endif
#include <new>
#include <string>
diff --git a/rtc_base/byte_order.h b/rtc_base/byte_order.h
index b8f8ae9f7a..382511daeb 100644
--- a/rtc_base/byte_order.h
+++ b/rtc_base/byte_order.h
@@ -90,6 +90,8 @@
#error WEBRTC_ARCH_BIG_ENDIAN or WEBRTC_ARCH_LITTLE_ENDIAN must be defined.
#endif // defined(WEBRTC_ARCH_LITTLE_ENDIAN)
+#elif defined(WEBRTC_BSD) && !defined(__OpenBSD__)
+#include <sys/endian.h>
#elif defined(WEBRTC_POSIX)
#include <endian.h>
#else
diff --git a/rtc_base/physical_socket_server.cc b/rtc_base/physical_socket_server.cc
index d42168249a..33ea941808 100644
index 33ea941808..2dfdd9a5df 100644
--- a/rtc_base/physical_socket_server.cc
+++ b/rtc_base/physical_socket_server.cc
@@ -75,7 +75,10 @@ typedef void* SockOptArg;
@@ -1431,7 +1431,7 @@ bool PhysicalSocketServer::WaitSelect(int cmsWait, bool process_io) {
int fd = pdispatcher->GetDescriptor();
// "select"ing a file descriptor that is equal to or larger than
// FD_SETSIZE will result in undefined behavior.
- RTC_DCHECK_LT(fd, FD_SETSIZE);
+ RTC_CHECK_LT(fd, FD_SETSIZE);
if (fd > fdmax)
fdmax = fd;
#endif // WEBRTC_POSIX
-#if defined(WEBRTC_POSIX) && !defined(WEBRTC_MAC) && !defined(__native_client__)
+#if defined(WEBRTC_POSIX) && !defined(WEBRTC_MAC) && !defined(WEBRTC_BSD) && !defined(__native_client__)
+#if defined(WEBRTC_LINUX)
+#include <linux/sockios.h>
+#endif
int64_t GetSocketRecvTimestamp(int socket) {
struct timeval tv_ioctl;
@@ -643,7 +646,7 @@ int PhysicalSocket::TranslateOption(Option opt, int* slevel, int* sopt) {
*slevel = IPPROTO_IP;
*sopt = IP_DONTFRAGMENT;
break;
-#elif defined(WEBRTC_MAC) || defined(BSD) || defined(__native_client__)
+#elif defined(WEBRTC_MAC) || defined(WEBRTC_BSD) || defined(__native_client__)
RTC_LOG(LS_WARNING) << "Socket::OPT_DONTFRAGMENT not supported.";
return -1;
#elif defined(WEBRTC_POSIX)
diff --git a/system_wrappers/source/cpu_info.cc b/system_wrappers/source/cpu_info.cc
index eff720371a..94aed09c48 100644
--- a/system_wrappers/source/cpu_info.cc
+++ b/system_wrappers/source/cpu_info.cc
@@ -12,7 +12,7 @@
#if defined(WEBRTC_WIN)
#include <windows.h>
-#elif defined(WEBRTC_LINUX)
+#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD)
#include <unistd.h>
#elif defined(WEBRTC_MAC)
#include <sys/sysctl.h>
@@ -30,7 +30,7 @@ static int DetectNumberOfCores() {
SYSTEM_INFO si;
GetNativeSystemInfo(&si);
number_of_cores = static_cast<int>(si.dwNumberOfProcessors);
-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID)
+#elif defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID) || defined(WEBRTC_BSD)
number_of_cores = static_cast<int>(sysconf(_SC_NPROCESSORS_ONLN));
if (number_of_cores <= 0) {
RTC_LOG(LS_ERROR) << "Failed to get number of cores";

Просмотреть файл

@ -1,29 +1,46 @@
From: Jed Davis <jld@mozilla.com>
Date: Sun, 17 Nov 2019 03:40:00 +0000
Subject: Bug 1545504 - Strengthen bounds check in WebRTC PhysicalSocketServer.
r=jesup
From: Dan Minor <dminor@mozilla.com>
Date: Mon, 5 Nov 2018 10:33:00 -0500
Subject: Bug 1376873 - Reduce thread stack size in platform_thread.cc; r=bwc
PhysicalSocketServer isn't currently used by Mozilla's WebRTC
integration, but just in case, let's make sure that this array index is
bounds-checked in actual use, not just in debug builds (which tend to
never see realistic test conditions).
Summary:
The current default stack size of 1M results in intermittent OOMs on win32
builds while running web-platform tests. The value of 256k was chosen for
consistency with the default value used elsewhere in Gecko, which is defined in
nsIThreadManager.idl.
Differential Revision: https://phabricator.services.mozilla.com/D52745
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/2b079067648bfe0d064a334bf19bdcc233e26b6e
Reviewers: bwc
Tags: #secure-revision
Bug #: 1376873
Differential Revision: https://phabricator.services.mozilla.com/D11090
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/e83c311e5293902be4db4ecea17cff87c633f7cf
---
rtc_base/physical_socket_server.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
rtc_base/platform_thread.cc | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/rtc_base/physical_socket_server.cc b/rtc_base/physical_socket_server.cc
index 33ea941808..2dfdd9a5df 100644
--- a/rtc_base/physical_socket_server.cc
+++ b/rtc_base/physical_socket_server.cc
@@ -1431,7 +1431,7 @@ bool PhysicalSocketServer::WaitSelect(int cmsWait, bool process_io) {
int fd = pdispatcher->GetDescriptor();
// "select"ing a file descriptor that is equal to or larger than
// FD_SETSIZE will result in undefined behavior.
- RTC_DCHECK_LT(fd, FD_SETSIZE);
+ RTC_CHECK_LT(fd, FD_SETSIZE);
if (fd > fdmax)
fdmax = fd;
diff --git a/rtc_base/platform_thread.cc b/rtc_base/platform_thread.cc
index 6d369d747e..556204ac89 100644
--- a/rtc_base/platform_thread.cc
+++ b/rtc_base/platform_thread.cc
@@ -189,15 +189,17 @@ PlatformThread PlatformThread::SpawnThread(
// Set the reserved stack stack size to 1M, which is the default on Windows
// and Linux.
DWORD thread_id = 0;
+ // Mozilla: Set to 256kb for consistency with nsIThreadManager.idl
PlatformThread::Handle handle = ::CreateThread(
- nullptr, 1024 * 1024, &RunPlatformThread, start_thread_function_ptr,
+ nullptr, 256 * 1024, &RunPlatformThread, start_thread_function_ptr,
STACK_SIZE_PARAM_IS_A_RESERVATION, &thread_id);
RTC_CHECK(handle) << "CreateThread failed";
#else
pthread_attr_t attr;
pthread_attr_init(&attr);
// Set the stack stack size to 1M.
- pthread_attr_setstacksize(&attr, 1024 * 1024);
+ // Mozilla: Set to 256kb for consistency with nsIThreadManager.idl
+ pthread_attr_setstacksize(&attr, 256 * 1024);
pthread_attr_setdetachstate(
&attr, joinable ? PTHREAD_CREATE_JOINABLE : PTHREAD_CREATE_DETACHED);
PlatformThread::Handle handle;

Просмотреть файл

@ -1,46 +1,34 @@
From: Dan Minor <dminor@mozilla.com>
Date: Mon, 5 Nov 2018 10:33:00 -0500
Subject: Bug 1376873 - Reduce thread stack size in platform_thread.cc; r=bwc
Date: Thu, 31 Jan 2019 15:37:00 -0500
Subject: Bug 1524208 - Calculate stride based upon target_width in
video_capture_impl.cc; r=pehrsons
Summary:
The current default stack size of 1M results in intermittent OOMs on win32
builds while running web-platform tests. The value of 256k was chosen for
consistency with the default value used elsewhere in Gecko, which is defined in
nsIThreadManager.idl.
Reviewers: bwc
Tags: #secure-revision
Bug #: 1376873
Differential Revision: https://phabricator.services.mozilla.com/D11090
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/e83c311e5293902be4db4ecea17cff87c633f7cf
Differential Revision: https://phabricator.services.mozilla.com/D18270
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/51d12094d825c4c4467cb132d03d4f3cad4b1b82
---
rtc_base/platform_thread.cc | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
modules/video_capture/video_capture_impl.cc | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/rtc_base/platform_thread.cc b/rtc_base/platform_thread.cc
index 6d369d747e..556204ac89 100644
--- a/rtc_base/platform_thread.cc
+++ b/rtc_base/platform_thread.cc
@@ -189,15 +189,17 @@ PlatformThread PlatformThread::SpawnThread(
// Set the reserved stack stack size to 1M, which is the default on Windows
// and Linux.
DWORD thread_id = 0;
+ // Mozilla: Set to 256kb for consistency with nsIThreadManager.idl
PlatformThread::Handle handle = ::CreateThread(
- nullptr, 1024 * 1024, &RunPlatformThread, start_thread_function_ptr,
+ nullptr, 256 * 1024, &RunPlatformThread, start_thread_function_ptr,
STACK_SIZE_PARAM_IS_A_RESERVATION, &thread_id);
RTC_CHECK(handle) << "CreateThread failed";
#else
pthread_attr_t attr;
pthread_attr_init(&attr);
// Set the stack stack size to 1M.
- pthread_attr_setstacksize(&attr, 1024 * 1024);
+ // Mozilla: Set to 256kb for consistency with nsIThreadManager.idl
+ pthread_attr_setstacksize(&attr, 256 * 1024);
pthread_attr_setdetachstate(
&attr, joinable ? PTHREAD_CREATE_JOINABLE : PTHREAD_CREATE_DETACHED);
PlatformThread::Handle handle;
diff --git a/modules/video_capture/video_capture_impl.cc b/modules/video_capture/video_capture_impl.cc
index 7071776d0a..02404697ad 100644
--- a/modules/video_capture/video_capture_impl.cc
+++ b/modules/video_capture/video_capture_impl.cc
@@ -180,8 +180,6 @@ int32_t VideoCaptureImpl::IncomingFrame(uint8_t* videoFrame,
}
}
- int stride_y = width;
- int stride_uv = (width + 1) / 2;
int target_width = width;
int target_height = abs(height);
@@ -194,6 +192,9 @@ int32_t VideoCaptureImpl::IncomingFrame(uint8_t* videoFrame,
}
}
+ int stride_y = target_width;
+ int stride_uv = (target_width + 1) / 2;
+
// Setting absolute height (in case it was negative).
// In Windows, the image starts bottom left, instead of top left.
// Setting a negative source height, inverts the image (within LibYuv).

Просмотреть файл

@ -1,34 +1,44 @@
From: Dan Minor <dminor@mozilla.com>
Date: Thu, 31 Jan 2019 15:37:00 -0500
Subject: Bug 1524208 - Calculate stride based upon target_width in
video_capture_impl.cc; r=pehrsons
Date: Fri, 29 Mar 2019 18:43:00 +0000
Subject: Bug 1539220 - Prefer non-RGB24 capabilities when available;
r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D18270
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/51d12094d825c4c4467cb132d03d4f3cad4b1b82
We've hit a number of problems with handling of RGB24 video capture on
Windows. This adds a check that will ignore any RGB24 capture capabilities
when determining a best match if there are other capabilities available to
workaround the problems.
Differential Revision: https://phabricator.services.mozilla.com/D25449
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/c12307f3817bec87712ab5930493c3135c76b0a0
---
modules/video_capture/video_capture_impl.cc | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
modules/video_capture/device_info_impl.cc | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/modules/video_capture/video_capture_impl.cc b/modules/video_capture/video_capture_impl.cc
index 7071776d0a..02404697ad 100644
--- a/modules/video_capture/video_capture_impl.cc
+++ b/modules/video_capture/video_capture_impl.cc
@@ -180,8 +180,6 @@ int32_t VideoCaptureImpl::IncomingFrame(uint8_t* videoFrame,
}
}
diff --git a/modules/video_capture/device_info_impl.cc b/modules/video_capture/device_info_impl.cc
index 7cccdb51a7..2a6afb3147 100644
--- a/modules/video_capture/device_info_impl.cc
+++ b/modules/video_capture/device_info_impl.cc
@@ -100,10 +100,23 @@ int32_t DeviceInfoImpl::GetBestMatchedCapability(
const int32_t numberOfCapabilies =
static_cast<int32_t>(_captureCapabilities.size());
- int stride_y = width;
- int stride_uv = (width + 1) / 2;
int target_width = width;
int target_height = abs(height);
@@ -194,6 +192,9 @@ int32_t VideoCaptureImpl::IncomingFrame(uint8_t* videoFrame,
}
}
+ int stride_y = target_width;
+ int stride_uv = (target_width + 1) / 2;
+ bool hasNonRGB24Capability = false;
for (int32_t tmp = 0; tmp < numberOfCapabilies;
++tmp) // Loop through all capabilities
{
VideoCaptureCapability& capability = _captureCapabilities[tmp];
+ if (capability.videoType != VideoType::kRGB24) {
+ hasNonRGB24Capability = true;
+ }
+ }
+
// Setting absolute height (in case it was negative).
// In Windows, the image starts bottom left, instead of top left.
// Setting a negative source height, inverts the image (within LibYuv).
+ for (int32_t tmp = 0; tmp < numberOfCapabilies;
+ ++tmp) // Loop through all capabilities
+ {
+ VideoCaptureCapability& capability = _captureCapabilities[tmp];
+ if (hasNonRGB24Capability && capability.videoType == VideoType::kRGB24) {
+ continue;
+ }
const int32_t diffWidth = capability.width - requested.width;
const int32_t diffHeight = capability.height - requested.height;

Просмотреть файл

@ -1,44 +1,93 @@
From: Dan Minor <dminor@mozilla.com>
Date: Fri, 29 Mar 2019 18:43:00 +0000
Subject: Bug 1539220 - Prefer non-RGB24 capabilities when available;
r=pehrsons
Date: Tue, 17 Sep 2019 06:47:00 +0000
Subject: Bug 1581193 - Fix devicechange event on Windows; r=achronop
We've hit a number of problems with handling of RGB24 video capture on
Windows. This adds a check that will ignore any RGB24 capture capabilities
when determining a best match if there are other capabilities available to
workaround the problems.
This restores the code for generating devicechange events that was
accidentally removed as part of updating the Windows video capture code
in Bug 1552755.
Differential Revision: https://phabricator.services.mozilla.com/D25449
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/c12307f3817bec87712ab5930493c3135c76b0a0
Differential Revision: https://phabricator.services.mozilla.com/D46033
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/840c4edafa021eeac6a7e6ae0e828d0adcfea92e
---
modules/video_capture/device_info_impl.cc | 13 +++++++++++++
1 file changed, 13 insertions(+)
.../video_capture/windows/device_info_ds.cc | 39 +++++++++++++++++++
.../video_capture/windows/device_info_ds.h | 3 ++
2 files changed, 42 insertions(+)
diff --git a/modules/video_capture/device_info_impl.cc b/modules/video_capture/device_info_impl.cc
index 7cccdb51a7..2a6afb3147 100644
--- a/modules/video_capture/device_info_impl.cc
+++ b/modules/video_capture/device_info_impl.cc
@@ -100,10 +100,23 @@ int32_t DeviceInfoImpl::GetBestMatchedCapability(
const int32_t numberOfCapabilies =
static_cast<int32_t>(_captureCapabilities.size());
diff --git a/modules/video_capture/windows/device_info_ds.cc b/modules/video_capture/windows/device_info_ds.cc
index d0d274cb02..460ef3b7b9 100644
--- a/modules/video_capture/windows/device_info_ds.cc
+++ b/modules/video_capture/windows/device_info_ds.cc
@@ -20,6 +20,29 @@
namespace webrtc {
namespace videocapturemodule {
+ bool hasNonRGB24Capability = false;
for (int32_t tmp = 0; tmp < numberOfCapabilies;
++tmp) // Loop through all capabilities
{
VideoCaptureCapability& capability = _captureCapabilities[tmp];
+ if (capability.videoType != VideoType::kRGB24) {
+ hasNonRGB24Capability = true;
+LRESULT CALLBACK WndProc(HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
+{
+ DeviceInfoDS* pParent;
+ if (uiMsg == WM_CREATE)
+ {
+ pParent = (DeviceInfoDS*)((LPCREATESTRUCT)lParam)->lpCreateParams;
+ SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)pParent);
+ }
+ }
+ else if (uiMsg == WM_DESTROY)
+ {
+ SetWindowLongPtr(hWnd, GWLP_USERDATA, NULL);
+ }
+ else if (uiMsg == WM_DEVICECHANGE)
+ {
+ pParent = (DeviceInfoDS*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
+ if (pParent)
+ {
+ pParent->DeviceChange();
+ }
+ }
+ return DefWindowProc(hWnd, uiMsg, wParam, lParam);
+}
+
+ for (int32_t tmp = 0; tmp < numberOfCapabilies;
+ ++tmp) // Loop through all capabilities
+ {
+ VideoCaptureCapability& capability = _captureCapabilities[tmp];
+ if (hasNonRGB24Capability && capability.videoType == VideoType::kRGB24) {
+ continue;
+ }
// static
DeviceInfoDS* DeviceInfoDS::Create() {
DeviceInfoDS* dsInfo = new DeviceInfoDS();
@@ -77,6 +100,18 @@ DeviceInfoDS::DeviceInfoDS()
<< rtc::ToHex(hr);
}
}
+
+ _hInstance = reinterpret_cast<HINSTANCE>(GetModuleHandle(NULL));
+ _wndClass = {0};
+ _wndClass.lpfnWndProc = &WndProc;
+ _wndClass.lpszClassName = TEXT("DeviceInfoDS");
+ _wndClass.hInstance = _hInstance;
+
+ if (RegisterClass(&_wndClass)) {
+ _hwnd = CreateWindow(_wndClass.lpszClassName, NULL, 0, CW_USEDEFAULT,
+ CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL,
+ NULL, _hInstance, this);
+ }
}
const int32_t diffWidth = capability.width - requested.width;
const int32_t diffHeight = capability.height - requested.height;
DeviceInfoDS::~DeviceInfoDS() {
@@ -85,6 +120,10 @@ DeviceInfoDS::~DeviceInfoDS() {
if (_CoUninitializeIsRequired) {
CoUninitialize();
}
+ if (_hwnd != NULL) {
+ DestroyWindow(_hwnd);
+ }
+ UnregisterClass(_wndClass.lpszClassName, _hInstance);
}
int32_t DeviceInfoDS::Init() {
diff --git a/modules/video_capture/windows/device_info_ds.h b/modules/video_capture/windows/device_info_ds.h
index 1b52645cde..dc7b9b1a24 100644
--- a/modules/video_capture/windows/device_info_ds.h
+++ b/modules/video_capture/windows/device_info_ds.h
@@ -93,6 +93,9 @@ class DeviceInfoDS : public DeviceInfoImpl {
IEnumMoniker* _dsMonikerDevEnum;
bool _CoUninitializeIsRequired;
std::vector<VideoCaptureCapabilityWindows> _captureCapabilitiesWindows;
+ HWND _hwnd;
+ WNDCLASS _wndClass;
+ HINSTANCE _hInstance;
};
} // namespace videocapturemodule
} // namespace webrtc

Просмотреть файл

@ -1,93 +1,94 @@
From: Dan Minor <dminor@mozilla.com>
Date: Tue, 17 Sep 2019 06:47:00 +0000
Subject: Bug 1581193 - Fix devicechange event on Windows; r=achronop
From: Alex Chronopoulos <achronop@gmail.com>
Date: Tue, 17 Sep 2019 14:31:00 +0000
Subject: Bug 1581806 - Trigger devicechange event for audio and video input
devices only. r=dminor
This restores the code for generating devicechange events that was
accidentally removed as part of updating the Windows video capture code
in Bug 1552755.
After Bug 1581193 devicechange notifications were triggered with any device change, not just video and audio devices. This patch limits down the notifications to only video and audio input devices change.
Differential Revision: https://phabricator.services.mozilla.com/D46033
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/840c4edafa021eeac6a7e6ae0e828d0adcfea92e
Differential Revision: https://phabricator.services.mozilla.com/D46147
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/1feec83ee6f92a35de0d4b27ebea04e68a0d7ef0
---
.../video_capture/windows/device_info_ds.cc | 39 +++++++++++++++++++
.../video_capture/windows/device_info_ds.h | 3 ++
2 files changed, 42 insertions(+)
.../video_capture/windows/device_info_ds.cc | 29 +++++++++++++++++--
.../video_capture/windows/device_info_ds.h | 1 +
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/modules/video_capture/windows/device_info_ds.cc b/modules/video_capture/windows/device_info_ds.cc
index d0d274cb02..460ef3b7b9 100644
index 460ef3b7b9..a7eca19bbf 100644
--- a/modules/video_capture/windows/device_info_ds.cc
+++ b/modules/video_capture/windows/device_info_ds.cc
@@ -20,6 +20,29 @@
@@ -20,6 +20,18 @@
namespace webrtc {
namespace videocapturemodule {
+LRESULT CALLBACK WndProc(HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
+BOOL isCaptureDevice(DEV_BROADCAST_HDR *pHdr)
+{
+ DeviceInfoDS* pParent;
+ if (uiMsg == WM_CREATE)
+ {
+ pParent = (DeviceInfoDS*)((LPCREATESTRUCT)lParam)->lpCreateParams;
+ SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)pParent);
+ }
+ else if (uiMsg == WM_DESTROY)
+ {
+ SetWindowLongPtr(hWnd, GWLP_USERDATA, NULL);
+ }
+ else if (uiMsg == WM_DEVICECHANGE)
+ {
+ pParent = (DeviceInfoDS*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
+ if (pParent)
+ {
+ pParent->DeviceChange();
+ }
+ }
+ return DefWindowProc(hWnd, uiMsg, wParam, lParam);
+ if (pHdr == NULL) {
+ return FALSE;
+ }
+ if (pHdr->dbch_devicetype != DBT_DEVTYP_DEVICEINTERFACE) {
+ return FALSE;
+ }
+ DEV_BROADCAST_DEVICEINTERFACE* pDi = (DEV_BROADCAST_DEVICEINTERFACE*)pHdr;
+ return pDi->dbcc_classguid == KSCATEGORY_CAPTURE;
+}
+
// static
DeviceInfoDS* DeviceInfoDS::Create() {
DeviceInfoDS* dsInfo = new DeviceInfoDS();
@@ -77,6 +100,18 @@ DeviceInfoDS::DeviceInfoDS()
<< rtc::ToHex(hr);
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
{
DeviceInfoDS* pParent;
@@ -35,7 +47,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
else if (uiMsg == WM_DEVICECHANGE)
{
pParent = (DeviceInfoDS*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
- if (pParent)
+ if (pParent && isCaptureDevice((PDEV_BROADCAST_HDR)lParam))
{
pParent->DeviceChange();
}
@@ -56,7 +68,8 @@ DeviceInfoDS* DeviceInfoDS::Create() {
DeviceInfoDS::DeviceInfoDS()
: _dsDevEnum(NULL),
_dsMonikerDevEnum(NULL),
- _CoUninitializeIsRequired(true) {
+ _CoUninitializeIsRequired(true),
+ _hdevnotify(NULL) {
// 1) Initialize the COM library (make Windows load the DLLs).
//
// CoInitializeEx must be called at least once, and is usually called only
@@ -111,6 +124,14 @@ DeviceInfoDS::DeviceInfoDS()
_hwnd = CreateWindow(_wndClass.lpszClassName, NULL, 0, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL,
NULL, _hInstance, this);
+
+ DEV_BROADCAST_DEVICEINTERFACE di = { 0 };
+ di.dbcc_size = sizeof(di);
+ di.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
+ di.dbcc_classguid = KSCATEGORY_CAPTURE;
+
+ _hdevnotify = RegisterDeviceNotification(_hwnd, &di,
+ DEVICE_NOTIFY_WINDOW_HANDLE);
}
+
+ _hInstance = reinterpret_cast<HINSTANCE>(GetModuleHandle(NULL));
+ _wndClass = {0};
+ _wndClass.lpfnWndProc = &WndProc;
+ _wndClass.lpszClassName = TEXT("DeviceInfoDS");
+ _wndClass.hInstance = _hInstance;
+
+ if (RegisterClass(&_wndClass)) {
+ _hwnd = CreateWindow(_wndClass.lpszClassName, NULL, 0, CW_USEDEFAULT,
+ CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL,
+ NULL, _hInstance, this);
+ }
}
DeviceInfoDS::~DeviceInfoDS() {
@@ -85,6 +120,10 @@ DeviceInfoDS::~DeviceInfoDS() {
@@ -120,6 +141,10 @@ DeviceInfoDS::~DeviceInfoDS() {
if (_CoUninitializeIsRequired) {
CoUninitialize();
}
+ if (_hwnd != NULL) {
+ DestroyWindow(_hwnd);
+ if (_hdevnotify)
+ {
+ UnregisterDeviceNotification(_hdevnotify);
+ }
+ UnregisterClass(_wndClass.lpszClassName, _hInstance);
}
int32_t DeviceInfoDS::Init() {
if (_hwnd != NULL) {
DestroyWindow(_hwnd);
}
diff --git a/modules/video_capture/windows/device_info_ds.h b/modules/video_capture/windows/device_info_ds.h
index 1b52645cde..dc7b9b1a24 100644
index dc7b9b1a24..ed2a726d6f 100644
--- a/modules/video_capture/windows/device_info_ds.h
+++ b/modules/video_capture/windows/device_info_ds.h
@@ -93,6 +93,9 @@ class DeviceInfoDS : public DeviceInfoImpl {
IEnumMoniker* _dsMonikerDevEnum;
bool _CoUninitializeIsRequired;
std::vector<VideoCaptureCapabilityWindows> _captureCapabilitiesWindows;
+ HWND _hwnd;
+ WNDCLASS _wndClass;
+ HINSTANCE _hInstance;
@@ -96,6 +96,7 @@ class DeviceInfoDS : public DeviceInfoImpl {
HWND _hwnd;
WNDCLASS _wndClass;
HINSTANCE _hInstance;
+ HDEVNOTIFY _hdevnotify;
};
} // namespace videocapturemodule
} // namespace webrtc

Просмотреть файл

@ -1,94 +1,95 @@
From: Alex Chronopoulos <achronop@gmail.com>
Date: Tue, 17 Sep 2019 14:31:00 +0000
Subject: Bug 1581806 - Trigger devicechange event for audio and video input
devices only. r=dminor
Date: Wed, 18 Sep 2019 13:16:00 +0000
Subject: Bug 1572281 - Remove audio device change notifications from video
capture in Linux. r=dminor
After Bug 1581193 devicechange notifications were triggered with any device change, not just video and audio devices. This patch limits down the notifications to only video and audio input devices change.
Video capture used to provide device change notifications for audio and video devices. From now on, CubebDeviceEnumerator will provide audio device change notifications thus video capture is updated to notify only changes of the video device. This is the Linux part.
Differential Revision: https://phabricator.services.mozilla.com/D46147
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/1feec83ee6f92a35de0d4b27ebea04e68a0d7ef0
Differential Revision: https://phabricator.services.mozilla.com/D46272
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/7bf7263db30b794139332691f4fbc98b4bfcfdd7
---
.../video_capture/windows/device_info_ds.cc | 29 +++++++++++++++++--
.../video_capture/windows/device_info_ds.h | 1 +
2 files changed, 28 insertions(+), 2 deletions(-)
.../video_capture/linux/device_info_v4l2.cc | 28 ++-----------------
1 file changed, 3 insertions(+), 25 deletions(-)
diff --git a/modules/video_capture/windows/device_info_ds.cc b/modules/video_capture/windows/device_info_ds.cc
index 460ef3b7b9..a7eca19bbf 100644
--- a/modules/video_capture/windows/device_info_ds.cc
+++ b/modules/video_capture/windows/device_info_ds.cc
@@ -20,6 +20,18 @@
namespace webrtc {
namespace videocapturemodule {
+BOOL isCaptureDevice(DEV_BROADCAST_HDR *pHdr)
+{
+ if (pHdr == NULL) {
+ return FALSE;
+ }
+ if (pHdr->dbch_devicetype != DBT_DEVTYP_DEVICEINTERFACE) {
+ return FALSE;
+ }
+ DEV_BROADCAST_DEVICEINTERFACE* pDi = (DEV_BROADCAST_DEVICEINTERFACE*)pHdr;
+ return pDi->dbcc_classguid == KSCATEGORY_CAPTURE;
+}
+
LRESULT CALLBACK WndProc(HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
diff --git a/modules/video_capture/linux/device_info_v4l2.cc b/modules/video_capture/linux/device_info_v4l2.cc
index 19b32f16b9..f77d791033 100644
--- a/modules/video_capture/linux/device_info_v4l2.cc
+++ b/modules/video_capture/linux/device_info_v4l2.cc
@@ -62,7 +62,7 @@ namespace videocapturemodule {
void DeviceInfoV4l2::HandleEvent(inotify_event* event, int fd)
{
DeviceInfoDS* pParent;
@@ -35,7 +47,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
else if (uiMsg == WM_DEVICECHANGE)
{
pParent = (DeviceInfoDS*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
- if (pParent)
+ if (pParent && isCaptureDevice((PDEV_BROADCAST_HDR)lParam))
{
pParent->DeviceChange();
if (event->mask & IN_CREATE) {
- if (fd == _fd_v4l || fd == _fd_snd) {
+ if (fd == _fd_v4l) {
DeviceChange();
} else if ((event->mask & IN_ISDIR) && (fd == _fd_dev)) {
if (_wd_v4l < 0) {
@@ -74,25 +74,15 @@ void DeviceInfoV4l2::HandleEvent(inotify_event* event, int fd)
DeviceChange();
}
}
- if (_wd_snd < 0) {
- usleep(5*1000);
- _wd_snd = inotify_add_watch(_fd_snd, "/dev/snd/by-path/", IN_CREATE | IN_DELETE | IN_DELETE_SELF);
- if (_wd_snd >= 0) {
- DeviceChange();
- }
- }
}
@@ -56,7 +68,8 @@ DeviceInfoDS* DeviceInfoDS::Create() {
DeviceInfoDS::DeviceInfoDS()
: _dsDevEnum(NULL),
_dsMonikerDevEnum(NULL),
- _CoUninitializeIsRequired(true) {
+ _CoUninitializeIsRequired(true),
+ _hdevnotify(NULL) {
// 1) Initialize the COM library (make Windows load the DLLs).
//
// CoInitializeEx must be called at least once, and is usually called only
@@ -111,6 +124,14 @@ DeviceInfoDS::DeviceInfoDS()
_hwnd = CreateWindow(_wndClass.lpszClassName, NULL, 0, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL,
NULL, _hInstance, this);
+
+ DEV_BROADCAST_DEVICEINTERFACE di = { 0 };
+ di.dbcc_size = sizeof(di);
+ di.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
+ di.dbcc_classguid = KSCATEGORY_CAPTURE;
+
+ _hdevnotify = RegisterDeviceNotification(_hwnd, &di,
+ DEVICE_NOTIFY_WINDOW_HANDLE);
}
} else if (event->mask & IN_DELETE) {
- if (fd == _fd_v4l || fd == _fd_snd) {
+ if (fd == _fd_v4l) {
DeviceChange();
}
} else if (event->mask & IN_DELETE_SELF) {
if (fd == _fd_v4l) {
inotify_rm_watch(_fd_v4l, _wd_v4l);
_wd_v4l = -1;
- } else if (fd == _fd_snd) {
- inotify_rm_watch(_fd_snd, _wd_snd);
- _wd_snd = -1;
} else {
assert(false);
}
@@ -159,11 +149,6 @@ int DeviceInfoV4l2::ProcessInotifyEvents()
break;
}
}
- if (EventCheck(_fd_snd) > 0) {
- if (HandleEvents(_fd_snd) < 0) {
- break;
- }
- }
}
return 0;
}
@@ -176,11 +161,9 @@ void DeviceInfoV4l2::InotifyEventThread(void* obj)
void DeviceInfoV4l2::InotifyProcess()
{
_fd_v4l = inotify_init();
- _fd_snd = inotify_init();
_fd_dev = inotify_init();
- if (_fd_v4l >= 0 && _fd_snd >= 0 && _fd_dev >= 0) {
+ if (_fd_v4l >= 0 && _fd_dev >= 0) {
_wd_v4l = inotify_add_watch(_fd_v4l, "/dev/v4l/by-path/", IN_CREATE | IN_DELETE | IN_DELETE_SELF);
- _wd_snd = inotify_add_watch(_fd_snd, "/dev/snd/by-path/", IN_CREATE | IN_DELETE | IN_DELETE_SELF);
_wd_dev = inotify_add_watch(_fd_dev, "/dev/", IN_CREATE);
ProcessInotifyEvents();
@@ -120,6 +141,10 @@ DeviceInfoDS::~DeviceInfoDS() {
if (_CoUninitializeIsRequired) {
CoUninitialize();
}
+ if (_hdevnotify)
+ {
+ UnregisterDeviceNotification(_hdevnotify);
+ }
if (_hwnd != NULL) {
DestroyWindow(_hwnd);
}
diff --git a/modules/video_capture/windows/device_info_ds.h b/modules/video_capture/windows/device_info_ds.h
index dc7b9b1a24..ed2a726d6f 100644
--- a/modules/video_capture/windows/device_info_ds.h
+++ b/modules/video_capture/windows/device_info_ds.h
@@ -96,6 +96,7 @@ class DeviceInfoDS : public DeviceInfoImpl {
HWND _hwnd;
WNDCLASS _wndClass;
HINSTANCE _hInstance;
+ HDEVNOTIFY _hdevnotify;
};
} // namespace videocapturemodule
} // namespace webrtc
@@ -188,16 +171,11 @@ void DeviceInfoV4l2::InotifyProcess()
inotify_rm_watch(_fd_v4l, _wd_v4l);
}
- if (_wd_snd >= 0) {
- inotify_rm_watch(_fd_snd, _wd_snd);
- }
-
if (_wd_dev >= 0) {
inotify_rm_watch(_fd_dev, _wd_dev);
}
close(_fd_v4l);
- close(_fd_snd);
close(_fd_dev);
}
}

Просмотреть файл

@ -1,95 +1,53 @@
From: Alex Chronopoulos <achronop@gmail.com>
Date: Wed, 18 Sep 2019 13:16:00 +0000
Date: Wed, 18 Sep 2019 13:12:00 +0000
Subject: Bug 1572281 - Remove audio device change notifications from video
capture in Linux. r=dminor
capture in Windows. r=dminor
Video capture used to provide device change notifications for audio and video devices. From now on, CubebDeviceEnumerator will provide audio device change notifications thus video capture is updated to notify only changes of the video device. This is the Linux part.
Video capture used to provide device change notifications for audio and video devices. From now on, CubebDeviceEnumerator will provide audio device change notifications thus video capture is updated to notify only changes of the video device. This is the windows part.
Differential Revision: https://phabricator.services.mozilla.com/D46272
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/7bf7263db30b794139332691f4fbc98b4bfcfdd7
Differential Revision: https://phabricator.services.mozilla.com/D46274
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/a5c23245837ebdd99532e8bfaca05774c5c96d9d
---
.../video_capture/linux/device_info_v4l2.cc | 28 ++-----------------
1 file changed, 3 insertions(+), 25 deletions(-)
modules/video_capture/windows/device_info_ds.cc | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/modules/video_capture/linux/device_info_v4l2.cc b/modules/video_capture/linux/device_info_v4l2.cc
index 19b32f16b9..f77d791033 100644
--- a/modules/video_capture/linux/device_info_v4l2.cc
+++ b/modules/video_capture/linux/device_info_v4l2.cc
@@ -62,7 +62,7 @@ namespace videocapturemodule {
void DeviceInfoV4l2::HandleEvent(inotify_event* event, int fd)
diff --git a/modules/video_capture/windows/device_info_ds.cc b/modules/video_capture/windows/device_info_ds.cc
index a7eca19bbf..9d22f42f4d 100644
--- a/modules/video_capture/windows/device_info_ds.cc
+++ b/modules/video_capture/windows/device_info_ds.cc
@@ -20,7 +20,7 @@
namespace webrtc {
namespace videocapturemodule {
-BOOL isCaptureDevice(DEV_BROADCAST_HDR *pHdr)
+BOOL isVideoDevice(DEV_BROADCAST_HDR *pHdr)
{
if (event->mask & IN_CREATE) {
- if (fd == _fd_v4l || fd == _fd_snd) {
+ if (fd == _fd_v4l) {
DeviceChange();
} else if ((event->mask & IN_ISDIR) && (fd == _fd_dev)) {
if (_wd_v4l < 0) {
@@ -74,25 +74,15 @@ void DeviceInfoV4l2::HandleEvent(inotify_event* event, int fd)
DeviceChange();
}
}
- if (_wd_snd < 0) {
- usleep(5*1000);
- _wd_snd = inotify_add_watch(_fd_snd, "/dev/snd/by-path/", IN_CREATE | IN_DELETE | IN_DELETE_SELF);
- if (_wd_snd >= 0) {
- DeviceChange();
- }
- }
}
} else if (event->mask & IN_DELETE) {
- if (fd == _fd_v4l || fd == _fd_snd) {
+ if (fd == _fd_v4l) {
DeviceChange();
}
} else if (event->mask & IN_DELETE_SELF) {
if (fd == _fd_v4l) {
inotify_rm_watch(_fd_v4l, _wd_v4l);
_wd_v4l = -1;
- } else if (fd == _fd_snd) {
- inotify_rm_watch(_fd_snd, _wd_snd);
- _wd_snd = -1;
} else {
assert(false);
}
@@ -159,11 +149,6 @@ int DeviceInfoV4l2::ProcessInotifyEvents()
break;
}
}
- if (EventCheck(_fd_snd) > 0) {
- if (HandleEvents(_fd_snd) < 0) {
- break;
- }
- }
}
return 0;
if (pHdr == NULL) {
return FALSE;
@@ -29,7 +29,7 @@ BOOL isCaptureDevice(DEV_BROADCAST_HDR *pHdr)
return FALSE;
}
DEV_BROADCAST_DEVICEINTERFACE* pDi = (DEV_BROADCAST_DEVICEINTERFACE*)pHdr;
- return pDi->dbcc_classguid == KSCATEGORY_CAPTURE;
+ return pDi->dbcc_classguid == KSCATEGORY_VIDEO_CAMERA;
}
@@ -176,11 +161,9 @@ void DeviceInfoV4l2::InotifyEventThread(void* obj)
void DeviceInfoV4l2::InotifyProcess()
{
_fd_v4l = inotify_init();
- _fd_snd = inotify_init();
_fd_dev = inotify_init();
- if (_fd_v4l >= 0 && _fd_snd >= 0 && _fd_dev >= 0) {
+ if (_fd_v4l >= 0 && _fd_dev >= 0) {
_wd_v4l = inotify_add_watch(_fd_v4l, "/dev/v4l/by-path/", IN_CREATE | IN_DELETE | IN_DELETE_SELF);
- _wd_snd = inotify_add_watch(_fd_snd, "/dev/snd/by-path/", IN_CREATE | IN_DELETE | IN_DELETE_SELF);
_wd_dev = inotify_add_watch(_fd_dev, "/dev/", IN_CREATE);
ProcessInotifyEvents();
@@ -188,16 +171,11 @@ void DeviceInfoV4l2::InotifyProcess()
inotify_rm_watch(_fd_v4l, _wd_v4l);
LRESULT CALLBACK WndProc(HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
@@ -47,7 +47,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
else if (uiMsg == WM_DEVICECHANGE)
{
pParent = (DeviceInfoDS*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
- if (pParent && isCaptureDevice((PDEV_BROADCAST_HDR)lParam))
+ if (pParent && isVideoDevice((PDEV_BROADCAST_HDR)lParam))
{
pParent->DeviceChange();
}
@@ -128,7 +128,7 @@ DeviceInfoDS::DeviceInfoDS()
DEV_BROADCAST_DEVICEINTERFACE di = { 0 };
di.dbcc_size = sizeof(di);
di.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
- di.dbcc_classguid = KSCATEGORY_CAPTURE;
+ di.dbcc_classguid = KSCATEGORY_VIDEO_CAMERA;
- if (_wd_snd >= 0) {
- inotify_rm_watch(_fd_snd, _wd_snd);
- }
-
if (_wd_dev >= 0) {
inotify_rm_watch(_fd_dev, _wd_dev);
}
close(_fd_v4l);
- close(_fd_snd);
close(_fd_dev);
}
}
_hdevnotify = RegisterDeviceNotification(_hwnd, &di,
DEVICE_NOTIFY_WINDOW_HANDLE);

Просмотреть файл

@ -1,53 +1,55 @@
From: Alex Chronopoulos <achronop@gmail.com>
Date: Wed, 18 Sep 2019 13:12:00 +0000
Subject: Bug 1572281 - Remove audio device change notifications from video
capture in Windows. r=dminor
From: Wang Qing <wangqing-hf@loongson.cn>
Date: Wed, 25 Sep 2019 14:15:00 +0000
Subject: Bug 1579834 - [WebRTC] Add mips64 support; r=dminor
Video capture used to provide device change notifications for audio and video devices. From now on, CubebDeviceEnumerator will provide audio device change notifications thus video capture is updated to notify only changes of the video device. This is the windows part.
Differential Revision: https://phabricator.services.mozilla.com/D46274
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/a5c23245837ebdd99532e8bfaca05774c5c96d9d
Differential Revision: https://phabricator.services.mozilla.com/D45620
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/1387b2c480b55ecca3fbdf62bd7649dafc62438d
---
modules/video_capture/windows/device_info_ds.cc | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
modules/video_coding/codecs/vp8/libvpx_vp8_decoder.cc | 2 +-
modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/modules/video_capture/windows/device_info_ds.cc b/modules/video_capture/windows/device_info_ds.cc
index a7eca19bbf..9d22f42f4d 100644
--- a/modules/video_capture/windows/device_info_ds.cc
+++ b/modules/video_capture/windows/device_info_ds.cc
@@ -20,7 +20,7 @@
namespace webrtc {
namespace videocapturemodule {
diff --git a/modules/video_coding/codecs/vp8/libvpx_vp8_decoder.cc b/modules/video_coding/codecs/vp8/libvpx_vp8_decoder.cc
index 01cedb5316..92d123866d 100644
--- a/modules/video_coding/codecs/vp8/libvpx_vp8_decoder.cc
+++ b/modules/video_coding/codecs/vp8/libvpx_vp8_decoder.cc
@@ -46,7 +46,7 @@ const char kVp8PostProcArmFieldTrial[] = "WebRTC-VP8-Postproc-Config-Arm";
const char kVp8PostProcFieldTrial[] = "WebRTC-VP8-Postproc-Config";
-BOOL isCaptureDevice(DEV_BROADCAST_HDR *pHdr)
+BOOL isVideoDevice(DEV_BROADCAST_HDR *pHdr)
{
if (pHdr == NULL) {
return FALSE;
@@ -29,7 +29,7 @@ BOOL isCaptureDevice(DEV_BROADCAST_HDR *pHdr)
return FALSE;
}
DEV_BROADCAST_DEVICEINTERFACE* pDi = (DEV_BROADCAST_DEVICEINTERFACE*)pHdr;
- return pDi->dbcc_classguid == KSCATEGORY_CAPTURE;
+ return pDi->dbcc_classguid == KSCATEGORY_VIDEO_CAMERA;
#if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) || \
- defined(WEBRTC_ANDROID)
+ defined(WEBRTC_ANDROID) || defined(WEBRTC_ARCH_MIPS)
constexpr bool kIsArm = true;
#else
constexpr bool kIsArm = false;
diff --git a/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc b/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc
index 5457402542..bceb321951 100644
--- a/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc
+++ b/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc
@@ -693,7 +693,7 @@ int LibvpxVp8Encoder::InitEncode(const VideoCodec* inst,
int LibvpxVp8Encoder::GetCpuSpeed(int width, int height) {
#if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) || \
- defined(WEBRTC_ANDROID)
+ defined(WEBRTC_ANDROID) || defined(WEBRTC_ARCH_MIPS)
// On mobile platform, use a lower speed setting for lower resolutions for
// CPUs with 4 or more cores.
RTC_DCHECK_GT(number_of_cores_, 0);
@@ -726,7 +726,7 @@ int LibvpxVp8Encoder::GetCpuSpeed(int width, int height) {
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
@@ -47,7 +47,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
else if (uiMsg == WM_DEVICECHANGE)
{
pParent = (DeviceInfoDS*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
- if (pParent && isCaptureDevice((PDEV_BROADCAST_HDR)lParam))
+ if (pParent && isVideoDevice((PDEV_BROADCAST_HDR)lParam))
{
pParent->DeviceChange();
}
@@ -128,7 +128,7 @@ DeviceInfoDS::DeviceInfoDS()
DEV_BROADCAST_DEVICEINTERFACE di = { 0 };
di.dbcc_size = sizeof(di);
di.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
- di.dbcc_classguid = KSCATEGORY_CAPTURE;
+ di.dbcc_classguid = KSCATEGORY_VIDEO_CAMERA;
_hdevnotify = RegisterDeviceNotification(_hwnd, &di,
DEVICE_NOTIFY_WINDOW_HANDLE);
int LibvpxVp8Encoder::NumberOfThreads(int width, int height, int cpus) {
-#if defined(WEBRTC_ANDROID)
+#if defined(WEBRTC_ANDROID) || defined(WEBRTC_ARCH_MIPS)
if (width * height >= 320 * 180) {
if (cpus >= 4) {
// 3 threads for CPUs with 4 and more cores since most of times only 4
@@ -800,7 +800,7 @@ int LibvpxVp8Encoder::InitAndSetControlSettings() {
// multi-res encoding feature?
denoiserState denoiser_state = kDenoiserOnYOnly;
#if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) || \
- defined(WEBRTC_ANDROID)
+ defined(WEBRTC_ANDROID) || defined(WEBRTC_ARCH_MIPS)
denoiser_state = kDenoiserOnYOnly;
#else
denoiser_state = kDenoiserOnAdaptive;

Просмотреть файл

@ -1,55 +1,26 @@
From: Wang Qing <wangqing-hf@loongson.cn>
Date: Wed, 25 Sep 2019 14:15:00 +0000
Subject: Bug 1579834 - [WebRTC] Add mips64 support; r=dminor
From: Dan Minor <dminor@mozilla.com>
Date: Wed, 9 Oct 2019 20:12:00 +0000
Subject: Bug 1587159 - Fix undefined shift in g722_encode.c; r=ng
Differential Revision: https://phabricator.services.mozilla.com/D45620
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/1387b2c480b55ecca3fbdf62bd7649dafc62438d
Left shifting a negative value results in undefined behaviour. It is safer to
multiply in this case.
Differential Revision: https://phabricator.services.mozilla.com/D48751
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/385d660fac359c907986e08d1d89ab5a353f30b2
---
modules/video_coding/codecs/vp8/libvpx_vp8_decoder.cc | 2 +-
modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
modules/third_party/g722/g722_encode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/video_coding/codecs/vp8/libvpx_vp8_decoder.cc b/modules/video_coding/codecs/vp8/libvpx_vp8_decoder.cc
index 01cedb5316..92d123866d 100644
--- a/modules/video_coding/codecs/vp8/libvpx_vp8_decoder.cc
+++ b/modules/video_coding/codecs/vp8/libvpx_vp8_decoder.cc
@@ -46,7 +46,7 @@ const char kVp8PostProcArmFieldTrial[] = "WebRTC-VP8-Postproc-Config-Arm";
const char kVp8PostProcFieldTrial[] = "WebRTC-VP8-Postproc-Config";
diff --git a/modules/third_party/g722/g722_encode.c b/modules/third_party/g722/g722_encode.c
index 10a5bcfe7c..fedf9f5961 100644
--- a/modules/third_party/g722/g722_encode.c
+++ b/modules/third_party/g722/g722_encode.c
@@ -74,7 +74,7 @@ static void block4(G722EncoderState *s, int band, int d)
/* Block 4, UPPOL2 */
for (i = 0; i < 3; i++)
s->band[band].sg[i] = s->band[band].p[i] >> 15;
- wd1 = saturate(s->band[band].a[1] << 2);
+ wd1 = saturate(s->band[band].a[1] * 4);
#if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) || \
- defined(WEBRTC_ANDROID)
+ defined(WEBRTC_ANDROID) || defined(WEBRTC_ARCH_MIPS)
constexpr bool kIsArm = true;
#else
constexpr bool kIsArm = false;
diff --git a/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc b/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc
index 5457402542..bceb321951 100644
--- a/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc
+++ b/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc
@@ -693,7 +693,7 @@ int LibvpxVp8Encoder::InitEncode(const VideoCodec* inst,
int LibvpxVp8Encoder::GetCpuSpeed(int width, int height) {
#if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) || \
- defined(WEBRTC_ANDROID)
+ defined(WEBRTC_ANDROID) || defined(WEBRTC_ARCH_MIPS)
// On mobile platform, use a lower speed setting for lower resolutions for
// CPUs with 4 or more cores.
RTC_DCHECK_GT(number_of_cores_, 0);
@@ -726,7 +726,7 @@ int LibvpxVp8Encoder::GetCpuSpeed(int width, int height) {
}
int LibvpxVp8Encoder::NumberOfThreads(int width, int height, int cpus) {
-#if defined(WEBRTC_ANDROID)
+#if defined(WEBRTC_ANDROID) || defined(WEBRTC_ARCH_MIPS)
if (width * height >= 320 * 180) {
if (cpus >= 4) {
// 3 threads for CPUs with 4 and more cores since most of times only 4
@@ -800,7 +800,7 @@ int LibvpxVp8Encoder::InitAndSetControlSettings() {
// multi-res encoding feature?
denoiserState denoiser_state = kDenoiserOnYOnly;
#if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) || \
- defined(WEBRTC_ANDROID)
+ defined(WEBRTC_ANDROID) || defined(WEBRTC_ARCH_MIPS)
denoiser_state = kDenoiserOnYOnly;
#else
denoiser_state = kDenoiserOnAdaptive;
wd2 = (s->band[band].sg[0] == s->band[band].sg[1]) ? -wd1 : wd1;
if (wd2 > 32767)

Просмотреть файл

@ -1,26 +1,145 @@
From: Dan Minor <dminor@mozilla.com>
Date: Wed, 9 Oct 2019 20:12:00 +0000
Subject: Bug 1587159 - Fix undefined shift in g722_encode.c; r=ng
From: Gabriele Svelto <gsvelto@mozilla.com>
Date: Mon, 28 Oct 2019 23:26:00 +0000
Subject: Bug 1590984 - Use poll() instead of select() in WebRTC code r=drno
Left shifting a negative value results in undefined behaviour. It is safer to
multiply in this case.
The use of select() was leading to crashes when the file descriptor value was
larger than FD_SETSIZE. Recent versions of glibc have checks in the FD_CLR(),
FD_SET() and FD_ISSET() macros that will abort() the program instead of doing
an out-of-bounds access. poll() doesn't have limitations on the file
descriptor values and provides behavior that is otherwise identical to
select() thus solving the problem.
Differential Revision: https://phabricator.services.mozilla.com/D48751
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/385d660fac359c907986e08d1d89ab5a353f30b2
Differential Revision: https://phabricator.services.mozilla.com/D50798
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/59fb6760bb6785a6f8a51be6fc66bf04cfba3e16
---
modules/third_party/g722/g722_encode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
.../video_capture/linux/device_info_linux.cc | 1 +
.../video_capture/linux/device_info_v4l2.cc | 16 +++++-----
.../linux/video_capture_linux.cc | 1 +
.../video_capture/linux/video_capture_v4l2.cc | 29 +++++++++++--------
4 files changed, 26 insertions(+), 21 deletions(-)
diff --git a/modules/third_party/g722/g722_encode.c b/modules/third_party/g722/g722_encode.c
index 10a5bcfe7c..fedf9f5961 100644
--- a/modules/third_party/g722/g722_encode.c
+++ b/modules/third_party/g722/g722_encode.c
@@ -74,7 +74,7 @@ static void block4(G722EncoderState *s, int band, int d)
/* Block 4, UPPOL2 */
for (i = 0; i < 3; i++)
s->band[band].sg[i] = s->band[band].p[i] >> 15;
- wd1 = saturate(s->band[band].a[1] << 2);
+ wd1 = saturate(s->band[band].a[1] * 4);
diff --git a/modules/video_capture/linux/device_info_linux.cc b/modules/video_capture/linux/device_info_linux.cc
index 56da475bf3..cae63c7c2d 100644
--- a/modules/video_capture/linux/device_info_linux.cc
+++ b/modules/video_capture/linux/device_info_linux.cc
@@ -10,6 +10,7 @@
wd2 = (s->band[band].sg[0] == s->band[band].sg[1]) ? -wd1 : wd1;
if (wd2 > 32767)
#include <errno.h>
#include <fcntl.h>
+#include <poll.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/modules/video_capture/linux/device_info_v4l2.cc b/modules/video_capture/linux/device_info_v4l2.cc
index f77d791033..a2435bcd4f 100644
--- a/modules/video_capture/linux/device_info_v4l2.cc
+++ b/modules/video_capture/linux/device_info_v4l2.cc
@@ -12,6 +12,7 @@
#include <errno.h>
#include <fcntl.h>
+#include <poll.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -91,16 +92,13 @@ void DeviceInfoV4l2::HandleEvent(inotify_event* event, int fd)
int DeviceInfoV4l2::EventCheck(int fd)
{
- struct timeval timeout;
- fd_set rfds;
+ struct pollfd fds = {
+ .fd = fd,
+ .events = POLLIN,
+ .revents = 0
+ };
- timeout.tv_sec = 0;
- timeout.tv_usec = 100000;
-
- FD_ZERO(&rfds);
- FD_SET(fd, &rfds);
-
- return select(fd+1, &rfds, NULL, NULL, &timeout);
+ return poll(&fds, 1, 100);
}
int DeviceInfoV4l2::HandleEvents(int fd)
diff --git a/modules/video_capture/linux/video_capture_linux.cc b/modules/video_capture/linux/video_capture_linux.cc
index 23a8f4f3f3..b2c206d775 100644
--- a/modules/video_capture/linux/video_capture_linux.cc
+++ b/modules/video_capture/linux/video_capture_linux.cc
@@ -10,6 +10,7 @@
#include <errno.h>
#include <fcntl.h>
+#include <poll.h>
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
diff --git a/modules/video_capture/linux/video_capture_v4l2.cc b/modules/video_capture/linux/video_capture_v4l2.cc
index 7a70c2ff88..00cede01cb 100644
--- a/modules/video_capture/linux/video_capture_v4l2.cc
+++ b/modules/video_capture/linux/video_capture_v4l2.cc
@@ -12,7 +12,7 @@
#include <errno.h>
#include <fcntl.h>
-#include <linux/videodev2.h>
+#include <poll.h>
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
@@ -20,6 +20,14 @@
#include <sys/select.h>
#include <time.h>
#include <unistd.h>
+// v4l includes
+#if defined(__NetBSD__) || defined(__OpenBSD__) // WEBRTC_BSD
+#include <sys/videoio.h>
+#elif defined(__sun)
+#include <sys/videodev2.h>
+#else
+#include <linux/videodev2.h>
+#endif
#include <new>
#include <string>
@@ -405,16 +413,13 @@ bool VideoCaptureModuleV4L2::CaptureProcess() {
RTC_CHECK_RUNS_SERIALIZED(&capture_checker_);
int retVal = 0;
- fd_set rSet;
- struct timeval timeout;
+ struct pollfd rSet;
- FD_ZERO(&rSet);
- FD_SET(_deviceFd, &rSet);
- timeout.tv_sec = 1;
- timeout.tv_usec = 0;
+ rSet.fd = _deviceFd;
+ rSet.events = POLLIN;
+ rSet.revents = 0;
- // _deviceFd written only in StartCapture, when this thread isn't running.
- retVal = select(_deviceFd + 1, &rSet, NULL, NULL, &timeout);
+ retVal = poll(&rSet, 1, 1000);
{
MutexLock lock(&capture_lock_);
@@ -424,12 +429,12 @@ bool VideoCaptureModuleV4L2::CaptureProcess() {
}
if (retVal < 0 && errno != EINTR) { // continue if interrupted
- // select failed
+ // poll failed
return false;
} else if (retVal == 0) {
- // select timed out
+ // poll timed out
return true;
- } else if (!FD_ISSET(_deviceFd, &rSet)) {
+ } else if (!(rSet.revents & POLLIN)) {
// not event on camera handle
return true;
}

Просмотреть файл

@ -1,145 +1,25 @@
From: Gabriele Svelto <gsvelto@mozilla.com>
Date: Mon, 28 Oct 2019 23:26:00 +0000
Subject: Bug 1590984 - Use poll() instead of select() in WebRTC code r=drno
From: Dan Minor <dminor@mozilla.com>
Date: Tue, 11 Feb 2020 17:04:00 +0000
Subject: Bug 1578073 - Fix warning: [cast] redundant cast to int; r=ng
The use of select() was leading to crashes when the file descriptor value was
larger than FD_SETSIZE. Recent versions of glibc have checks in the FD_CLR(),
FD_SET() and FD_ISSET() macros that will abort() the program instead of doing
an out-of-bounds access. poll() doesn't have limitations on the file
descriptor values and provides behavior that is otherwise identical to
select() thus solving the problem.
Differential Revision: https://phabricator.services.mozilla.com/D50798
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/59fb6760bb6785a6f8a51be6fc66bf04cfba3e16
Differential Revision: https://phabricator.services.mozilla.com/D61852
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/82877c8a864072c03f45234c6649645ed609e098
---
.../video_capture/linux/device_info_linux.cc | 1 +
.../video_capture/linux/device_info_v4l2.cc | 16 +++++-----
.../linux/video_capture_linux.cc | 1 +
.../video_capture/linux/video_capture_v4l2.cc | 29 +++++++++++--------
4 files changed, 26 insertions(+), 21 deletions(-)
sdk/android/api/org/webrtc/TextureBufferImpl.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules/video_capture/linux/device_info_linux.cc b/modules/video_capture/linux/device_info_linux.cc
index 56da475bf3..cae63c7c2d 100644
--- a/modules/video_capture/linux/device_info_linux.cc
+++ b/modules/video_capture/linux/device_info_linux.cc
@@ -10,6 +10,7 @@
diff --git a/sdk/android/api/org/webrtc/TextureBufferImpl.java b/sdk/android/api/org/webrtc/TextureBufferImpl.java
index 7e2bed84fc..43470d6e39 100644
--- a/sdk/android/api/org/webrtc/TextureBufferImpl.java
+++ b/sdk/android/api/org/webrtc/TextureBufferImpl.java
@@ -136,8 +136,8 @@ public class TextureBufferImpl implements VideoFrame.TextureBuffer {
cropAndScaleMatrix.preScale(cropWidth / (float) width, cropHeight / (float) height);
#include <errno.h>
#include <fcntl.h>
+#include <poll.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/modules/video_capture/linux/device_info_v4l2.cc b/modules/video_capture/linux/device_info_v4l2.cc
index f77d791033..a2435bcd4f 100644
--- a/modules/video_capture/linux/device_info_v4l2.cc
+++ b/modules/video_capture/linux/device_info_v4l2.cc
@@ -12,6 +12,7 @@
return applyTransformMatrix(cropAndScaleMatrix,
- (int) Math.round(unscaledWidth * cropWidth / (float) width),
- (int) Math.round(unscaledHeight * cropHeight / (float) height), scaleWidth, scaleHeight);
+ Math.round(unscaledWidth * cropWidth / (float) width),
+ Math.round(unscaledHeight * cropHeight / (float) height), scaleWidth, scaleHeight);
}
#include <errno.h>
#include <fcntl.h>
+#include <poll.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -91,16 +92,13 @@ void DeviceInfoV4l2::HandleEvent(inotify_event* event, int fd)
int DeviceInfoV4l2::EventCheck(int fd)
{
- struct timeval timeout;
- fd_set rfds;
+ struct pollfd fds = {
+ .fd = fd,
+ .events = POLLIN,
+ .revents = 0
+ };
- timeout.tv_sec = 0;
- timeout.tv_usec = 100000;
-
- FD_ZERO(&rfds);
- FD_SET(fd, &rfds);
-
- return select(fd+1, &rfds, NULL, NULL, &timeout);
+ return poll(&fds, 1, 100);
}
int DeviceInfoV4l2::HandleEvents(int fd)
diff --git a/modules/video_capture/linux/video_capture_linux.cc b/modules/video_capture/linux/video_capture_linux.cc
index 23a8f4f3f3..b2c206d775 100644
--- a/modules/video_capture/linux/video_capture_linux.cc
+++ b/modules/video_capture/linux/video_capture_linux.cc
@@ -10,6 +10,7 @@
#include <errno.h>
#include <fcntl.h>
+#include <poll.h>
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
diff --git a/modules/video_capture/linux/video_capture_v4l2.cc b/modules/video_capture/linux/video_capture_v4l2.cc
index 7a70c2ff88..00cede01cb 100644
--- a/modules/video_capture/linux/video_capture_v4l2.cc
+++ b/modules/video_capture/linux/video_capture_v4l2.cc
@@ -12,7 +12,7 @@
#include <errno.h>
#include <fcntl.h>
-#include <linux/videodev2.h>
+#include <poll.h>
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
@@ -20,6 +20,14 @@
#include <sys/select.h>
#include <time.h>
#include <unistd.h>
+// v4l includes
+#if defined(__NetBSD__) || defined(__OpenBSD__) // WEBRTC_BSD
+#include <sys/videoio.h>
+#elif defined(__sun)
+#include <sys/videodev2.h>
+#else
+#include <linux/videodev2.h>
+#endif
#include <new>
#include <string>
@@ -405,16 +413,13 @@ bool VideoCaptureModuleV4L2::CaptureProcess() {
RTC_CHECK_RUNS_SERIALIZED(&capture_checker_);
int retVal = 0;
- fd_set rSet;
- struct timeval timeout;
+ struct pollfd rSet;
- FD_ZERO(&rSet);
- FD_SET(_deviceFd, &rSet);
- timeout.tv_sec = 1;
- timeout.tv_usec = 0;
+ rSet.fd = _deviceFd;
+ rSet.events = POLLIN;
+ rSet.revents = 0;
- // _deviceFd written only in StartCapture, when this thread isn't running.
- retVal = select(_deviceFd + 1, &rSet, NULL, NULL, &timeout);
+ retVal = poll(&rSet, 1, 1000);
{
MutexLock lock(&capture_lock_);
@@ -424,12 +429,12 @@ bool VideoCaptureModuleV4L2::CaptureProcess() {
}
if (retVal < 0 && errno != EINTR) { // continue if interrupted
- // select failed
+ // poll failed
return false;
} else if (retVal == 0) {
- // select timed out
+ // poll timed out
return true;
- } else if (!FD_ISSET(_deviceFd, &rSet)) {
+ } else if (!(rSet.revents & POLLIN)) {
// not event on camera handle
return true;
}
@Override

Просмотреть файл

@ -1,25 +1,40 @@
From: Dan Minor <dminor@mozilla.com>
Date: Tue, 11 Feb 2020 17:04:00 +0000
Subject: Bug 1578073 - Fix warning: [cast] redundant cast to int; r=ng
Date: Tue, 11 Feb 2020 17:07:00 +0000
Subject: Bug 1578073 - Remove native calls in Histogram.java; r=ng
Differential Revision: https://phabricator.services.mozilla.com/D61852
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/82877c8a864072c03f45234c6649645ed609e098
Getting the JNI calls here to work requires a good amount of webrtc.org
machinery. It might be worth setting that up the next time we do an upstream
merge, but for now, it is a lot simpler to just remove the affected code,
given that we are not interested in collecting this data anyway.
Differential Revision: https://phabricator.services.mozilla.com/D61860
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/7a9b07dec9f9d435416b06829fa5063aca3a476e
---
sdk/android/api/org/webrtc/TextureBufferImpl.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
sdk/android/src/java/org/webrtc/Histogram.java | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/sdk/android/api/org/webrtc/TextureBufferImpl.java b/sdk/android/api/org/webrtc/TextureBufferImpl.java
index 7e2bed84fc..43470d6e39 100644
--- a/sdk/android/api/org/webrtc/TextureBufferImpl.java
+++ b/sdk/android/api/org/webrtc/TextureBufferImpl.java
@@ -136,8 +136,8 @@ public class TextureBufferImpl implements VideoFrame.TextureBuffer {
cropAndScaleMatrix.preScale(cropWidth / (float) width, cropHeight / (float) height);
return applyTransformMatrix(cropAndScaleMatrix,
- (int) Math.round(unscaledWidth * cropWidth / (float) width),
- (int) Math.round(unscaledHeight * cropHeight / (float) height), scaleWidth, scaleHeight);
+ Math.round(unscaledWidth * cropWidth / (float) width),
+ Math.round(unscaledHeight * cropHeight / (float) height), scaleWidth, scaleHeight);
diff --git a/sdk/android/src/java/org/webrtc/Histogram.java b/sdk/android/src/java/org/webrtc/Histogram.java
index 877986134a..c1d2d61a71 100644
--- a/sdk/android/src/java/org/webrtc/Histogram.java
+++ b/sdk/android/src/java/org/webrtc/Histogram.java
@@ -27,18 +27,13 @@ class Histogram {
}
@Override
static public Histogram createCounts(String name, int min, int max, int bucketCount) {
- return new Histogram(nativeCreateCounts(name, min, max, bucketCount));
+ return new Histogram(0);
}
static public Histogram createEnumeration(String name, int max) {
- return new Histogram(nativeCreateEnumeration(name, max));
+ return new Histogram(0);
}
public void addSample(int sample) {
- nativeAddSample(handle, sample);
}
-
- private static native long nativeCreateCounts(String name, int min, int max, int bucketCount);
- private static native long nativeCreateEnumeration(String name, int max);
- private static native void nativeAddSample(long handle, int sample);
}

Просмотреть файл

@ -1,40 +1,33 @@
From: Dan Minor <dminor@mozilla.com>
Date: Tue, 11 Feb 2020 17:07:00 +0000
Subject: Bug 1578073 - Remove native calls in Histogram.java; r=ng
Date: Wed, 12 Feb 2020 17:19:00 +0000
Subject: Bug 1578073 - Suppress MissingPermission lint in Camera2Session;
r=snorp
Getting the JNI calls here to work requires a good amount of webrtc.org
machinery. It might be worth setting that up the next time we do an upstream
merge, but for now, it is a lot simpler to just remove the affected code,
given that we are not interested in collecting this data anyway.
Depends on D61861
Differential Revision: https://phabricator.services.mozilla.com/D61860
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/7a9b07dec9f9d435416b06829fa5063aca3a476e
Differential Revision: https://phabricator.services.mozilla.com/D62457
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/722c4a6d1dad867f9ce47fe96d71b5dedb4cbaa8
---
sdk/android/src/java/org/webrtc/Histogram.java | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
sdk/android/src/java/org/webrtc/Camera2Session.java | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sdk/android/src/java/org/webrtc/Histogram.java b/sdk/android/src/java/org/webrtc/Histogram.java
index 877986134a..c1d2d61a71 100644
--- a/sdk/android/src/java/org/webrtc/Histogram.java
+++ b/sdk/android/src/java/org/webrtc/Histogram.java
@@ -27,18 +27,13 @@ class Histogram {
diff --git a/sdk/android/src/java/org/webrtc/Camera2Session.java b/sdk/android/src/java/org/webrtc/Camera2Session.java
index dec97a2c25..d5ee80c73e 100644
--- a/sdk/android/src/java/org/webrtc/Camera2Session.java
+++ b/sdk/android/src/java/org/webrtc/Camera2Session.java
@@ -10,6 +10,7 @@
package org.webrtc;
+import android.annotation.SuppressLint;
import android.content.Context;
import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraCaptureSession;
@@ -347,6 +348,7 @@ class Camera2Session implements CameraSession {
Logging.d(TAG, "Using capture format: " + captureFormat);
}
static public Histogram createCounts(String name, int min, int max, int bucketCount) {
- return new Histogram(nativeCreateCounts(name, min, max, bucketCount));
+ return new Histogram(0);
}
+ @SuppressLint("MissingPermission")
private void openCamera() {
checkIsOnCameraThread();
static public Histogram createEnumeration(String name, int max) {
- return new Histogram(nativeCreateEnumeration(name, max));
+ return new Histogram(0);
}
public void addSample(int sample) {
- nativeAddSample(handle, sample);
}
-
- private static native long nativeCreateCounts(String name, int min, int max, int bucketCount);
- private static native long nativeCreateEnumeration(String name, int max);
- private static native void nativeAddSample(long handle, int sample);
}

Просмотреть файл

@ -1,33 +1,87 @@
From: Dan Minor <dminor@mozilla.com>
Date: Wed, 12 Feb 2020 17:19:00 +0000
Subject: Bug 1578073 - Suppress MissingPermission lint in Camera2Session;
r=snorp
Date: Wed, 8 Jul 2020 17:35:00 +0000
Subject: Bug 1650572 - Check V4L2_CAP_DEVICE_CAPS before accessing
device_caps; r=ng
Depends on D61861
The capabilities field is for the physical device, device_caps is for the
specific /dev/videoX device that has been opened. The device_caps field is
only populated if V4L2_CAP_DEVICE_CAPS is set, so we should check that, and
fall back to capabilities if it is not set.
Differential Revision: https://phabricator.services.mozilla.com/D62457
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/722c4a6d1dad867f9ce47fe96d71b5dedb4cbaa8
Differential Revision: https://phabricator.services.mozilla.com/D82377
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/b5acbf536c46a66c939a61bde34ad93b1977a604
---
sdk/android/src/java/org/webrtc/Camera2Session.java | 2 ++
1 file changed, 2 insertions(+)
modules/video_capture/linux/device_info_v4l2.cc | 17 ++++++++++++-----
modules/video_capture/linux/device_info_v4l2.h | 3 +++
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/sdk/android/src/java/org/webrtc/Camera2Session.java b/sdk/android/src/java/org/webrtc/Camera2Session.java
index dec97a2c25..d5ee80c73e 100644
--- a/sdk/android/src/java/org/webrtc/Camera2Session.java
+++ b/sdk/android/src/java/org/webrtc/Camera2Session.java
@@ -10,6 +10,7 @@
diff --git a/modules/video_capture/linux/device_info_v4l2.cc b/modules/video_capture/linux/device_info_v4l2.cc
index a2435bcd4f..cd0ba6e3df 100644
--- a/modules/video_capture/linux/device_info_v4l2.cc
+++ b/modules/video_capture/linux/device_info_v4l2.cc
@@ -220,8 +220,7 @@ uint32_t DeviceInfoV4l2::NumberOfDevices() {
snprintf(device, sizeof(device), "/dev/video%d", n);
if ((fd = open(device, O_RDONLY)) != -1) {
// query device capabilities and make sure this is a video capture device
- if (ioctl(fd, VIDIOC_QUERYCAP, &cap) < 0 ||
- !(cap.device_caps & V4L2_CAP_VIDEO_CAPTURE)) {
+ if (ioctl(fd, VIDIOC_QUERYCAP, &cap) < 0 || !IsVideoCaptureDevice(&cap)) {
close(fd);
continue;
}
@@ -252,8 +251,7 @@ int32_t DeviceInfoV4l2::GetDeviceName(uint32_t deviceNumber,
snprintf(device, sizeof(device), "/dev/video%d", n);
if ((fd = open(device, O_RDONLY)) != -1) {
// query device capabilities and make sure this is a video capture device
- if (ioctl(fd, VIDIOC_QUERYCAP, &cap) < 0 ||
- !(cap.device_caps & V4L2_CAP_VIDEO_CAPTURE)) {
+ if (ioctl(fd, VIDIOC_QUERYCAP, &cap) < 0 || !IsVideoCaptureDevice(&cap)) {
close(fd);
continue;
}
@@ -331,7 +329,7 @@ int32_t DeviceInfoV4l2::CreateCapabilityMap(const char* deviceUniqueIdUTF8) {
struct v4l2_capability cap;
if (ioctl(fd, VIDIOC_QUERYCAP, &cap) == 0) {
// skip devices without video capture capability
- if (!(cap.device_caps & V4L2_CAP_VIDEO_CAPTURE)) {
+ if (!IsVideoCaptureDevice(&cap)) {
continue;
}
package org.webrtc;
@@ -393,6 +391,15 @@ bool DeviceInfoV4l2::IsDeviceNameMatches(const char* name,
return false;
}
+import android.annotation.SuppressLint;
import android.content.Context;
import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraCaptureSession;
@@ -347,6 +348,7 @@ class Camera2Session implements CameraSession {
Logging.d(TAG, "Using capture format: " + captureFormat);
}
+bool DeviceInfoV4l2::IsVideoCaptureDevice(struct v4l2_capability* cap)
+{
+ if (cap->capabilities & V4L2_CAP_DEVICE_CAPS) {
+ return cap->device_caps & V4L2_CAP_VIDEO_CAPTURE;
+ } else {
+ return cap->capabilities & V4L2_CAP_VIDEO_CAPTURE;
+ }
+}
+
int32_t DeviceInfoV4l2::FillCapabilities(int fd) {
// set image format
struct v4l2_format video_fmt;
diff --git a/modules/video_capture/linux/device_info_v4l2.h b/modules/video_capture/linux/device_info_v4l2.h
index 95432a509d..e3c2395f49 100644
--- a/modules/video_capture/linux/device_info_v4l2.h
+++ b/modules/video_capture/linux/device_info_v4l2.h
@@ -18,6 +18,8 @@
#include "rtc_base/platform_thread.h"
#include <sys/inotify.h>
+ @SuppressLint("MissingPermission")
private void openCamera() {
checkIsOnCameraThread();
+struct v4l2_capability;
+
namespace webrtc {
namespace videocapturemodule {
class DeviceInfoV4l2 : public DeviceInfoImpl {
@@ -49,6 +51,7 @@ class DeviceInfoV4l2 : public DeviceInfoImpl {
private:
bool IsDeviceNameMatches(const char* name, const char* deviceUniqueIdUTF8);
+ bool IsVideoCaptureDevice(struct v4l2_capability* cap);
#ifdef WEBRTC_LINUX
void HandleEvent(inotify_event* event, int fd);

Просмотреть файл

@ -1,87 +1,64 @@
From: Dan Minor <dminor@mozilla.com>
Date: Wed, 8 Jul 2020 17:35:00 +0000
Subject: Bug 1650572 - Check V4L2_CAP_DEVICE_CAPS before accessing
device_caps; r=ng
From: Paul Adenot <paul@paul.cx>
Date: Wed, 4 Nov 2020 13:03:00 +0000
Subject: Bug 1675042 - Put IR camera last in the device selection list, so
that they are never the default. r=dminor
The capabilities field is for the physical device, device_caps is for the
specific /dev/videoX device that has been opened. The device_caps field is
only populated if V4L2_CAP_DEVICE_CAPS is set, so we should check that, and
fall back to capabilities if it is not set.
Differential Revision: https://phabricator.services.mozilla.com/D82377
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/b5acbf536c46a66c939a61bde34ad93b1977a604
Differential Revision: https://phabricator.services.mozilla.com/D95764
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/754900ff2a2b1c32878baf3c76d7c0e8219419ff
---
modules/video_capture/linux/device_info_v4l2.cc | 17 ++++++++++++-----
modules/video_capture/linux/device_info_v4l2.h | 3 +++
2 files changed, 15 insertions(+), 5 deletions(-)
sdk/android/api/org/webrtc/Camera1Enumerator.java | 5 +++++
sdk/android/api/org/webrtc/Camera2Enumerator.java | 12 ++++++++++++
sdk/android/api/org/webrtc/CameraEnumerator.java | 1 +
3 files changed, 18 insertions(+)
diff --git a/modules/video_capture/linux/device_info_v4l2.cc b/modules/video_capture/linux/device_info_v4l2.cc
index a2435bcd4f..cd0ba6e3df 100644
--- a/modules/video_capture/linux/device_info_v4l2.cc
+++ b/modules/video_capture/linux/device_info_v4l2.cc
@@ -220,8 +220,7 @@ uint32_t DeviceInfoV4l2::NumberOfDevices() {
snprintf(device, sizeof(device), "/dev/video%d", n);
if ((fd = open(device, O_RDONLY)) != -1) {
// query device capabilities and make sure this is a video capture device
- if (ioctl(fd, VIDIOC_QUERYCAP, &cap) < 0 ||
- !(cap.device_caps & V4L2_CAP_VIDEO_CAPTURE)) {
+ if (ioctl(fd, VIDIOC_QUERYCAP, &cap) < 0 || !IsVideoCaptureDevice(&cap)) {
close(fd);
continue;
}
@@ -252,8 +251,7 @@ int32_t DeviceInfoV4l2::GetDeviceName(uint32_t deviceNumber,
snprintf(device, sizeof(device), "/dev/video%d", n);
if ((fd = open(device, O_RDONLY)) != -1) {
// query device capabilities and make sure this is a video capture device
- if (ioctl(fd, VIDIOC_QUERYCAP, &cap) < 0 ||
- !(cap.device_caps & V4L2_CAP_VIDEO_CAPTURE)) {
+ if (ioctl(fd, VIDIOC_QUERYCAP, &cap) < 0 || !IsVideoCaptureDevice(&cap)) {
close(fd);
continue;
}
@@ -331,7 +329,7 @@ int32_t DeviceInfoV4l2::CreateCapabilityMap(const char* deviceUniqueIdUTF8) {
struct v4l2_capability cap;
if (ioctl(fd, VIDIOC_QUERYCAP, &cap) == 0) {
// skip devices without video capture capability
- if (!(cap.device_caps & V4L2_CAP_VIDEO_CAPTURE)) {
+ if (!IsVideoCaptureDevice(&cap)) {
continue;
}
diff --git a/sdk/android/api/org/webrtc/Camera1Enumerator.java b/sdk/android/api/org/webrtc/Camera1Enumerator.java
index fb1a21f323..4a1aacdb05 100644
--- a/sdk/android/api/org/webrtc/Camera1Enumerator.java
+++ b/sdk/android/api/org/webrtc/Camera1Enumerator.java
@@ -63,6 +63,11 @@ public class Camera1Enumerator implements CameraEnumerator {
return info != null && info.facing == android.hardware.Camera.CameraInfo.CAMERA_FACING_BACK;
}
@@ -393,6 +391,15 @@ bool DeviceInfoV4l2::IsDeviceNameMatches(const char* name,
return false;
}
+bool DeviceInfoV4l2::IsVideoCaptureDevice(struct v4l2_capability* cap)
+{
+ if (cap->capabilities & V4L2_CAP_DEVICE_CAPS) {
+ return cap->device_caps & V4L2_CAP_VIDEO_CAPTURE;
+ } else {
+ return cap->capabilities & V4L2_CAP_VIDEO_CAPTURE;
+ @Override
+ public boolean isInfrared(String deviceName) {
+ return false;
+ }
+}
+
int32_t DeviceInfoV4l2::FillCapabilities(int fd) {
// set image format
struct v4l2_format video_fmt;
diff --git a/modules/video_capture/linux/device_info_v4l2.h b/modules/video_capture/linux/device_info_v4l2.h
index 95432a509d..e3c2395f49 100644
--- a/modules/video_capture/linux/device_info_v4l2.h
+++ b/modules/video_capture/linux/device_info_v4l2.h
@@ -18,6 +18,8 @@
#include "rtc_base/platform_thread.h"
#include <sys/inotify.h>
@Override
public List<CaptureFormat> getSupportedFormats(String deviceName) {
return getSupportedFormats(getCameraIndex(deviceName));
diff --git a/sdk/android/api/org/webrtc/Camera2Enumerator.java b/sdk/android/api/org/webrtc/Camera2Enumerator.java
index 456d8cd060..44e239ad8e 100644
--- a/sdk/android/api/org/webrtc/Camera2Enumerator.java
+++ b/sdk/android/api/org/webrtc/Camera2Enumerator.java
@@ -74,6 +74,18 @@ public class Camera2Enumerator implements CameraEnumerator {
== CameraMetadata.LENS_FACING_BACK;
}
+struct v4l2_capability;
+ @Override
+ public boolean isInfrared(String deviceName) {
+ CameraCharacteristics characteristics = getCameraCharacteristics(deviceName);
+
namespace webrtc {
namespace videocapturemodule {
class DeviceInfoV4l2 : public DeviceInfoImpl {
@@ -49,6 +51,7 @@ class DeviceInfoV4l2 : public DeviceInfoImpl {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
+ Integer colors = characteristics.get(CameraCharacteristics.SENSOR_INFO_COLOR_FILTER_ARRANGEMENT);
+ return colors != null && colors.equals(CameraCharacteristics.SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_NIR);
+ }
+
+ return false;
+ }
+
@Nullable
@Override
public List<CaptureFormat> getSupportedFormats(String deviceName) {
diff --git a/sdk/android/api/org/webrtc/CameraEnumerator.java b/sdk/android/api/org/webrtc/CameraEnumerator.java
index dc954b62e0..db34d542c8 100644
--- a/sdk/android/api/org/webrtc/CameraEnumerator.java
+++ b/sdk/android/api/org/webrtc/CameraEnumerator.java
@@ -18,6 +18,7 @@ public interface CameraEnumerator {
public String[] getDeviceNames();
public boolean isFrontFacing(String deviceName);
public boolean isBackFacing(String deviceName);
+ public boolean isInfrared(String deviceName);
public List<CaptureFormat> getSupportedFormats(String deviceName);
private:
bool IsDeviceNameMatches(const char* name, const char* deviceUniqueIdUTF8);
+ bool IsVideoCaptureDevice(struct v4l2_capability* cap);
#ifdef WEBRTC_LINUX
void HandleEvent(inotify_event* event, int fd);
public CameraVideoCapturer createCapturer(

Просмотреть файл

@ -1,64 +1,22 @@
From: Paul Adenot <paul@paul.cx>
Date: Wed, 4 Nov 2020 13:03:00 +0000
Subject: Bug 1675042 - Put IR camera last in the device selection list, so
that they are never the default. r=dminor
From: Jan-Ivar Bruaroey <jib@mozilla.com>
Date: Fri, 18 Aug 2023 13:26:37 -0500
Subject: Bug 1701809: Close dev/video* driver file descriptors after camera
access on linux. r=ng
Differential Revision: https://phabricator.services.mozilla.com/D95764
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/754900ff2a2b1c32878baf3c76d7c0e8219419ff
Differential Revision: https://phabricator.services.mozilla.com/D110589
---
sdk/android/api/org/webrtc/Camera1Enumerator.java | 5 +++++
sdk/android/api/org/webrtc/Camera2Enumerator.java | 12 ++++++++++++
sdk/android/api/org/webrtc/CameraEnumerator.java | 1 +
3 files changed, 18 insertions(+)
modules/video_capture/linux/device_info_v4l2.cc | 1 +
1 file changed, 1 insertion(+)
diff --git a/sdk/android/api/org/webrtc/Camera1Enumerator.java b/sdk/android/api/org/webrtc/Camera1Enumerator.java
index fb1a21f323..4a1aacdb05 100644
--- a/sdk/android/api/org/webrtc/Camera1Enumerator.java
+++ b/sdk/android/api/org/webrtc/Camera1Enumerator.java
@@ -63,6 +63,11 @@ public class Camera1Enumerator implements CameraEnumerator {
return info != null && info.facing == android.hardware.Camera.CameraInfo.CAMERA_FACING_BACK;
}
diff --git a/modules/video_capture/linux/device_info_v4l2.cc b/modules/video_capture/linux/device_info_v4l2.cc
index cd0ba6e3df..c5d33ff9a4 100644
--- a/modules/video_capture/linux/device_info_v4l2.cc
+++ b/modules/video_capture/linux/device_info_v4l2.cc
@@ -330,6 +330,7 @@ int32_t DeviceInfoV4l2::CreateCapabilityMap(const char* deviceUniqueIdUTF8) {
if (ioctl(fd, VIDIOC_QUERYCAP, &cap) == 0) {
// skip devices without video capture capability
if (!IsVideoCaptureDevice(&cap)) {
+ close(fd);
continue;
}
+ @Override
+ public boolean isInfrared(String deviceName) {
+ return false;
+ }
+
@Override
public List<CaptureFormat> getSupportedFormats(String deviceName) {
return getSupportedFormats(getCameraIndex(deviceName));
diff --git a/sdk/android/api/org/webrtc/Camera2Enumerator.java b/sdk/android/api/org/webrtc/Camera2Enumerator.java
index 456d8cd060..44e239ad8e 100644
--- a/sdk/android/api/org/webrtc/Camera2Enumerator.java
+++ b/sdk/android/api/org/webrtc/Camera2Enumerator.java
@@ -74,6 +74,18 @@ public class Camera2Enumerator implements CameraEnumerator {
== CameraMetadata.LENS_FACING_BACK;
}
+ @Override
+ public boolean isInfrared(String deviceName) {
+ CameraCharacteristics characteristics = getCameraCharacteristics(deviceName);
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
+ Integer colors = characteristics.get(CameraCharacteristics.SENSOR_INFO_COLOR_FILTER_ARRANGEMENT);
+ return colors != null && colors.equals(CameraCharacteristics.SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_NIR);
+ }
+
+ return false;
+ }
+
@Nullable
@Override
public List<CaptureFormat> getSupportedFormats(String deviceName) {
diff --git a/sdk/android/api/org/webrtc/CameraEnumerator.java b/sdk/android/api/org/webrtc/CameraEnumerator.java
index dc954b62e0..db34d542c8 100644
--- a/sdk/android/api/org/webrtc/CameraEnumerator.java
+++ b/sdk/android/api/org/webrtc/CameraEnumerator.java
@@ -18,6 +18,7 @@ public interface CameraEnumerator {
public String[] getDeviceNames();
public boolean isFrontFacing(String deviceName);
public boolean isBackFacing(String deviceName);
+ public boolean isInfrared(String deviceName);
public List<CaptureFormat> getSupportedFormats(String deviceName);
public CameraVideoCapturer createCapturer(

1431
third_party/libwebrtc/moz-patch-stack/0030.patch поставляемый

Разница между файлами не показана из-за своего большого размера Загрузить разницу

1427
third_party/libwebrtc/moz-patch-stack/0031.patch поставляемый

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,26 +1,29 @@
From: Dan Minor <dminor@mozilla.com>
Date: Fri, 13 Nov 2020 14:34:00 -0500
Subject: Bug 1654112 - Fully quality AudioLevel::kUri in channel_send.cc. r=ng
Date: Tue, 1 Dec 2020 09:36:00 -0500
Subject: Bug 1654112 - Disable creating av1 encoder and decoder. r=ng
Differential Revision: https://phabricator.services.mozilla.com/D130082
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/7163801a480d607005042292ed9e4fbb892f440d
Differential Revision: https://phabricator.services.mozilla.com/D130089
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/ef548d7758c7de6e78d38af299c2296bf9d20ec9
---
audio/channel_send.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
media/engine/internal_decoder_factory.cc | 2 ++
1 file changed, 2 insertions(+)
diff --git a/audio/channel_send.cc b/audio/channel_send.cc
index 984f530d38..700fc6deb3 100644
--- a/audio/channel_send.cc
+++ b/audio/channel_send.cc
@@ -621,9 +621,9 @@ void ChannelSend::SetSendAudioLevelIndicationStatus(bool enable, int id) {
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
include_audio_level_indication_.store(enable);
if (enable) {
- rtp_rtcp_->RegisterRtpHeaderExtension(AudioLevel::Uri(), id);
+ rtp_rtcp_->RegisterRtpHeaderExtension(webrtc::AudioLevel::Uri(), id);
} else {
- rtp_rtcp_->DeregisterSendRtpHeaderExtension(AudioLevel::Uri());
+ rtp_rtcp_->DeregisterSendRtpHeaderExtension(webrtc::AudioLevel::Uri());
}
}
diff --git a/media/engine/internal_decoder_factory.cc b/media/engine/internal_decoder_factory.cc
index e761fd60c8..001c666313 100644
--- a/media/engine/internal_decoder_factory.cc
+++ b/media/engine/internal_decoder_factory.cc
@@ -49,12 +49,14 @@ std::vector<SdpVideoFormat> InternalDecoderFactory::GetSupportedFormats()
for (const SdpVideoFormat& h264_format : SupportedH264DecoderCodecs())
formats.push_back(h264_format);
+#if !defined(WEBRTC_MOZILLA_BUILD)
if (kDav1dIsIncluded) {
formats.push_back(SdpVideoFormat(cricket::kAv1CodecName));
formats.push_back(SdpVideoFormat(
cricket::kAv1CodecName,
{{kAV1FmtpProfile, AV1ProfileToString(AV1Profile::kProfile1).data()}}));
}
+#endif
return formats;
}

Просмотреть файл

@ -1,29 +1,130 @@
From: Dan Minor <dminor@mozilla.com>
Date: Tue, 1 Dec 2020 09:36:00 -0500
Subject: Bug 1654112 - Disable creating av1 encoder and decoder. r=ng
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Mon, 18 Jan 2021 11:04:00 +0100
Subject: Bug 1654112 - Include RtcpPacketTypeCounter in audio send stats, to
not regress nackCount. r=ng
Differential Revision: https://phabricator.services.mozilla.com/D130089
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/ef548d7758c7de6e78d38af299c2296bf9d20ec9
This is similar to how it's already included for video send.
Differential Revision: https://phabricator.services.mozilla.com/D102273
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/d380a43d59f4f7cbc001f4eab9b63ee993b32cd8
---
media/engine/internal_decoder_factory.cc | 2 ++
1 file changed, 2 insertions(+)
audio/audio_send_stream.cc | 1 +
audio/channel_send.cc | 31 +++++++++++++++++++++++++++++++
audio/channel_send.h | 1 +
call/audio_send_stream.h | 2 ++
4 files changed, 35 insertions(+)
diff --git a/media/engine/internal_decoder_factory.cc b/media/engine/internal_decoder_factory.cc
index e761fd60c8..001c666313 100644
--- a/media/engine/internal_decoder_factory.cc
+++ b/media/engine/internal_decoder_factory.cc
@@ -49,12 +49,14 @@ std::vector<SdpVideoFormat> InternalDecoderFactory::GetSupportedFormats()
for (const SdpVideoFormat& h264_format : SupportedH264DecoderCodecs())
formats.push_back(h264_format);
diff --git a/audio/audio_send_stream.cc b/audio/audio_send_stream.cc
index 0caf59a20e..bffb910832 100644
--- a/audio/audio_send_stream.cc
+++ b/audio/audio_send_stream.cc
@@ -431,6 +431,7 @@ webrtc::AudioSendStream::Stats AudioSendStream::GetStats(
stats.target_bitrate_bps = channel_send_->GetTargetBitrate();
+#if !defined(WEBRTC_MOZILLA_BUILD)
if (kDav1dIsIncluded) {
formats.push_back(SdpVideoFormat(cricket::kAv1CodecName));
formats.push_back(SdpVideoFormat(
cricket::kAv1CodecName,
{{kAV1FmtpProfile, AV1ProfileToString(AV1Profile::kProfile1).data()}}));
}
+#endif
webrtc::CallSendStatistics call_stats = channel_send_->GetRTCPStatistics();
+ stats.rtcp_packet_type_counts = call_stats.rtcp_packet_type_counts;
stats.payload_bytes_sent = call_stats.payload_bytes_sent;
stats.header_and_padding_bytes_sent =
call_stats.header_and_padding_bytes_sent;
diff --git a/audio/channel_send.cc b/audio/channel_send.cc
index 700fc6deb3..000427c833 100644
--- a/audio/channel_send.cc
+++ b/audio/channel_send.cc
@@ -55,6 +55,31 @@ constexpr int64_t kMinRetransmissionWindowMs = 30;
class RtpPacketSenderProxy;
class TransportSequenceNumberProxy;
return formats;
}
+class RtcpCounterObserver : public RtcpPacketTypeCounterObserver {
+ public:
+ explicit RtcpCounterObserver(uint32_t ssrc) : ssrc_(ssrc) {}
+
+ void RtcpPacketTypesCounterUpdated(
+ uint32_t ssrc, const RtcpPacketTypeCounter& packet_counter) override {
+ if (ssrc_ != ssrc) {
+ return;
+ }
+
+ MutexLock lock(&mutex_);
+ packet_counter_ = packet_counter;
+ }
+
+ RtcpPacketTypeCounter GetCounts() {
+ MutexLock lock(&mutex_);
+ return packet_counter_;
+ }
+
+ private:
+ Mutex mutex_;
+ const uint32_t ssrc_;
+ RtcpPacketTypeCounter packet_counter_;
+};
+
class ChannelSend : public ChannelSendInterface,
public AudioPacketizationCallback, // receive encoded
// packets from the ACM
@@ -207,6 +232,8 @@ class ChannelSend : public ChannelSendInterface,
bool input_mute_ RTC_GUARDED_BY(volume_settings_mutex_) = false;
bool previous_frame_muted_ RTC_GUARDED_BY(encoder_queue_) = false;
+ const std::unique_ptr<RtcpCounterObserver> rtcp_counter_observer_;
+
PacketRouter* packet_router_ RTC_GUARDED_BY(&worker_thread_checker_) =
nullptr;
const std::unique_ptr<RtpPacketSenderProxy> rtp_packet_pacer_proxy_;
@@ -385,6 +412,7 @@ ChannelSend::ChannelSend(
const FieldTrialsView& field_trials)
: ssrc_(ssrc),
event_log_(rtc_event_log),
+ rtcp_counter_observer_(new RtcpCounterObserver(ssrc)),
rtp_packet_pacer_proxy_(new RtpPacketSenderProxy()),
retransmission_rate_limiter_(
new RateLimiter(clock, kMaxRetransmissionWindowMs)),
@@ -409,6 +437,8 @@ ChannelSend::ChannelSend(
configuration.event_log = event_log_;
configuration.rtt_stats = rtcp_rtt_stats;
+ configuration.rtcp_packet_type_counter_observer =
+ rtcp_counter_observer_.get();
configuration.retransmission_rate_limiter =
retransmission_rate_limiter_.get();
configuration.extmap_allow_mixed = extmap_allow_mixed;
@@ -669,6 +699,7 @@ CallSendStatistics ChannelSend::GetRTCPStatistics() const {
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
CallSendStatistics stats = {0};
stats.rttMs = GetRTT();
+ stats.rtcp_packet_type_counts = rtcp_counter_observer_->GetCounts();
StreamDataCounters rtp_stats;
StreamDataCounters rtx_stats;
diff --git a/audio/channel_send.h b/audio/channel_send.h
index 00d954c952..f0c9232296 100644
--- a/audio/channel_send.h
+++ b/audio/channel_send.h
@@ -43,6 +43,7 @@ struct CallSendStatistics {
TimeDelta total_packet_send_delay = TimeDelta::Zero();
// https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-retransmittedpacketssent
uint64_t retransmitted_packets_sent;
+ RtcpPacketTypeCounter rtcp_packet_type_counts;
// A snapshot of Report Blocks with additional data of interest to statistics.
// Within this list, the sender-source SSRC pair is unique and per-pair the
// ReportBlockData represents the latest Report Block that was received for
diff --git a/call/audio_send_stream.h b/call/audio_send_stream.h
index f9e49db574..5f4f871bf0 100644
--- a/call/audio_send_stream.h
+++ b/call/audio_send_stream.h
@@ -31,6 +31,7 @@
#include "call/rtp_config.h"
#include "modules/audio_processing/include/audio_processing_statistics.h"
#include "modules/rtp_rtcp/include/report_block_data.h"
+#include "modules/rtp_rtcp/include/rtcp_statistics.h"
namespace webrtc {
@@ -65,6 +66,7 @@ class AudioSendStream : public AudioSender {
ANAStats ana_statistics;
AudioProcessingStats apm_statistics;
+ RtcpPacketTypeCounter rtcp_packet_type_counts;
int64_t target_bitrate_bps = 0;
// A snapshot of Report Blocks with additional data of interest to

Просмотреть файл

@ -1,130 +1,41 @@
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Mon, 18 Jan 2021 11:04:00 +0100
Subject: Bug 1654112 - Include RtcpPacketTypeCounter in audio send stats, to
not regress nackCount. r=ng
Date: Fri, 19 Feb 2021 13:45:00 +0100
Subject: Bug 1654112 - libwebrtc: Add a REMB on/off switch to
VideoReceiveStream. r=ng
This is similar to how it's already included for video send.
Differential Revision: https://phabricator.services.mozilla.com/D102273
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/d380a43d59f4f7cbc001f4eab9b63ee993b32cd8
Differential Revision: https://phabricator.services.mozilla.com/D105774
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/7330681cf4de6d8dd868cc661cbdd6679bbc07b3
---
audio/audio_send_stream.cc | 1 +
audio/channel_send.cc | 31 +++++++++++++++++++++++++++++++
audio/channel_send.h | 1 +
call/audio_send_stream.h | 2 ++
4 files changed, 35 insertions(+)
call/video_receive_stream.h | 3 +++
video/rtp_video_stream_receiver2.cc | 3 +--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/audio/audio_send_stream.cc b/audio/audio_send_stream.cc
index 0caf59a20e..bffb910832 100644
--- a/audio/audio_send_stream.cc
+++ b/audio/audio_send_stream.cc
@@ -431,6 +431,7 @@ webrtc::AudioSendStream::Stats AudioSendStream::GetStats(
stats.target_bitrate_bps = channel_send_->GetTargetBitrate();
diff --git a/call/video_receive_stream.h b/call/video_receive_stream.h
index 95f1a47f4e..a1fc204e7c 100644
--- a/call/video_receive_stream.h
+++ b/call/video_receive_stream.h
@@ -210,6 +210,9 @@ class VideoReceiveStreamInterface : public MediaReceiveStreamInterface {
// disabled.
KeyFrameReqMethod keyframe_method = KeyFrameReqMethod::kPliRtcp;
webrtc::CallSendStatistics call_stats = channel_send_->GetRTCPStatistics();
+ stats.rtcp_packet_type_counts = call_stats.rtcp_packet_type_counts;
stats.payload_bytes_sent = call_stats.payload_bytes_sent;
stats.header_and_padding_bytes_sent =
call_stats.header_and_padding_bytes_sent;
diff --git a/audio/channel_send.cc b/audio/channel_send.cc
index 700fc6deb3..000427c833 100644
--- a/audio/channel_send.cc
+++ b/audio/channel_send.cc
@@ -55,6 +55,31 @@ constexpr int64_t kMinRetransmissionWindowMs = 30;
class RtpPacketSenderProxy;
class TransportSequenceNumberProxy;
+class RtcpCounterObserver : public RtcpPacketTypeCounterObserver {
+ public:
+ explicit RtcpCounterObserver(uint32_t ssrc) : ssrc_(ssrc) {}
+ // See draft-alvestrand-rmcat-remb for information.
+ bool remb = false;
+
+ void RtcpPacketTypesCounterUpdated(
+ uint32_t ssrc, const RtcpPacketTypeCounter& packet_counter) override {
+ if (ssrc_ != ssrc) {
+ return;
+ }
+
+ MutexLock lock(&mutex_);
+ packet_counter_ = packet_counter;
+ }
+
+ RtcpPacketTypeCounter GetCounts() {
+ MutexLock lock(&mutex_);
+ return packet_counter_;
+ }
+
+ private:
+ Mutex mutex_;
+ const uint32_t ssrc_;
+ RtcpPacketTypeCounter packet_counter_;
+};
+
class ChannelSend : public ChannelSendInterface,
public AudioPacketizationCallback, // receive encoded
// packets from the ACM
@@ -207,6 +232,8 @@ class ChannelSend : public ChannelSendInterface,
bool input_mute_ RTC_GUARDED_BY(volume_settings_mutex_) = false;
bool previous_frame_muted_ RTC_GUARDED_BY(encoder_queue_) = false;
bool tmmbr = false;
+ const std::unique_ptr<RtcpCounterObserver> rtcp_counter_observer_;
+
PacketRouter* packet_router_ RTC_GUARDED_BY(&worker_thread_checker_) =
nullptr;
const std::unique_ptr<RtpPacketSenderProxy> rtp_packet_pacer_proxy_;
@@ -385,6 +412,7 @@ ChannelSend::ChannelSend(
const FieldTrialsView& field_trials)
: ssrc_(ssrc),
event_log_(rtc_event_log),
+ rtcp_counter_observer_(new RtcpCounterObserver(ssrc)),
rtp_packet_pacer_proxy_(new RtpPacketSenderProxy()),
retransmission_rate_limiter_(
new RateLimiter(clock, kMaxRetransmissionWindowMs)),
@@ -409,6 +437,8 @@ ChannelSend::ChannelSend(
// See LntfConfig for description.
diff --git a/video/rtp_video_stream_receiver2.cc b/video/rtp_video_stream_receiver2.cc
index 70c11e5868..ae5e329525 100644
--- a/video/rtp_video_stream_receiver2.cc
+++ b/video/rtp_video_stream_receiver2.cc
@@ -296,9 +296,8 @@ RtpVideoStreamReceiver2::RtpVideoStreamReceiver2(
frames_decryptable_(false),
absolute_capture_time_interpolator_(clock) {
packet_sequence_checker_.Detach();
- constexpr bool remb_candidate = true;
if (packet_router_)
- packet_router_->AddReceiveRtpModule(rtp_rtcp_.get(), remb_candidate);
+ packet_router_->AddReceiveRtpModule(rtp_rtcp_.get(), config_.rtp.remb);
configuration.event_log = event_log_;
configuration.rtt_stats = rtcp_rtt_stats;
+ configuration.rtcp_packet_type_counter_observer =
+ rtcp_counter_observer_.get();
configuration.retransmission_rate_limiter =
retransmission_rate_limiter_.get();
configuration.extmap_allow_mixed = extmap_allow_mixed;
@@ -669,6 +699,7 @@ CallSendStatistics ChannelSend::GetRTCPStatistics() const {
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
CallSendStatistics stats = {0};
stats.rttMs = GetRTT();
+ stats.rtcp_packet_type_counts = rtcp_counter_observer_->GetCounts();
StreamDataCounters rtp_stats;
StreamDataCounters rtx_stats;
diff --git a/audio/channel_send.h b/audio/channel_send.h
index 00d954c952..f0c9232296 100644
--- a/audio/channel_send.h
+++ b/audio/channel_send.h
@@ -43,6 +43,7 @@ struct CallSendStatistics {
TimeDelta total_packet_send_delay = TimeDelta::Zero();
// https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-retransmittedpacketssent
uint64_t retransmitted_packets_sent;
+ RtcpPacketTypeCounter rtcp_packet_type_counts;
// A snapshot of Report Blocks with additional data of interest to statistics.
// Within this list, the sender-source SSRC pair is unique and per-pair the
// ReportBlockData represents the latest Report Block that was received for
diff --git a/call/audio_send_stream.h b/call/audio_send_stream.h
index f9e49db574..5f4f871bf0 100644
--- a/call/audio_send_stream.h
+++ b/call/audio_send_stream.h
@@ -31,6 +31,7 @@
#include "call/rtp_config.h"
#include "modules/audio_processing/include/audio_processing_statistics.h"
#include "modules/rtp_rtcp/include/report_block_data.h"
+#include "modules/rtp_rtcp/include/rtcp_statistics.h"
namespace webrtc {
@@ -65,6 +66,7 @@ class AudioSendStream : public AudioSender {
ANAStats ana_statistics;
AudioProcessingStats apm_statistics;
+ RtcpPacketTypeCounter rtcp_packet_type_counts;
int64_t target_bitrate_bps = 0;
// A snapshot of Report Blocks with additional data of interest to
RTC_DCHECK(config_.rtp.rtcp_mode != RtcpMode::kOff)
<< "A stream should not be configured with RTCP disabled. This value is "

Просмотреть файл

@ -1,41 +1,38 @@
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Fri, 19 Feb 2021 13:45:00 +0100
Subject: Bug 1654112 - libwebrtc: Add a REMB on/off switch to
VideoReceiveStream. r=ng
From: Nico Grunbaum <na-g@nostrum.com>
Date: Wed, 10 Feb 2021 12:24:00 -0800
Subject: Bug 1654112 - Use newer thread run callback, and adapt
PlatformUIThread; r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D105774
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/7330681cf4de6d8dd868cc661cbdd6679bbc07b3
Differential Revision: https://phabricator.services.mozilla.com/D107879
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/bb6417a4cfac1416a8e2565bd68b66c40be4827b
---
call/video_receive_stream.h | 3 +++
video/rtp_video_stream_receiver2.cc | 3 +--
2 files changed, 4 insertions(+), 2 deletions(-)
rtc_base/platform_thread.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/call/video_receive_stream.h b/call/video_receive_stream.h
index 95f1a47f4e..a1fc204e7c 100644
--- a/call/video_receive_stream.h
+++ b/call/video_receive_stream.h
@@ -210,6 +210,9 @@ class VideoReceiveStreamInterface : public MediaReceiveStreamInterface {
// disabled.
KeyFrameReqMethod keyframe_method = KeyFrameReqMethod::kPliRtcp;
diff --git a/rtc_base/platform_thread.h b/rtc_base/platform_thread.h
index befd61849d..5b7c6884fe 100644
--- a/rtc_base/platform_thread.h
+++ b/rtc_base/platform_thread.h
@@ -21,8 +21,13 @@
#include "absl/types/optional.h"
#include "rtc_base/platform_thread_types.h"
+ // See draft-alvestrand-rmcat-remb for information.
+ bool remb = false;
+#include "rtc_base/deprecated/recursive_critical_section.h"
+
bool tmmbr = false;
namespace rtc {
// See LntfConfig for description.
diff --git a/video/rtp_video_stream_receiver2.cc b/video/rtp_video_stream_receiver2.cc
index 70c11e5868..ae5e329525 100644
--- a/video/rtp_video_stream_receiver2.cc
+++ b/video/rtp_video_stream_receiver2.cc
@@ -296,9 +296,8 @@ RtpVideoStreamReceiver2::RtpVideoStreamReceiver2(
frames_decryptable_(false),
absolute_capture_time_interpolator_(clock) {
packet_sequence_checker_.Detach();
- constexpr bool remb_candidate = true;
if (packet_router_)
- packet_router_->AddReceiveRtpModule(rtp_rtcp_.get(), remb_candidate);
+ packet_router_->AddReceiveRtpModule(rtp_rtcp_.get(), config_.rtp.remb);
+// Bug 1691641
+class PlatformUIThread;
+
enum class ThreadPriority {
kLow = 1,
kNormal,
@@ -113,6 +118,8 @@ class PlatformThread final {
RTC_DCHECK(config_.rtp.rtcp_mode != RtcpMode::kOff)
<< "A stream should not be configured with RTCP disabled. This value is "
absl::optional<Handle> handle_;
bool joinable_ = false;
+ // Bug 1691641
+ friend PlatformUIThread;
};
} // namespace rtc

Просмотреть файл

@ -1,38 +1,54 @@
From: Nico Grunbaum <na-g@nostrum.com>
Date: Wed, 10 Feb 2021 12:24:00 -0800
Subject: Bug 1654112 - Use newer thread run callback, and adapt
PlatformUIThread; r=pehrsons
Date: Thu, 18 Feb 2021 17:23:00 -0800
Subject: Bug 1654112 - fix device_info_ds pid and Windows constants includes;
r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D107879
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/bb6417a4cfac1416a8e2565bd68b66c40be4827b
Upstreaming bug 1697385
Differential Revision: https://phabricator.services.mozilla.com/D107899
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/24809d566449907edea49ea47528065ad0f76910
---
rtc_base/platform_thread.h | 7 +++++++
1 file changed, 7 insertions(+)
modules/video_capture/windows/device_info_ds.cc | 3 ++-
modules/video_capture/windows/device_info_ds.h | 6 +++++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/rtc_base/platform_thread.h b/rtc_base/platform_thread.h
index befd61849d..5b7c6884fe 100644
--- a/rtc_base/platform_thread.h
+++ b/rtc_base/platform_thread.h
@@ -21,8 +21,13 @@
#include "absl/types/optional.h"
#include "rtc_base/platform_thread_types.h"
diff --git a/modules/video_capture/windows/device_info_ds.cc b/modules/video_capture/windows/device_info_ds.cc
index 9d22f42f4d..f6927281f3 100644
--- a/modules/video_capture/windows/device_info_ds.cc
+++ b/modules/video_capture/windows/device_info_ds.cc
@@ -172,7 +172,8 @@ int32_t DeviceInfoDS::GetDeviceName(uint32_t deviceNumber,
char* deviceUniqueIdUTF8,
uint32_t deviceUniqueIdUTF8Length,
char* productUniqueIdUTF8,
- uint32_t productUniqueIdUTF8Length) {
+ uint32_t productUniqueIdUTF8Length,
+ pid_t* pid) {
MutexLock lock(&_apiLock);
const int32_t result = GetDeviceInfo(
deviceNumber, deviceNameUTF8, deviceNameLength, deviceUniqueIdUTF8,
diff --git a/modules/video_capture/windows/device_info_ds.h b/modules/video_capture/windows/device_info_ds.h
index ed2a726d6f..e6dfaed366 100644
--- a/modules/video_capture/windows/device_info_ds.h
+++ b/modules/video_capture/windows/device_info_ds.h
@@ -12,8 +12,11 @@
#define MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_DEVICE_INFO_DS_H_
+#include "rtc_base/deprecated/recursive_critical_section.h"
+
namespace rtc {
#include <dshow.h>
+#include <Ks.h>
+#include <dbt.h>
+// Bug 1691641
+class PlatformUIThread;
+
enum class ThreadPriority {
kLow = 1,
kNormal,
@@ -113,6 +118,8 @@ class PlatformThread final {
#include "modules/video_capture/device_info_impl.h"
+#include "modules/video_capture/video_capture.h"
#include "modules/video_capture/video_capture_impl.h"
absl::optional<Handle> handle_;
bool joinable_ = false;
+ // Bug 1691641
+ friend PlatformUIThread;
};
namespace webrtc {
@@ -47,7 +50,8 @@ class DeviceInfoDS : public DeviceInfoImpl {
char* deviceUniqueIdUTF8,
uint32_t deviceUniqueIdUTF8Length,
char* productUniqueIdUTF8,
- uint32_t productUniqueIdUTF8Length) override;
+ uint32_t productUniqueIdUTF8Length,
+ pid_t* pid) override;
} // namespace rtc
/*
* Display OS /capture device specific settings dialog

Просмотреть файл

@ -1,54 +1,47 @@
From: Nico Grunbaum <na-g@nostrum.com>
Date: Thu, 18 Feb 2021 17:23:00 -0800
Subject: Bug 1654112 - fix device_info_ds pid and Windows constants includes;
r=pehrsons
From: "Byron Campen [:bwc]" <docfaraday@gmail.com>
Date: Thu, 29 Apr 2021 18:25:00 +0000
Subject: Bug 1654112 - Work around the old (<1.5) libxrandr headers on our
build machines. r=mjf,ng
Upstreaming bug 1697385
Differential Revision: https://phabricator.services.mozilla.com/D107899
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/24809d566449907edea49ea47528065ad0f76910
Differential Revision: https://phabricator.services.mozilla.com/D113830
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/c91f12b557a1d23b468c75c4f2fc00eb0f8d541a
---
modules/video_capture/windows/device_info_ds.cc | 3 ++-
modules/video_capture/windows/device_info_ds.h | 6 +++++-
2 files changed, 7 insertions(+), 2 deletions(-)
X11/extensions/Xrandr.h | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
create mode 100644 X11/extensions/Xrandr.h
diff --git a/modules/video_capture/windows/device_info_ds.cc b/modules/video_capture/windows/device_info_ds.cc
index 9d22f42f4d..f6927281f3 100644
--- a/modules/video_capture/windows/device_info_ds.cc
+++ b/modules/video_capture/windows/device_info_ds.cc
@@ -172,7 +172,8 @@ int32_t DeviceInfoDS::GetDeviceName(uint32_t deviceNumber,
char* deviceUniqueIdUTF8,
uint32_t deviceUniqueIdUTF8Length,
char* productUniqueIdUTF8,
- uint32_t productUniqueIdUTF8Length) {
+ uint32_t productUniqueIdUTF8Length,
+ pid_t* pid) {
MutexLock lock(&_apiLock);
const int32_t result = GetDeviceInfo(
deviceNumber, deviceNameUTF8, deviceNameLength, deviceUniqueIdUTF8,
diff --git a/modules/video_capture/windows/device_info_ds.h b/modules/video_capture/windows/device_info_ds.h
index ed2a726d6f..e6dfaed366 100644
--- a/modules/video_capture/windows/device_info_ds.h
+++ b/modules/video_capture/windows/device_info_ds.h
@@ -12,8 +12,11 @@
#define MODULES_VIDEO_CAPTURE_MAIN_SOURCE_WINDOWS_DEVICE_INFO_DS_H_
#include <dshow.h>
+#include <Ks.h>
+#include <dbt.h>
#include "modules/video_capture/device_info_impl.h"
+#include "modules/video_capture/video_capture.h"
#include "modules/video_capture/video_capture_impl.h"
namespace webrtc {
@@ -47,7 +50,8 @@ class DeviceInfoDS : public DeviceInfoImpl {
char* deviceUniqueIdUTF8,
uint32_t deviceUniqueIdUTF8Length,
char* productUniqueIdUTF8,
- uint32_t productUniqueIdUTF8Length) override;
+ uint32_t productUniqueIdUTF8Length,
+ pid_t* pid) override;
/*
* Display OS /capture device specific settings dialog
diff --git a/X11/extensions/Xrandr.h b/X11/extensions/Xrandr.h
new file mode 100644
index 0000000000..876e8b4c7f
--- /dev/null
+++ b/X11/extensions/Xrandr.h
@@ -0,0 +1,29 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+// Hack to compensate for the old (<1.5) Xrandr development headers on
+// Mozilla's build boxes.
+
+#ifndef _XRANDR_H_WRAPPER_HACK_
+#define _XRANDR_H_WRAPPER_HACK_
+
+#include_next <X11/extensions/Xrandr.h>
+
+#if RANDR_MAJOR == 1 && RANDR_MINOR < 5 // defined in randr.h
+typedef struct _XRRMonitorInfo {
+ Atom name;
+ Bool primary;
+ Bool automatic;
+ int noutput;
+ int x;
+ int y;
+ int width;
+ int height;
+ int mwidth;
+ int mheight;
+ RROutput *outputs;
+} XRRMonitorInfo;
+#endif
+
+#endif // _XRANDR_H_WRAPPER_HACK_

Просмотреть файл

@ -1,47 +1,62 @@
From: "Byron Campen [:bwc]" <docfaraday@gmail.com>
Date: Thu, 29 Apr 2021 18:25:00 +0000
Subject: Bug 1654112 - Work around the old (<1.5) libxrandr headers on our
build machines. r=mjf,ng
From: Michael Froman <mfroman@mozilla.com>
Date: Fri, 16 Apr 2021 17:35:00 -0500
Subject: Bug 1654112 - General build fixes for paths and naming changes. r=ng
Differential Revision: https://phabricator.services.mozilla.com/D113830
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/c91f12b557a1d23b468c75c4f2fc00eb0f8d541a
Differential Revision: https://phabricator.services.mozilla.com/D113438
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/99b99cca6b7b2c2ebffb5472457a4f927bda11c4
---
X11/extensions/Xrandr.h | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
create mode 100644 X11/extensions/Xrandr.h
modules/video_capture/video_capture_impl.h | 6 ++++--
rtc_base/system/warn_current_thread_is_deadlocked.h | 2 +-
sdk/android/api/org/webrtc/VideoCodecInfo.java | 2 +-
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/X11/extensions/Xrandr.h b/X11/extensions/Xrandr.h
new file mode 100644
index 0000000000..876e8b4c7f
--- /dev/null
+++ b/X11/extensions/Xrandr.h
@@ -0,0 +1,29 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
diff --git a/modules/video_capture/video_capture_impl.h b/modules/video_capture/video_capture_impl.h
index e46e050609..dcc93fd3a0 100644
--- a/modules/video_capture/video_capture_impl.h
+++ b/modules/video_capture/video_capture_impl.h
@@ -97,6 +97,10 @@ class RTC_EXPORT VideoCaptureImpl : public VideoCaptureModule {
rtc::RaceChecker capture_checker_;
// current Device unique name;
char* _deviceUniqueId RTC_GUARDED_BY(api_checker_);
+
+// Hack to compensate for the old (<1.5) Xrandr development headers on
+// Mozilla's build boxes.
+
+#ifndef _XRANDR_H_WRAPPER_HACK_
+#define _XRANDR_H_WRAPPER_HACK_
+
+#include_next <X11/extensions/Xrandr.h>
+
+#if RANDR_MAJOR == 1 && RANDR_MINOR < 5 // defined in randr.h
+typedef struct _XRRMonitorInfo {
+ Atom name;
+ Bool primary;
+ Bool automatic;
+ int noutput;
+ int x;
+ int y;
+ int width;
+ int height;
+ int mwidth;
+ int mheight;
+ RROutput *outputs;
+} XRRMonitorInfo;
+#endif
+
+#endif // _XRANDR_H_WRAPPER_HACK_
+ // moved DeliverCapturedFrame to protected for VideoCaptureAndroid (mjf)
+ int32_t DeliverCapturedFrame(VideoFrame& captureFrame)
+ RTC_EXCLUSIVE_LOCKS_REQUIRED(api_lock_);
Mutex api_lock_;
// Should be set by platform dependent code in StartCapture.
VideoCaptureCapability _requestedCapability RTC_GUARDED_BY(api_checker_);
@@ -104,8 +108,6 @@ class RTC_EXPORT VideoCaptureImpl : public VideoCaptureModule {
private:
void UpdateFrameCount();
uint32_t CalculateFrameRate(int64_t now_ns);
- int32_t DeliverCapturedFrame(VideoFrame& captureFrame)
- RTC_EXCLUSIVE_LOCKS_REQUIRED(api_lock_);
void DeliverRawFrame(uint8_t* videoFrame,
size_t videoFrameLength,
const VideoCaptureCapability& frameInfo,
diff --git a/rtc_base/system/warn_current_thread_is_deadlocked.h b/rtc_base/system/warn_current_thread_is_deadlocked.h
index 4a0ba9dc09..eac12022ed 100644
--- a/rtc_base/system/warn_current_thread_is_deadlocked.h
+++ b/rtc_base/system/warn_current_thread_is_deadlocked.h
@@ -13,7 +13,7 @@
namespace webrtc {
-#if defined(WEBRTC_ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD)
+#if defined(WEBRTC_ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD) && !defined(MOZ_WIDGET_ANDROID)
void WarnThatTheCurrentThreadIsProbablyDeadlocked();
#else
inline void WarnThatTheCurrentThreadIsProbablyDeadlocked() {}
diff --git a/sdk/android/api/org/webrtc/VideoCodecInfo.java b/sdk/android/api/org/webrtc/VideoCodecInfo.java
index 4f97cf74cf..363be347b5 100644
--- a/sdk/android/api/org/webrtc/VideoCodecInfo.java
+++ b/sdk/android/api/org/webrtc/VideoCodecInfo.java
@@ -80,7 +80,7 @@ public class VideoCodecInfo {
}
@CalledByNative
- Map getParams() {
+ Map<String, String> getParams() {
return params;
}
}

Просмотреть файл

@ -1,62 +1,34 @@
From: Michael Froman <mfroman@mozilla.com>
Date: Fri, 16 Apr 2021 17:35:00 -0500
Subject: Bug 1654112 - General build fixes for paths and naming changes. r=ng
Date: Tue, 15 Jun 2021 12:18:00 -0500
Subject: Bug 1654112 - suppress android lint warnings for WrongConstant in 2
libwebrtc java files. r=ng
Differential Revision: https://phabricator.services.mozilla.com/D113438
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/99b99cca6b7b2c2ebffb5472457a4f927bda11c4
Differential Revision: https://phabricator.services.mozilla.com/D118050
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/e60e2f295fb722f69a3a9fe9af34219880afe772
---
modules/video_capture/video_capture_impl.h | 6 ++++--
rtc_base/system/warn_current_thread_is_deadlocked.h | 2 +-
sdk/android/api/org/webrtc/VideoCodecInfo.java | 2 +-
3 files changed, 6 insertions(+), 4 deletions(-)
sdk/android/src/java/org/webrtc/audio/WebRtcAudioUtils.java | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/modules/video_capture/video_capture_impl.h b/modules/video_capture/video_capture_impl.h
index e46e050609..dcc93fd3a0 100644
--- a/modules/video_capture/video_capture_impl.h
+++ b/modules/video_capture/video_capture_impl.h
@@ -97,6 +97,10 @@ class RTC_EXPORT VideoCaptureImpl : public VideoCaptureModule {
rtc::RaceChecker capture_checker_;
// current Device unique name;
char* _deviceUniqueId RTC_GUARDED_BY(api_checker_);
+
+ // moved DeliverCapturedFrame to protected for VideoCaptureAndroid (mjf)
+ int32_t DeliverCapturedFrame(VideoFrame& captureFrame)
+ RTC_EXCLUSIVE_LOCKS_REQUIRED(api_lock_);
Mutex api_lock_;
// Should be set by platform dependent code in StartCapture.
VideoCaptureCapability _requestedCapability RTC_GUARDED_BY(api_checker_);
@@ -104,8 +108,6 @@ class RTC_EXPORT VideoCaptureImpl : public VideoCaptureModule {
private:
void UpdateFrameCount();
uint32_t CalculateFrameRate(int64_t now_ns);
- int32_t DeliverCapturedFrame(VideoFrame& captureFrame)
- RTC_EXCLUSIVE_LOCKS_REQUIRED(api_lock_);
void DeliverRawFrame(uint8_t* videoFrame,
size_t videoFrameLength,
const VideoCaptureCapability& frameInfo,
diff --git a/rtc_base/system/warn_current_thread_is_deadlocked.h b/rtc_base/system/warn_current_thread_is_deadlocked.h
index 4a0ba9dc09..eac12022ed 100644
--- a/rtc_base/system/warn_current_thread_is_deadlocked.h
+++ b/rtc_base/system/warn_current_thread_is_deadlocked.h
@@ -13,7 +13,7 @@
diff --git a/sdk/android/src/java/org/webrtc/audio/WebRtcAudioUtils.java b/sdk/android/src/java/org/webrtc/audio/WebRtcAudioUtils.java
index 7894659926..7b4b809ab1 100644
--- a/sdk/android/src/java/org/webrtc/audio/WebRtcAudioUtils.java
+++ b/sdk/android/src/java/org/webrtc/audio/WebRtcAudioUtils.java
@@ -15,6 +15,7 @@ import static android.media.AudioManager.MODE_IN_COMMUNICATION;
import static android.media.AudioManager.MODE_NORMAL;
import static android.media.AudioManager.MODE_RINGTONE;
namespace webrtc {
-#if defined(WEBRTC_ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD)
+#if defined(WEBRTC_ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD) && !defined(MOZ_WIDGET_ANDROID)
void WarnThatTheCurrentThreadIsProbablyDeadlocked();
#else
inline void WarnThatTheCurrentThreadIsProbablyDeadlocked() {}
diff --git a/sdk/android/api/org/webrtc/VideoCodecInfo.java b/sdk/android/api/org/webrtc/VideoCodecInfo.java
index 4f97cf74cf..363be347b5 100644
--- a/sdk/android/api/org/webrtc/VideoCodecInfo.java
+++ b/sdk/android/api/org/webrtc/VideoCodecInfo.java
@@ -80,7 +80,7 @@ public class VideoCodecInfo {
+import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.pm.PackageManager;
@@ -229,6 +230,10 @@ final class WebRtcAudioUtils {
}
}
@CalledByNative
- Map getParams() {
+ Map<String, String> getParams() {
return params;
}
}
+ // Moz linting complains even though AudioManager.GET_DEVICES_ALL is
+ // listed in the docs here:
+ // https://developer.android.com/reference/android/media/AudioManager#GET_DEVICES_ALL
+ @SuppressLint("WrongConstant")
private static void logAudioDeviceInfo(String tag, AudioManager audioManager) {
if (Build.VERSION.SDK_INT < 23) {
return;

Просмотреть файл

@ -1,34 +1,35 @@
From: Michael Froman <mfroman@mozilla.com>
Date: Tue, 15 Jun 2021 12:18:00 -0500
Subject: Bug 1654112 - suppress android lint warnings for WrongConstant in 2
libwebrtc java files. r=ng
Date: Fri, 25 Jun 2021 15:12:00 -0500
Subject: Bug 1654112 - Mirror Bug 1714577 - Part 3 - Register WebRTC threads
with the Gecko Profiler. r=ng
Differential Revision: https://phabricator.services.mozilla.com/D118050
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/e60e2f295fb722f69a3a9fe9af34219880afe772
Differential Revision: https://phabricator.services.mozilla.com/D119412
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/d881b16dd8a6813feb5ce1516c2a7ebe0270e72d
---
sdk/android/src/java/org/webrtc/audio/WebRtcAudioUtils.java | 5 +++++
1 file changed, 5 insertions(+)
rtc_base/platform_thread.cc | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/sdk/android/src/java/org/webrtc/audio/WebRtcAudioUtils.java b/sdk/android/src/java/org/webrtc/audio/WebRtcAudioUtils.java
index 7894659926..7b4b809ab1 100644
--- a/sdk/android/src/java/org/webrtc/audio/WebRtcAudioUtils.java
+++ b/sdk/android/src/java/org/webrtc/audio/WebRtcAudioUtils.java
@@ -15,6 +15,7 @@ import static android.media.AudioManager.MODE_IN_COMMUNICATION;
import static android.media.AudioManager.MODE_NORMAL;
import static android.media.AudioManager.MODE_RINGTONE;
diff --git a/rtc_base/platform_thread.cc b/rtc_base/platform_thread.cc
index 556204ac89..71a9f1b224 100644
--- a/rtc_base/platform_thread.cc
+++ b/rtc_base/platform_thread.cc
@@ -19,6 +19,8 @@
+import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.pm.PackageManager;
@@ -229,6 +230,10 @@ final class WebRtcAudioUtils {
}
}
#include "rtc_base/checks.h"
+ // Moz linting complains even though AudioManager.GET_DEVICES_ALL is
+ // listed in the docs here:
+ // https://developer.android.com/reference/android/media/AudioManager#GET_DEVICES_ALL
+ @SuppressLint("WrongConstant")
private static void logAudioDeviceInfo(String tag, AudioManager audioManager) {
if (Build.VERSION.SDK_INT < 23) {
return;
+#include "MicroGeckoProfiler.h"
+
namespace rtc {
namespace {
@@ -181,6 +183,10 @@ PlatformThread PlatformThread::SpawnThread(
new std::function<void()>([thread_function = std::move(thread_function),
name = std::string(name), attributes] {
rtc::SetCurrentThreadName(name.c_str());
+
+ char stacktop;
+ AutoRegisterProfiler profiler(name.c_str(), &stacktop);
+
SetPriority(attributes.priority);
thread_function();
});

Просмотреть файл

@ -1,35 +1,297 @@
From: Michael Froman <mfroman@mozilla.com>
Date: Fri, 25 Jun 2021 15:12:00 -0500
Subject: Bug 1654112 - Mirror Bug 1714577 - Part 3 - Register WebRTC threads
with the Gecko Profiler. r=ng
From: Nico Grunbaum <na-g@nostrum.com>
Date: Wed, 14 Jul 2021 22:26:00 +0000
Subject: Bug 1654112 - deconflate the target and host architectures in
libwebrtc build files; r=mjf
Differential Revision: https://phabricator.services.mozilla.com/D119412
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/d881b16dd8a6813feb5ce1516c2a7ebe0270e72d
Differential Revision: https://phabricator.services.mozilla.com/D119707
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/58f47eacaf10d12e21dff7362743b6f4cdd1696b
---
rtc_base/platform_thread.cc | 6 ++++++
1 file changed, 6 insertions(+)
BUILD.gn | 6 +++---
common_audio/BUILD.gn | 16 ++++++++--------
common_audio/third_party/ooura/BUILD.gn | 6 +++---
common_audio/third_party/spl_sqrt_floor/BUILD.gn | 4 ++--
modules/audio_processing/aec3/BUILD.gn | 6 +++---
modules/audio_processing/aecm/BUILD.gn | 4 ++--
modules/audio_processing/agc/BUILD.gn | 2 +-
modules/audio_processing/agc2/rnn_vad/BUILD.gn | 2 +-
modules/audio_processing/ns/BUILD.gn | 2 +-
modules/desktop_capture/BUILD.gn | 2 +-
webrtc.gni | 4 ++--
11 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/rtc_base/platform_thread.cc b/rtc_base/platform_thread.cc
index 556204ac89..71a9f1b224 100644
--- a/rtc_base/platform_thread.cc
+++ b/rtc_base/platform_thread.cc
@@ -19,6 +19,8 @@
diff --git a/BUILD.gn b/BUILD.gn
index ca1ec4dec3..b8b20fb04d 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -418,12 +418,12 @@ config("common_config") {
}
}
#include "rtc_base/checks.h"
- if (current_cpu == "arm64") {
+ if (target_cpu == "arm64") {
defines += [ "WEBRTC_ARCH_ARM64" ]
defines += [ "WEBRTC_HAS_NEON" ]
}
+#include "MicroGeckoProfiler.h"
+
namespace rtc {
namespace {
- if (current_cpu == "arm") {
+ if (target_cpu == "arm") {
defines += [ "WEBRTC_ARCH_ARM" ]
if (arm_version >= 7) {
defines += [ "WEBRTC_ARCH_ARM_V7" ]
@@ -433,7 +433,7 @@ config("common_config") {
}
}
@@ -181,6 +183,10 @@ PlatformThread PlatformThread::SpawnThread(
new std::function<void()>([thread_function = std::move(thread_function),
name = std::string(name), attributes] {
rtc::SetCurrentThreadName(name.c_str());
+
+ char stacktop;
+ AutoRegisterProfiler profiler(name.c_str(), &stacktop);
+
SetPriority(attributes.priority);
thread_function();
});
- if (current_cpu == "mipsel") {
+ if (target_cpu == "mipsel") {
defines += [ "MIPS32_LE" ]
if (mips_float_abi == "hard") {
defines += [ "MIPS_FPU_LE" ]
diff --git a/common_audio/BUILD.gn b/common_audio/BUILD.gn
index a45214f754..79d9321bbd 100644
--- a/common_audio/BUILD.gn
+++ b/common_audio/BUILD.gn
@@ -66,7 +66,7 @@ rtc_library("common_audio") {
deps += [ ":common_audio_neon" ]
}
- if (current_cpu == "x86" || current_cpu == "x64") {
+ if (target_cpu == "x86" || target_cpu == "x64") {
deps += [ ":common_audio_sse2" ]
deps += [ ":common_audio_avx2" ]
}
@@ -88,7 +88,7 @@ rtc_source_set("mock_common_audio") {
rtc_source_set("common_audio_c_arm_asm") {
sources = []
deps = []
- if (current_cpu == "arm") {
+ if (target_cpu == "arm") {
sources += [ "signal_processing/complex_bit_reverse_arm.S" ]
if (arm_version >= 7) {
@@ -152,7 +152,7 @@ rtc_library("common_audio_c") {
"vad/webrtc_vad.c",
]
- if (current_cpu == "mipsel") {
+ if (target_cpu == "mipsel") {
sources += [
"signal_processing/complex_bit_reverse_mips.c",
"signal_processing/complex_fft_mips.c",
@@ -170,7 +170,7 @@ rtc_library("common_audio_c") {
sources += [ "signal_processing/complex_fft.c" ]
}
- if (current_cpu != "arm" && current_cpu != "mipsel") {
+ if (target_cpu != "arm" && target_cpu != "mipsel") {
sources += [
"signal_processing/complex_bit_reverse.c",
"signal_processing/filter_ar_fast_q12.c",
@@ -231,7 +231,7 @@ rtc_library("fir_filter_factory") {
"../rtc_base/system:arch",
"../system_wrappers",
]
- if (current_cpu == "x86" || current_cpu == "x64") {
+ if (target_cpu == "x86" || target_cpu == "x64") {
deps += [ ":common_audio_sse2" ]
deps += [ ":common_audio_avx2" ]
}
@@ -240,7 +240,7 @@ rtc_library("fir_filter_factory") {
}
}
-if (current_cpu == "x86" || current_cpu == "x64") {
+if (target_cpu == "x86" || target_cpu == "x64") {
rtc_library("common_audio_sse2") {
sources = [
"fir_filter_sse.cc",
@@ -289,7 +289,7 @@ if (rtc_build_with_neon) {
"resampler/sinc_resampler_neon.cc",
]
- if (current_cpu != "arm64") {
+ if (target_cpu != "arm64") {
# Enable compilation for the NEON instruction set.
suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
cflags = [ "-mfpu=neon" ]
@@ -312,7 +312,7 @@ if (rtc_build_with_neon) {
"signal_processing/min_max_operations_neon.c",
]
- if (current_cpu != "arm64") {
+ if (target_cpu != "arm64") {
# Enable compilation for the NEON instruction set.
suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
cflags = [ "-mfpu=neon" ]
diff --git a/common_audio/third_party/ooura/BUILD.gn b/common_audio/third_party/ooura/BUILD.gn
index 0cdf98e591..a0ddf777db 100644
--- a/common_audio/third_party/ooura/BUILD.gn
+++ b/common_audio/third_party/ooura/BUILD.gn
@@ -20,7 +20,7 @@ rtc_library("fft_size_128") {
]
cflags = []
- if (current_cpu == "x86" || current_cpu == "x64") {
+ if (target_cpu == "x86" || target_cpu == "x64") {
sources += [
"fft_size_128/ooura_fft_sse2.cc",
"fft_size_128/ooura_fft_tables_neon_sse2.h",
@@ -38,14 +38,14 @@ rtc_library("fft_size_128") {
deps += [ "../../../common_audio" ]
- if (current_cpu != "arm64") {
+ if (target_cpu != "arm64") {
# Enable compilation for the NEON instruction set.
suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
cflags += [ "-mfpu=neon" ]
}
}
- if (current_cpu == "mipsel" && mips_float_abi == "hard") {
+ if (target_cpu == "mipsel" && mips_float_abi == "hard") {
sources += [ "fft_size_128/ooura_fft_mips.cc" ]
}
}
diff --git a/common_audio/third_party/spl_sqrt_floor/BUILD.gn b/common_audio/third_party/spl_sqrt_floor/BUILD.gn
index ac862c65a8..e66ed2796e 100644
--- a/common_audio/third_party/spl_sqrt_floor/BUILD.gn
+++ b/common_audio/third_party/spl_sqrt_floor/BUILD.gn
@@ -12,11 +12,11 @@ rtc_library("spl_sqrt_floor") {
visibility = [ "../..:common_audio_c" ]
sources = [ "spl_sqrt_floor.h" ]
deps = []
- if (current_cpu == "arm") {
+ if (target_cpu == "arm") {
sources += [ "spl_sqrt_floor_arm.S" ]
deps += [ "../../../rtc_base/system:asm_defines" ]
- } else if (current_cpu == "mipsel") {
+ } else if (target_cpu == "mipsel") {
sources += [ "spl_sqrt_floor_mips.c" ]
} else {
sources += [ "spl_sqrt_floor.c" ]
diff --git a/modules/audio_processing/aec3/BUILD.gn b/modules/audio_processing/aec3/BUILD.gn
index 3e11a245a1..c29b893b7d 100644
--- a/modules/audio_processing/aec3/BUILD.gn
+++ b/modules/audio_processing/aec3/BUILD.gn
@@ -123,7 +123,7 @@ rtc_library("aec3") {
]
defines = []
- if (rtc_build_with_neon && current_cpu != "arm64") {
+ if (rtc_build_with_neon && target_cpu != "arm64") {
suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
cflags = [ "-mfpu=neon" ]
}
@@ -162,7 +162,7 @@ rtc_library("aec3") {
"//third_party/abseil-cpp/absl/types:optional",
]
- if (current_cpu == "x86" || current_cpu == "x64") {
+ if (target_cpu == "x86" || target_cpu == "x64") {
deps += [ ":aec3_avx2" ]
}
}
@@ -253,7 +253,7 @@ rtc_source_set("fft_data") {
]
}
-if (current_cpu == "x86" || current_cpu == "x64") {
+if (target_cpu == "x86" || target_cpu == "x64") {
rtc_library("aec3_avx2") {
configs += [ "..:apm_debug_dump" ]
sources = [
diff --git a/modules/audio_processing/aecm/BUILD.gn b/modules/audio_processing/aecm/BUILD.gn
index 80f2901049..a77f04aba5 100644
--- a/modules/audio_processing/aecm/BUILD.gn
+++ b/modules/audio_processing/aecm/BUILD.gn
@@ -29,14 +29,14 @@ rtc_library("aecm_core") {
if (rtc_build_with_neon) {
sources += [ "aecm_core_neon.cc" ]
- if (current_cpu != "arm64") {
+ if (target_cpu != "arm64") {
# Enable compilation for the NEON instruction set.
suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
cflags += [ "-mfpu=neon" ]
}
}
- if (current_cpu == "mipsel") {
+ if (target_cpu == "mipsel") {
sources += [ "aecm_core_mips.cc" ]
} else {
sources += [ "aecm_core_c.cc" ]
diff --git a/modules/audio_processing/agc/BUILD.gn b/modules/audio_processing/agc/BUILD.gn
index 508f901b08..75bef1450f 100644
--- a/modules/audio_processing/agc/BUILD.gn
+++ b/modules/audio_processing/agc/BUILD.gn
@@ -83,7 +83,7 @@ rtc_library("legacy_agc") {
]
if (rtc_build_with_neon) {
- if (current_cpu != "arm64") {
+ if (target_cpu != "arm64") {
# Enable compilation for the NEON instruction set.
suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
cflags = [ "-mfpu=neon" ]
diff --git a/modules/audio_processing/agc2/rnn_vad/BUILD.gn b/modules/audio_processing/agc2/rnn_vad/BUILD.gn
index 3003a585bd..d709eb3699 100644
--- a/modules/audio_processing/agc2/rnn_vad/BUILD.gn
+++ b/modules/audio_processing/agc2/rnn_vad/BUILD.gn
@@ -18,7 +18,7 @@ rtc_library("rnn_vad") {
]
defines = []
- if (rtc_build_with_neon && current_cpu != "arm64") {
+ if (rtc_build_with_neon && target_cpu != "arm64") {
suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
cflags = [ "-mfpu=neon" ]
}
diff --git a/modules/audio_processing/ns/BUILD.gn b/modules/audio_processing/ns/BUILD.gn
index d818e23f3c..8c2e9dba84 100644
--- a/modules/audio_processing/ns/BUILD.gn
+++ b/modules/audio_processing/ns/BUILD.gn
@@ -43,7 +43,7 @@ rtc_static_library("ns") {
]
defines = []
- if (rtc_build_with_neon && current_cpu != "arm64") {
+ if (rtc_build_with_neon && target_cpu != "arm64") {
suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
cflags = [ "-mfpu=neon" ]
}
diff --git a/modules/desktop_capture/BUILD.gn b/modules/desktop_capture/BUILD.gn
index 344c8a1531..dcc1b3c6ac 100644
--- a/modules/desktop_capture/BUILD.gn
+++ b/modules/desktop_capture/BUILD.gn
@@ -10,7 +10,7 @@ import("//build/config/linux/gtk/gtk.gni")
import("//build/config/ui.gni")
import("../../webrtc.gni")
-use_desktop_capture_differ_sse2 = current_cpu == "x86" || current_cpu == "x64"
+use_desktop_capture_differ_sse2 = target_cpu == "x86" || target_cpu == "x64"
config("x11_config") {
if (rtc_use_x11_extensions) {
diff --git a/webrtc.gni b/webrtc.gni
index ff01196517..ae2a2b6f3c 100644
--- a/webrtc.gni
+++ b/webrtc.gni
@@ -175,13 +175,13 @@ declare_args() {
# Selects fixed-point code where possible.
rtc_prefer_fixed_point = false
- if (current_cpu == "arm" || current_cpu == "arm64") {
+ if (target_cpu == "arm" || target_cpu == "arm64") {
rtc_prefer_fixed_point = true
}
# Determines whether NEON code will be built.
rtc_build_with_neon =
- (current_cpu == "arm" && arm_use_neon) || current_cpu == "arm64"
+ (target_cpu == "arm" && arm_use_neon) || target_cpu == "arm64"
# Enable this to build OpenH264 encoder/FFmpeg decoder. This is supported on
# all platforms except Android and iOS. Because FFmpeg can be built

Просмотреть файл

@ -1,297 +1,302 @@
From: Nico Grunbaum <na-g@nostrum.com>
Date: Wed, 14 Jul 2021 22:26:00 +0000
Subject: Bug 1654112 - deconflate the target and host architectures in
libwebrtc build files; r=mjf
From: "Byron Campen [:bwc]" <docfaraday@gmail.com>
Date: Fri, 19 Feb 2021 15:56:00 -0600
Subject: Bug 1654112 - Get RTCP BYE and RTP timeout handling working again
(from Bug 1595479) r=mjf,dminor
Differential Revision: https://phabricator.services.mozilla.com/D119707
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/58f47eacaf10d12e21dff7362743b6f4cdd1696b
Differential Revision: https://phabricator.services.mozilla.com/D106145
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/d0b311007c033e83824f5f6996a70ab9e870f31f
---
BUILD.gn | 6 +++---
common_audio/BUILD.gn | 16 ++++++++--------
common_audio/third_party/ooura/BUILD.gn | 6 +++---
common_audio/third_party/spl_sqrt_floor/BUILD.gn | 4 ++--
modules/audio_processing/aec3/BUILD.gn | 6 +++---
modules/audio_processing/aecm/BUILD.gn | 4 ++--
modules/audio_processing/agc/BUILD.gn | 2 +-
modules/audio_processing/agc2/rnn_vad/BUILD.gn | 2 +-
modules/audio_processing/ns/BUILD.gn | 2 +-
modules/desktop_capture/BUILD.gn | 2 +-
webrtc.gni | 4 ++--
11 files changed, 27 insertions(+), 27 deletions(-)
audio/audio_receive_stream.cc | 5 ++++-
audio/channel_receive.cc | 13 +++++++++----
audio/channel_receive.h | 4 +++-
call/audio_receive_stream.h | 3 +++
call/video_receive_stream.cc | 2 ++
call/video_receive_stream.h | 3 +++
modules/rtp_rtcp/include/rtp_rtcp_defines.h | 8 ++++++++
modules/rtp_rtcp/source/rtcp_receiver.cc | 18 ++++++++++++++++--
modules/rtp_rtcp/source/rtcp_receiver.h | 1 +
modules/rtp_rtcp/source/rtp_rtcp_interface.h | 3 +++
video/rtp_video_stream_receiver2.cc | 7 +++++--
11 files changed, 57 insertions(+), 10 deletions(-)
diff --git a/BUILD.gn b/BUILD.gn
index ca1ec4dec3..b8b20fb04d 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -418,12 +418,12 @@ config("common_config") {
}
}
diff --git a/audio/audio_receive_stream.cc b/audio/audio_receive_stream.cc
index 978bbb25b2..655b2761ac 100644
--- a/audio/audio_receive_stream.cc
+++ b/audio/audio_receive_stream.cc
@@ -39,6 +39,8 @@ std::string AudioReceiveStreamInterface::Config::Rtp::ToString() const {
ss << "{remote_ssrc: " << remote_ssrc;
ss << ", local_ssrc: " << local_ssrc;
ss << ", nack: " << nack.ToString();
+ ss << ", rtcp_event_observer: "
+ << (rtcp_event_observer ? "(rtcp_event_observer)" : "nullptr");
ss << '}';
return ss.str();
}
@@ -73,7 +75,8 @@ std::unique_ptr<voe::ChannelReceiveInterface> CreateChannelReceive(
config.jitter_buffer_fast_accelerate, config.jitter_buffer_min_delay_ms,
config.enable_non_sender_rtt, config.decoder_factory,
config.codec_pair_id, std::move(config.frame_decryptor),
- config.crypto_options, std::move(config.frame_transformer));
+ config.crypto_options, std::move(config.frame_transformer),
+ config.rtp.rtcp_event_observer);
}
} // namespace
- if (current_cpu == "arm64") {
+ if (target_cpu == "arm64") {
defines += [ "WEBRTC_ARCH_ARM64" ]
defines += [ "WEBRTC_HAS_NEON" ]
}
diff --git a/audio/channel_receive.cc b/audio/channel_receive.cc
index 270ba61ed5..b3aac7a1fb 100644
--- a/audio/channel_receive.cc
+++ b/audio/channel_receive.cc
@@ -104,7 +104,8 @@ class ChannelReceive : public ChannelReceiveInterface,
absl::optional<AudioCodecPairId> codec_pair_id,
rtc::scoped_refptr<FrameDecryptorInterface> frame_decryptor,
const webrtc::CryptoOptions& crypto_options,
- rtc::scoped_refptr<FrameTransformerInterface> frame_transformer);
+ rtc::scoped_refptr<FrameTransformerInterface> frame_transformer,
+ RtcpEventObserver* rtcp_event_observer);
~ChannelReceive() override;
- if (current_cpu == "arm") {
+ if (target_cpu == "arm") {
defines += [ "WEBRTC_ARCH_ARM" ]
if (arm_version >= 7) {
defines += [ "WEBRTC_ARCH_ARM_V7" ]
@@ -433,7 +433,7 @@ config("common_config") {
}
}
void SetSink(AudioSinkInterface* sink) override;
@@ -544,7 +545,8 @@ ChannelReceive::ChannelReceive(
absl::optional<AudioCodecPairId> codec_pair_id,
rtc::scoped_refptr<FrameDecryptorInterface> frame_decryptor,
const webrtc::CryptoOptions& crypto_options,
- rtc::scoped_refptr<FrameTransformerInterface> frame_transformer)
+ rtc::scoped_refptr<FrameTransformerInterface> frame_transformer,
+ RtcpEventObserver* rtcp_event_observer)
: worker_thread_(TaskQueueBase::Current()),
event_log_(rtc_event_log),
rtp_receive_statistics_(ReceiveStatistics::Create(clock)),
@@ -590,6 +592,7 @@ ChannelReceive::ChannelReceive(
configuration.local_media_ssrc = local_ssrc;
configuration.rtcp_packet_type_counter_observer = this;
configuration.non_sender_rtt_measurement = enable_non_sender_rtt;
+ configuration.rtcp_event_observer = rtcp_event_observer;
- if (current_cpu == "mipsel") {
+ if (target_cpu == "mipsel") {
defines += [ "MIPS32_LE" ]
if (mips_float_abi == "hard") {
defines += [ "MIPS_FPU_LE" ]
diff --git a/common_audio/BUILD.gn b/common_audio/BUILD.gn
index a45214f754..79d9321bbd 100644
--- a/common_audio/BUILD.gn
+++ b/common_audio/BUILD.gn
@@ -66,7 +66,7 @@ rtc_library("common_audio") {
deps += [ ":common_audio_neon" ]
}
- if (current_cpu == "x86" || current_cpu == "x64") {
+ if (target_cpu == "x86" || target_cpu == "x64") {
deps += [ ":common_audio_sse2" ]
deps += [ ":common_audio_avx2" ]
}
@@ -88,7 +88,7 @@ rtc_source_set("mock_common_audio") {
rtc_source_set("common_audio_c_arm_asm") {
sources = []
deps = []
- if (current_cpu == "arm") {
+ if (target_cpu == "arm") {
sources += [ "signal_processing/complex_bit_reverse_arm.S" ]
if (arm_version >= 7) {
@@ -152,7 +152,7 @@ rtc_library("common_audio_c") {
"vad/webrtc_vad.c",
]
- if (current_cpu == "mipsel") {
+ if (target_cpu == "mipsel") {
sources += [
"signal_processing/complex_bit_reverse_mips.c",
"signal_processing/complex_fft_mips.c",
@@ -170,7 +170,7 @@ rtc_library("common_audio_c") {
sources += [ "signal_processing/complex_fft.c" ]
}
- if (current_cpu != "arm" && current_cpu != "mipsel") {
+ if (target_cpu != "arm" && target_cpu != "mipsel") {
sources += [
"signal_processing/complex_bit_reverse.c",
"signal_processing/filter_ar_fast_q12.c",
@@ -231,7 +231,7 @@ rtc_library("fir_filter_factory") {
"../rtc_base/system:arch",
"../system_wrappers",
]
- if (current_cpu == "x86" || current_cpu == "x64") {
+ if (target_cpu == "x86" || target_cpu == "x64") {
deps += [ ":common_audio_sse2" ]
deps += [ ":common_audio_avx2" ]
}
@@ -240,7 +240,7 @@ rtc_library("fir_filter_factory") {
}
if (frame_transformer)
InitFrameTransformerDelegate(std::move(frame_transformer));
@@ -1117,13 +1120,15 @@ std::unique_ptr<ChannelReceiveInterface> CreateChannelReceive(
absl::optional<AudioCodecPairId> codec_pair_id,
rtc::scoped_refptr<FrameDecryptorInterface> frame_decryptor,
const webrtc::CryptoOptions& crypto_options,
- rtc::scoped_refptr<FrameTransformerInterface> frame_transformer) {
+ rtc::scoped_refptr<FrameTransformerInterface> frame_transformer,
+ RtcpEventObserver* rtcp_event_observer) {
return std::make_unique<ChannelReceive>(
clock, neteq_factory, audio_device_module, rtcp_send_transport,
rtc_event_log, local_ssrc, remote_ssrc, jitter_buffer_max_packets,
jitter_buffer_fast_playout, jitter_buffer_min_delay_ms,
enable_non_sender_rtt, decoder_factory, codec_pair_id,
- std::move(frame_decryptor), crypto_options, std::move(frame_transformer));
+ std::move(frame_decryptor), crypto_options, std::move(frame_transformer),
+ rtcp_event_observer);
}
-if (current_cpu == "x86" || current_cpu == "x64") {
+if (target_cpu == "x86" || target_cpu == "x64") {
rtc_library("common_audio_sse2") {
sources = [
"fir_filter_sse.cc",
@@ -289,7 +289,7 @@ if (rtc_build_with_neon) {
"resampler/sinc_resampler_neon.cc",
]
} // namespace voe
diff --git a/audio/channel_receive.h b/audio/channel_receive.h
index ab69103269..5713d97aaa 100644
--- a/audio/channel_receive.h
+++ b/audio/channel_receive.h
@@ -28,6 +28,7 @@
#include "call/rtp_packet_sink_interface.h"
#include "call/syncable.h"
#include "modules/audio_coding/include/audio_coding_module_typedefs.h"
+#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "modules/rtp_rtcp/source/source_tracker.h"
#include "system_wrappers/include/clock.h"
- if (current_cpu != "arm64") {
+ if (target_cpu != "arm64") {
# Enable compilation for the NEON instruction set.
suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
cflags = [ "-mfpu=neon" ]
@@ -312,7 +312,7 @@ if (rtc_build_with_neon) {
"signal_processing/min_max_operations_neon.c",
]
@@ -186,7 +187,8 @@ std::unique_ptr<ChannelReceiveInterface> CreateChannelReceive(
absl::optional<AudioCodecPairId> codec_pair_id,
rtc::scoped_refptr<FrameDecryptorInterface> frame_decryptor,
const webrtc::CryptoOptions& crypto_options,
- rtc::scoped_refptr<FrameTransformerInterface> frame_transformer);
+ rtc::scoped_refptr<FrameTransformerInterface> frame_transformer,
+ RtcpEventObserver* rtcp_event_observer);
- if (current_cpu != "arm64") {
+ if (target_cpu != "arm64") {
# Enable compilation for the NEON instruction set.
suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
cflags = [ "-mfpu=neon" ]
diff --git a/common_audio/third_party/ooura/BUILD.gn b/common_audio/third_party/ooura/BUILD.gn
index 0cdf98e591..a0ddf777db 100644
--- a/common_audio/third_party/ooura/BUILD.gn
+++ b/common_audio/third_party/ooura/BUILD.gn
@@ -20,7 +20,7 @@ rtc_library("fft_size_128") {
]
cflags = []
} // namespace voe
} // namespace webrtc
diff --git a/call/audio_receive_stream.h b/call/audio_receive_stream.h
index 4879311fdb..88b74b44ac 100644
--- a/call/audio_receive_stream.h
+++ b/call/audio_receive_stream.h
@@ -19,6 +19,7 @@
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_decoder_factory.h"
#include "api/call/transport.h"
+#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "api/crypto/crypto_options.h"
#include "api/rtp_parameters.h"
#include "call/receive_stream.h"
@@ -117,6 +118,8 @@ class AudioReceiveStreamInterface : public MediaReceiveStreamInterface {
- if (current_cpu == "x86" || current_cpu == "x64") {
+ if (target_cpu == "x86" || target_cpu == "x64") {
sources += [
"fft_size_128/ooura_fft_sse2.cc",
"fft_size_128/ooura_fft_tables_neon_sse2.h",
@@ -38,14 +38,14 @@ rtc_library("fft_size_128") {
// See NackConfig for description.
NackConfig nack;
+
+ RtcpEventObserver* rtcp_event_observer = nullptr;
} rtp;
deps += [ "../../../common_audio" ]
- if (current_cpu != "arm64") {
+ if (target_cpu != "arm64") {
# Enable compilation for the NEON instruction set.
suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
cflags += [ "-mfpu=neon" ]
}
}
- if (current_cpu == "mipsel" && mips_float_abi == "hard") {
+ if (target_cpu == "mipsel" && mips_float_abi == "hard") {
sources += [ "fft_size_128/ooura_fft_mips.cc" ]
// Receive-side RTT.
diff --git a/call/video_receive_stream.cc b/call/video_receive_stream.cc
index 3e2a51322f..46015cb0c7 100644
--- a/call/video_receive_stream.cc
+++ b/call/video_receive_stream.cc
@@ -161,6 +161,8 @@ std::string VideoReceiveStreamInterface::Config::Rtp::ToString() const {
ss << pt << ", ";
}
ss << '}';
+ ss << ", rtcp_event_observer: "
+ << (rtcp_event_observer ? "(rtcp_event_observer)" : "nullptr");
ss << '}';
return ss.str();
}
diff --git a/common_audio/third_party/spl_sqrt_floor/BUILD.gn b/common_audio/third_party/spl_sqrt_floor/BUILD.gn
index ac862c65a8..e66ed2796e 100644
--- a/common_audio/third_party/spl_sqrt_floor/BUILD.gn
+++ b/common_audio/third_party/spl_sqrt_floor/BUILD.gn
@@ -12,11 +12,11 @@ rtc_library("spl_sqrt_floor") {
visibility = [ "../..:common_audio_c" ]
sources = [ "spl_sqrt_floor.h" ]
deps = []
- if (current_cpu == "arm") {
+ if (target_cpu == "arm") {
sources += [ "spl_sqrt_floor_arm.S" ]
diff --git a/call/video_receive_stream.h b/call/video_receive_stream.h
index a1fc204e7c..01ac7e0ba4 100644
--- a/call/video_receive_stream.h
+++ b/call/video_receive_stream.h
@@ -20,6 +20,7 @@
#include <vector>
deps += [ "../../../rtc_base/system:asm_defines" ]
- } else if (current_cpu == "mipsel") {
+ } else if (target_cpu == "mipsel") {
sources += [ "spl_sqrt_floor_mips.c" ]
} else {
sources += [ "spl_sqrt_floor.c" ]
diff --git a/modules/audio_processing/aec3/BUILD.gn b/modules/audio_processing/aec3/BUILD.gn
index 3e11a245a1..c29b893b7d 100644
--- a/modules/audio_processing/aec3/BUILD.gn
+++ b/modules/audio_processing/aec3/BUILD.gn
@@ -123,7 +123,7 @@ rtc_library("aec3") {
]
#include "api/call/transport.h"
+#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "api/crypto/crypto_options.h"
#include "api/rtp_headers.h"
#include "api/rtp_parameters.h"
@@ -241,6 +242,8 @@ class VideoReceiveStreamInterface : public MediaReceiveStreamInterface {
// meta data is expected to be present in generic frame descriptor
// RTP header extension).
std::set<int> raw_payload_types;
+
+ RtcpEventObserver* rtcp_event_observer = nullptr;
} rtp;
defines = []
- if (rtc_build_with_neon && current_cpu != "arm64") {
+ if (rtc_build_with_neon && target_cpu != "arm64") {
suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
cflags = [ "-mfpu=neon" ]
// Transport for outgoing packets (RTCP).
diff --git a/modules/rtp_rtcp/include/rtp_rtcp_defines.h b/modules/rtp_rtcp/include/rtp_rtcp_defines.h
index 698f284fa5..982e5c57ef 100644
--- a/modules/rtp_rtcp/include/rtp_rtcp_defines.h
+++ b/modules/rtp_rtcp/include/rtp_rtcp_defines.h
@@ -173,6 +173,14 @@ class NetworkLinkRtcpObserver {
virtual void OnRttUpdate(Timestamp receive_time, TimeDelta rtt) {}
};
+class RtcpEventObserver {
+ public:
+ virtual void OnRtcpBye() = 0;
+ virtual void OnRtcpTimeout() = 0;
+
+ virtual ~RtcpEventObserver() {}
+};
+
// NOTE! `kNumMediaTypes` must be kept in sync with RtpPacketMediaType!
static constexpr size_t kNumMediaTypes = 5;
enum class RtpPacketMediaType : size_t {
diff --git a/modules/rtp_rtcp/source/rtcp_receiver.cc b/modules/rtp_rtcp/source/rtcp_receiver.cc
index a98b200c05..e2ad674012 100644
--- a/modules/rtp_rtcp/source/rtcp_receiver.cc
+++ b/modules/rtp_rtcp/source/rtcp_receiver.cc
@@ -144,6 +144,7 @@ RTCPReceiver::RTCPReceiver(const RtpRtcpInterface::Configuration& config,
rtp_rtcp_(owner),
registered_ssrcs_(false, config),
network_link_rtcp_observer_(config.network_link_rtcp_observer),
+ rtcp_event_observer_(config.rtcp_event_observer),
rtcp_intra_frame_observer_(config.intra_frame_callback),
rtcp_loss_notification_observer_(config.rtcp_loss_notification_observer),
network_state_estimate_observer_(config.network_state_estimate_observer),
@@ -171,6 +172,7 @@ RTCPReceiver::RTCPReceiver(const RtpRtcpInterface::Configuration& config,
rtp_rtcp_(owner),
registered_ssrcs_(true, config),
network_link_rtcp_observer_(config.network_link_rtcp_observer),
+ rtcp_event_observer_(config.rtcp_event_observer),
rtcp_intra_frame_observer_(config.intra_frame_callback),
rtcp_loss_notification_observer_(config.rtcp_loss_notification_observer),
network_state_estimate_observer_(config.network_state_estimate_observer),
@@ -778,6 +780,10 @@ bool RTCPReceiver::HandleBye(const CommonHeader& rtcp_block) {
return false;
}
@@ -162,7 +162,7 @@ rtc_library("aec3") {
"//third_party/abseil-cpp/absl/types:optional",
]
- if (current_cpu == "x86" || current_cpu == "x64") {
+ if (target_cpu == "x86" || target_cpu == "x64") {
deps += [ ":aec3_avx2" ]
}
}
@@ -253,7 +253,7 @@ rtc_source_set("fft_data") {
]
+ if (rtcp_event_observer_) {
+ rtcp_event_observer_->OnRtcpBye();
+ }
+
// Clear our lists.
rtts_.erase(bye.sender_ssrc());
EraseIf(received_report_blocks_, [&](const auto& elem) {
@@ -1199,12 +1205,20 @@ std::vector<rtcp::TmmbItem> RTCPReceiver::TmmbrReceived() {
}
-if (current_cpu == "x86" || current_cpu == "x64") {
+if (target_cpu == "x86" || target_cpu == "x64") {
rtc_library("aec3_avx2") {
configs += [ "..:apm_debug_dump" ]
sources = [
diff --git a/modules/audio_processing/aecm/BUILD.gn b/modules/audio_processing/aecm/BUILD.gn
index 80f2901049..a77f04aba5 100644
--- a/modules/audio_processing/aecm/BUILD.gn
+++ b/modules/audio_processing/aecm/BUILD.gn
@@ -29,14 +29,14 @@ rtc_library("aecm_core") {
if (rtc_build_with_neon) {
sources += [ "aecm_core_neon.cc" ]
bool RTCPReceiver::RtcpRrTimeoutLocked(Timestamp now) {
- return ResetTimestampIfExpired(now, last_received_rb_, report_interval_);
+ bool result = ResetTimestampIfExpired(now, last_received_rb_, report_interval_);
+ if (result && rtcp_event_observer_) {
+ rtcp_event_observer_->OnRtcpTimeout();
+ }
+ return result;
}
- if (current_cpu != "arm64") {
+ if (target_cpu != "arm64") {
# Enable compilation for the NEON instruction set.
suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
cflags += [ "-mfpu=neon" ]
}
}
bool RTCPReceiver::RtcpRrSequenceNumberTimeoutLocked(Timestamp now) {
- return ResetTimestampIfExpired(now, last_increased_sequence_number_,
+ bool result = ResetTimestampIfExpired(now, last_increased_sequence_number_,
report_interval_);
+ if (result && rtcp_event_observer_) {
+ rtcp_event_observer_->OnRtcpTimeout();
+ }
+ return result;
}
- if (current_cpu == "mipsel") {
+ if (target_cpu == "mipsel") {
sources += [ "aecm_core_mips.cc" ]
} else {
sources += [ "aecm_core_c.cc" ]
diff --git a/modules/audio_processing/agc/BUILD.gn b/modules/audio_processing/agc/BUILD.gn
index 508f901b08..75bef1450f 100644
--- a/modules/audio_processing/agc/BUILD.gn
+++ b/modules/audio_processing/agc/BUILD.gn
@@ -83,7 +83,7 @@ rtc_library("legacy_agc") {
]
} // namespace webrtc
diff --git a/modules/rtp_rtcp/source/rtcp_receiver.h b/modules/rtp_rtcp/source/rtcp_receiver.h
index e748b257e8..36e117af55 100644
--- a/modules/rtp_rtcp/source/rtcp_receiver.h
+++ b/modules/rtp_rtcp/source/rtcp_receiver.h
@@ -362,6 +362,7 @@ class RTCPReceiver final {
RegisteredSsrcs registered_ssrcs_;
if (rtc_build_with_neon) {
- if (current_cpu != "arm64") {
+ if (target_cpu != "arm64") {
# Enable compilation for the NEON instruction set.
suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
cflags = [ "-mfpu=neon" ]
diff --git a/modules/audio_processing/agc2/rnn_vad/BUILD.gn b/modules/audio_processing/agc2/rnn_vad/BUILD.gn
index 3003a585bd..d709eb3699 100644
--- a/modules/audio_processing/agc2/rnn_vad/BUILD.gn
+++ b/modules/audio_processing/agc2/rnn_vad/BUILD.gn
@@ -18,7 +18,7 @@ rtc_library("rnn_vad") {
]
NetworkLinkRtcpObserver* const network_link_rtcp_observer_;
+ RtcpEventObserver* const rtcp_event_observer_;
RtcpIntraFrameObserver* const rtcp_intra_frame_observer_;
RtcpLossNotificationObserver* const rtcp_loss_notification_observer_;
NetworkStateEstimateObserver* const network_state_estimate_observer_;
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_interface.h b/modules/rtp_rtcp/source/rtp_rtcp_interface.h
index dc86f92bf5..889b099abd 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_interface.h
+++ b/modules/rtp_rtcp/source/rtp_rtcp_interface.h
@@ -74,6 +74,9 @@ class RtpRtcpInterface : public RtcpFeedbackSenderInterface {
// bandwidth estimation related message.
NetworkLinkRtcpObserver* network_link_rtcp_observer = nullptr;
defines = []
- if (rtc_build_with_neon && current_cpu != "arm64") {
+ if (rtc_build_with_neon && target_cpu != "arm64") {
suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
cflags = [ "-mfpu=neon" ]
}
diff --git a/modules/audio_processing/ns/BUILD.gn b/modules/audio_processing/ns/BUILD.gn
index d818e23f3c..8c2e9dba84 100644
--- a/modules/audio_processing/ns/BUILD.gn
+++ b/modules/audio_processing/ns/BUILD.gn
@@ -43,7 +43,7 @@ rtc_static_library("ns") {
]
+ // Called when we receive a RTCP bye or timeout
+ RtcpEventObserver* rtcp_event_observer = nullptr;
+
NetworkStateEstimateObserver* network_state_estimate_observer = nullptr;
TransportFeedbackObserver* transport_feedback_callback = nullptr;
VideoBitrateAllocationObserver* bitrate_allocation_observer = nullptr;
diff --git a/video/rtp_video_stream_receiver2.cc b/video/rtp_video_stream_receiver2.cc
index ae5e329525..d756722978 100644
--- a/video/rtp_video_stream_receiver2.cc
+++ b/video/rtp_video_stream_receiver2.cc
@@ -83,7 +83,8 @@ std::unique_ptr<ModuleRtpRtcpImpl2> CreateRtpRtcpModule(
RtcpCnameCallback* rtcp_cname_callback,
bool non_sender_rtt_measurement,
uint32_t local_ssrc,
- RtcEventLog* rtc_event_log) {
+ RtcEventLog* rtc_event_log,
+ RtcpEventObserver* rtcp_event_observer) {
RtpRtcpInterface::Configuration configuration;
configuration.clock = clock;
configuration.audio = false;
@@ -95,6 +96,7 @@ std::unique_ptr<ModuleRtpRtcpImpl2> CreateRtpRtcpModule(
rtcp_packet_type_counter_observer;
configuration.rtcp_cname_callback = rtcp_cname_callback;
configuration.local_media_ssrc = local_ssrc;
+ configuration.rtcp_event_observer = rtcp_event_observer;
configuration.non_sender_rtt_measurement = non_sender_rtt_measurement;
configuration.event_log = rtc_event_log;
defines = []
- if (rtc_build_with_neon && current_cpu != "arm64") {
+ if (rtc_build_with_neon && target_cpu != "arm64") {
suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
cflags = [ "-mfpu=neon" ]
}
diff --git a/modules/desktop_capture/BUILD.gn b/modules/desktop_capture/BUILD.gn
index 344c8a1531..dcc1b3c6ac 100644
--- a/modules/desktop_capture/BUILD.gn
+++ b/modules/desktop_capture/BUILD.gn
@@ -10,7 +10,7 @@ import("//build/config/linux/gtk/gtk.gni")
import("//build/config/ui.gni")
import("../../webrtc.gni")
-use_desktop_capture_differ_sse2 = current_cpu == "x86" || current_cpu == "x64"
+use_desktop_capture_differ_sse2 = target_cpu == "x86" || target_cpu == "x64"
config("x11_config") {
if (rtc_use_x11_extensions) {
diff --git a/webrtc.gni b/webrtc.gni
index ff01196517..ae2a2b6f3c 100644
--- a/webrtc.gni
+++ b/webrtc.gni
@@ -175,13 +175,13 @@ declare_args() {
# Selects fixed-point code where possible.
rtc_prefer_fixed_point = false
- if (current_cpu == "arm" || current_cpu == "arm64") {
+ if (target_cpu == "arm" || target_cpu == "arm64") {
rtc_prefer_fixed_point = true
}
# Determines whether NEON code will be built.
rtc_build_with_neon =
- (current_cpu == "arm" && arm_use_neon) || current_cpu == "arm64"
+ (target_cpu == "arm" && arm_use_neon) || target_cpu == "arm64"
# Enable this to build OpenH264 encoder/FFmpeg decoder. This is supported on
# all platforms except Android and iOS. Because FFmpeg can be built
@@ -275,7 +277,8 @@ RtpVideoStreamReceiver2::RtpVideoStreamReceiver2(
rtcp_cname_callback,
config_.rtp.rtcp_xr.receiver_reference_time_report,
config_.rtp.local_ssrc,
- event_log)),
+ event_log,
+ config_.rtp.rtcp_event_observer)),
nack_periodic_processor_(nack_periodic_processor),
complete_frame_callback_(complete_frame_callback),
keyframe_request_method_(config_.rtp.keyframe_method),

Просмотреть файл

@ -1,302 +1,29 @@
From: "Byron Campen [:bwc]" <docfaraday@gmail.com>
Date: Fri, 19 Feb 2021 15:56:00 -0600
Subject: Bug 1654112 - Get RTCP BYE and RTP timeout handling working again
(from Bug 1595479) r=mjf,dminor
Date: Fri, 12 Mar 2021 08:53:00 -0600
Subject: Bug 1654112 - libwebrtc modification: Init some stats that were being
passed to us uninitialized. r=ng
Differential Revision: https://phabricator.services.mozilla.com/D106145
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/d0b311007c033e83824f5f6996a70ab9e870f31f
Differential Revision: https://phabricator.services.mozilla.com/D108673
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/c385bb870413b925af48df97aa1f2b80a26e78d2
---
audio/audio_receive_stream.cc | 5 ++++-
audio/channel_receive.cc | 13 +++++++++----
audio/channel_receive.h | 4 +++-
call/audio_receive_stream.h | 3 +++
call/video_receive_stream.cc | 2 ++
call/video_receive_stream.h | 3 +++
modules/rtp_rtcp/include/rtp_rtcp_defines.h | 8 ++++++++
modules/rtp_rtcp/source/rtcp_receiver.cc | 18 ++++++++++++++++--
modules/rtp_rtcp/source/rtcp_receiver.h | 1 +
modules/rtp_rtcp/source/rtp_rtcp_interface.h | 3 +++
video/rtp_video_stream_receiver2.cc | 7 +++++--
11 files changed, 57 insertions(+), 10 deletions(-)
call/video_receive_stream.h | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/audio/audio_receive_stream.cc b/audio/audio_receive_stream.cc
index 978bbb25b2..655b2761ac 100644
--- a/audio/audio_receive_stream.cc
+++ b/audio/audio_receive_stream.cc
@@ -39,6 +39,8 @@ std::string AudioReceiveStreamInterface::Config::Rtp::ToString() const {
ss << "{remote_ssrc: " << remote_ssrc;
ss << ", local_ssrc: " << local_ssrc;
ss << ", nack: " << nack.ToString();
+ ss << ", rtcp_event_observer: "
+ << (rtcp_event_observer ? "(rtcp_event_observer)" : "nullptr");
ss << '}';
return ss.str();
}
@@ -73,7 +75,8 @@ std::unique_ptr<voe::ChannelReceiveInterface> CreateChannelReceive(
config.jitter_buffer_fast_accelerate, config.jitter_buffer_min_delay_ms,
config.enable_non_sender_rtt, config.decoder_factory,
config.codec_pair_id, std::move(config.frame_decryptor),
- config.crypto_options, std::move(config.frame_transformer));
+ config.crypto_options, std::move(config.frame_transformer),
+ config.rtp.rtcp_event_observer);
}
} // namespace
diff --git a/audio/channel_receive.cc b/audio/channel_receive.cc
index 270ba61ed5..b3aac7a1fb 100644
--- a/audio/channel_receive.cc
+++ b/audio/channel_receive.cc
@@ -104,7 +104,8 @@ class ChannelReceive : public ChannelReceiveInterface,
absl::optional<AudioCodecPairId> codec_pair_id,
rtc::scoped_refptr<FrameDecryptorInterface> frame_decryptor,
const webrtc::CryptoOptions& crypto_options,
- rtc::scoped_refptr<FrameTransformerInterface> frame_transformer);
+ rtc::scoped_refptr<FrameTransformerInterface> frame_transformer,
+ RtcpEventObserver* rtcp_event_observer);
~ChannelReceive() override;
void SetSink(AudioSinkInterface* sink) override;
@@ -544,7 +545,8 @@ ChannelReceive::ChannelReceive(
absl::optional<AudioCodecPairId> codec_pair_id,
rtc::scoped_refptr<FrameDecryptorInterface> frame_decryptor,
const webrtc::CryptoOptions& crypto_options,
- rtc::scoped_refptr<FrameTransformerInterface> frame_transformer)
+ rtc::scoped_refptr<FrameTransformerInterface> frame_transformer,
+ RtcpEventObserver* rtcp_event_observer)
: worker_thread_(TaskQueueBase::Current()),
event_log_(rtc_event_log),
rtp_receive_statistics_(ReceiveStatistics::Create(clock)),
@@ -590,6 +592,7 @@ ChannelReceive::ChannelReceive(
configuration.local_media_ssrc = local_ssrc;
configuration.rtcp_packet_type_counter_observer = this;
configuration.non_sender_rtt_measurement = enable_non_sender_rtt;
+ configuration.rtcp_event_observer = rtcp_event_observer;
if (frame_transformer)
InitFrameTransformerDelegate(std::move(frame_transformer));
@@ -1117,13 +1120,15 @@ std::unique_ptr<ChannelReceiveInterface> CreateChannelReceive(
absl::optional<AudioCodecPairId> codec_pair_id,
rtc::scoped_refptr<FrameDecryptorInterface> frame_decryptor,
const webrtc::CryptoOptions& crypto_options,
- rtc::scoped_refptr<FrameTransformerInterface> frame_transformer) {
+ rtc::scoped_refptr<FrameTransformerInterface> frame_transformer,
+ RtcpEventObserver* rtcp_event_observer) {
return std::make_unique<ChannelReceive>(
clock, neteq_factory, audio_device_module, rtcp_send_transport,
rtc_event_log, local_ssrc, remote_ssrc, jitter_buffer_max_packets,
jitter_buffer_fast_playout, jitter_buffer_min_delay_ms,
enable_non_sender_rtt, decoder_factory, codec_pair_id,
- std::move(frame_decryptor), crypto_options, std::move(frame_transformer));
+ std::move(frame_decryptor), crypto_options, std::move(frame_transformer),
+ rtcp_event_observer);
}
} // namespace voe
diff --git a/audio/channel_receive.h b/audio/channel_receive.h
index ab69103269..5713d97aaa 100644
--- a/audio/channel_receive.h
+++ b/audio/channel_receive.h
@@ -28,6 +28,7 @@
#include "call/rtp_packet_sink_interface.h"
#include "call/syncable.h"
#include "modules/audio_coding/include/audio_coding_module_typedefs.h"
+#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "modules/rtp_rtcp/source/source_tracker.h"
#include "system_wrappers/include/clock.h"
@@ -186,7 +187,8 @@ std::unique_ptr<ChannelReceiveInterface> CreateChannelReceive(
absl::optional<AudioCodecPairId> codec_pair_id,
rtc::scoped_refptr<FrameDecryptorInterface> frame_decryptor,
const webrtc::CryptoOptions& crypto_options,
- rtc::scoped_refptr<FrameTransformerInterface> frame_transformer);
+ rtc::scoped_refptr<FrameTransformerInterface> frame_transformer,
+ RtcpEventObserver* rtcp_event_observer);
} // namespace voe
} // namespace webrtc
diff --git a/call/audio_receive_stream.h b/call/audio_receive_stream.h
index 4879311fdb..88b74b44ac 100644
--- a/call/audio_receive_stream.h
+++ b/call/audio_receive_stream.h
@@ -19,6 +19,7 @@
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_decoder_factory.h"
#include "api/call/transport.h"
+#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "api/crypto/crypto_options.h"
#include "api/rtp_parameters.h"
#include "call/receive_stream.h"
@@ -117,6 +118,8 @@ class AudioReceiveStreamInterface : public MediaReceiveStreamInterface {
// See NackConfig for description.
NackConfig nack;
+
+ RtcpEventObserver* rtcp_event_observer = nullptr;
} rtp;
// Receive-side RTT.
diff --git a/call/video_receive_stream.cc b/call/video_receive_stream.cc
index 3e2a51322f..46015cb0c7 100644
--- a/call/video_receive_stream.cc
+++ b/call/video_receive_stream.cc
@@ -161,6 +161,8 @@ std::string VideoReceiveStreamInterface::Config::Rtp::ToString() const {
ss << pt << ", ";
}
ss << '}';
+ ss << ", rtcp_event_observer: "
+ << (rtcp_event_observer ? "(rtcp_event_observer)" : "nullptr");
ss << '}';
return ss.str();
}
diff --git a/call/video_receive_stream.h b/call/video_receive_stream.h
index a1fc204e7c..01ac7e0ba4 100644
index 01ac7e0ba4..01fb08a009 100644
--- a/call/video_receive_stream.h
+++ b/call/video_receive_stream.h
@@ -20,6 +20,7 @@
#include <vector>
@@ -152,9 +152,10 @@ class VideoReceiveStreamInterface : public MediaReceiveStreamInterface {
RtcpPacketTypeCounter rtcp_packet_type_counts;
absl::optional<RtpReceiveStats> rtx_rtp_stats;
#include "api/call/transport.h"
+#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "api/crypto/crypto_options.h"
#include "api/rtp_headers.h"
#include "api/rtp_parameters.h"
@@ -241,6 +242,8 @@ class VideoReceiveStreamInterface : public MediaReceiveStreamInterface {
// meta data is expected to be present in generic frame descriptor
// RTP header extension).
std::set<int> raw_payload_types;
+
+ RtcpEventObserver* rtcp_event_observer = nullptr;
} rtp;
- uint32_t rtcp_sender_packets_sent;
- uint32_t rtcp_sender_octets_sent;
- int64_t rtcp_sender_ntp_timestamp_ms;
+ // Mozilla modification: Init these three.
+ uint32_t rtcp_sender_packets_sent = 0;
+ uint32_t rtcp_sender_octets_sent = 0;
+ int64_t rtcp_sender_ntp_timestamp_ms = 0;
// Transport for outgoing packets (RTCP).
diff --git a/modules/rtp_rtcp/include/rtp_rtcp_defines.h b/modules/rtp_rtcp/include/rtp_rtcp_defines.h
index 698f284fa5..982e5c57ef 100644
--- a/modules/rtp_rtcp/include/rtp_rtcp_defines.h
+++ b/modules/rtp_rtcp/include/rtp_rtcp_defines.h
@@ -173,6 +173,14 @@ class NetworkLinkRtcpObserver {
virtual void OnRttUpdate(Timestamp receive_time, TimeDelta rtt) {}
};
+class RtcpEventObserver {
+ public:
+ virtual void OnRtcpBye() = 0;
+ virtual void OnRtcpTimeout() = 0;
+
+ virtual ~RtcpEventObserver() {}
+};
+
// NOTE! `kNumMediaTypes` must be kept in sync with RtpPacketMediaType!
static constexpr size_t kNumMediaTypes = 5;
enum class RtpPacketMediaType : size_t {
diff --git a/modules/rtp_rtcp/source/rtcp_receiver.cc b/modules/rtp_rtcp/source/rtcp_receiver.cc
index a98b200c05..e2ad674012 100644
--- a/modules/rtp_rtcp/source/rtcp_receiver.cc
+++ b/modules/rtp_rtcp/source/rtcp_receiver.cc
@@ -144,6 +144,7 @@ RTCPReceiver::RTCPReceiver(const RtpRtcpInterface::Configuration& config,
rtp_rtcp_(owner),
registered_ssrcs_(false, config),
network_link_rtcp_observer_(config.network_link_rtcp_observer),
+ rtcp_event_observer_(config.rtcp_event_observer),
rtcp_intra_frame_observer_(config.intra_frame_callback),
rtcp_loss_notification_observer_(config.rtcp_loss_notification_observer),
network_state_estimate_observer_(config.network_state_estimate_observer),
@@ -171,6 +172,7 @@ RTCPReceiver::RTCPReceiver(const RtpRtcpInterface::Configuration& config,
rtp_rtcp_(owner),
registered_ssrcs_(true, config),
network_link_rtcp_observer_(config.network_link_rtcp_observer),
+ rtcp_event_observer_(config.rtcp_event_observer),
rtcp_intra_frame_observer_(config.intra_frame_callback),
rtcp_loss_notification_observer_(config.rtcp_loss_notification_observer),
network_state_estimate_observer_(config.network_state_estimate_observer),
@@ -778,6 +780,10 @@ bool RTCPReceiver::HandleBye(const CommonHeader& rtcp_block) {
return false;
}
+ if (rtcp_event_observer_) {
+ rtcp_event_observer_->OnRtcpBye();
+ }
+
// Clear our lists.
rtts_.erase(bye.sender_ssrc());
EraseIf(received_report_blocks_, [&](const auto& elem) {
@@ -1199,12 +1205,20 @@ std::vector<rtcp::TmmbItem> RTCPReceiver::TmmbrReceived() {
}
bool RTCPReceiver::RtcpRrTimeoutLocked(Timestamp now) {
- return ResetTimestampIfExpired(now, last_received_rb_, report_interval_);
+ bool result = ResetTimestampIfExpired(now, last_received_rb_, report_interval_);
+ if (result && rtcp_event_observer_) {
+ rtcp_event_observer_->OnRtcpTimeout();
+ }
+ return result;
}
bool RTCPReceiver::RtcpRrSequenceNumberTimeoutLocked(Timestamp now) {
- return ResetTimestampIfExpired(now, last_increased_sequence_number_,
+ bool result = ResetTimestampIfExpired(now, last_increased_sequence_number_,
report_interval_);
+ if (result && rtcp_event_observer_) {
+ rtcp_event_observer_->OnRtcpTimeout();
+ }
+ return result;
}
} // namespace webrtc
diff --git a/modules/rtp_rtcp/source/rtcp_receiver.h b/modules/rtp_rtcp/source/rtcp_receiver.h
index e748b257e8..36e117af55 100644
--- a/modules/rtp_rtcp/source/rtcp_receiver.h
+++ b/modules/rtp_rtcp/source/rtcp_receiver.h
@@ -362,6 +362,7 @@ class RTCPReceiver final {
RegisteredSsrcs registered_ssrcs_;
NetworkLinkRtcpObserver* const network_link_rtcp_observer_;
+ RtcpEventObserver* const rtcp_event_observer_;
RtcpIntraFrameObserver* const rtcp_intra_frame_observer_;
RtcpLossNotificationObserver* const rtcp_loss_notification_observer_;
NetworkStateEstimateObserver* const network_state_estimate_observer_;
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_interface.h b/modules/rtp_rtcp/source/rtp_rtcp_interface.h
index dc86f92bf5..889b099abd 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_interface.h
+++ b/modules/rtp_rtcp/source/rtp_rtcp_interface.h
@@ -74,6 +74,9 @@ class RtpRtcpInterface : public RtcpFeedbackSenderInterface {
// bandwidth estimation related message.
NetworkLinkRtcpObserver* network_link_rtcp_observer = nullptr;
+ // Called when we receive a RTCP bye or timeout
+ RtcpEventObserver* rtcp_event_observer = nullptr;
+
NetworkStateEstimateObserver* network_state_estimate_observer = nullptr;
TransportFeedbackObserver* transport_feedback_callback = nullptr;
VideoBitrateAllocationObserver* bitrate_allocation_observer = nullptr;
diff --git a/video/rtp_video_stream_receiver2.cc b/video/rtp_video_stream_receiver2.cc
index ae5e329525..d756722978 100644
--- a/video/rtp_video_stream_receiver2.cc
+++ b/video/rtp_video_stream_receiver2.cc
@@ -83,7 +83,8 @@ std::unique_ptr<ModuleRtpRtcpImpl2> CreateRtpRtcpModule(
RtcpCnameCallback* rtcp_cname_callback,
bool non_sender_rtt_measurement,
uint32_t local_ssrc,
- RtcEventLog* rtc_event_log) {
+ RtcEventLog* rtc_event_log,
+ RtcpEventObserver* rtcp_event_observer) {
RtpRtcpInterface::Configuration configuration;
configuration.clock = clock;
configuration.audio = false;
@@ -95,6 +96,7 @@ std::unique_ptr<ModuleRtpRtcpImpl2> CreateRtpRtcpModule(
rtcp_packet_type_counter_observer;
configuration.rtcp_cname_callback = rtcp_cname_callback;
configuration.local_media_ssrc = local_ssrc;
+ configuration.rtcp_event_observer = rtcp_event_observer;
configuration.non_sender_rtt_measurement = non_sender_rtt_measurement;
configuration.event_log = rtc_event_log;
@@ -275,7 +277,8 @@ RtpVideoStreamReceiver2::RtpVideoStreamReceiver2(
rtcp_cname_callback,
config_.rtp.rtcp_xr.receiver_reference_time_report,
config_.rtp.local_ssrc,
- event_log)),
+ event_log,
+ config_.rtp.rtcp_event_observer)),
nack_periodic_processor_(nack_periodic_processor),
complete_frame_callback_(complete_frame_callback),
keyframe_request_method_(config_.rtp.keyframe_method),
// Timing frame info: all important timestamps for a full lifetime of a
// single 'timing frame'.

Просмотреть файл

@ -1,29 +1,73 @@
From: "Byron Campen [:bwc]" <docfaraday@gmail.com>
Date: Fri, 12 Mar 2021 08:53:00 -0600
Subject: Bug 1654112 - libwebrtc modification: Init some stats that were being
passed to us uninitialized. r=ng
Date: Fri, 12 Mar 2021 08:55:00 -0600
Subject: Bug 1654112 - libwebrtc modification: Surface video RTCP SR stats
again. r=ng
Differential Revision: https://phabricator.services.mozilla.com/D108673
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/c385bb870413b925af48df97aa1f2b80a26e78d2
libwebrtc has stopped surfacing these, and Chromium does not support
these stats at all.
Differential Revision: https://phabricator.services.mozilla.com/D108674
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/edac9d01a9ac7594f4b22708a4690753638ca32c
---
call/video_receive_stream.h | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
video/rtp_video_stream_receiver2.cc | 10 ++++++++++
video/rtp_video_stream_receiver2.h | 6 ++++++
video/video_receive_stream2.cc | 8 ++++++++
3 files changed, 24 insertions(+)
diff --git a/call/video_receive_stream.h b/call/video_receive_stream.h
index 01ac7e0ba4..01fb08a009 100644
--- a/call/video_receive_stream.h
+++ b/call/video_receive_stream.h
@@ -152,9 +152,10 @@ class VideoReceiveStreamInterface : public MediaReceiveStreamInterface {
RtcpPacketTypeCounter rtcp_packet_type_counts;
absl::optional<RtpReceiveStats> rtx_rtp_stats;
diff --git a/video/rtp_video_stream_receiver2.cc b/video/rtp_video_stream_receiver2.cc
index d756722978..b3d4d8a05d 100644
--- a/video/rtp_video_stream_receiver2.cc
+++ b/video/rtp_video_stream_receiver2.cc
@@ -1060,6 +1060,16 @@ absl::optional<int64_t> RtpVideoStreamReceiver2::LastReceivedKeyframePacketMs()
return absl::nullopt;
}
- uint32_t rtcp_sender_packets_sent;
- uint32_t rtcp_sender_octets_sent;
- int64_t rtcp_sender_ntp_timestamp_ms;
+ // Mozilla modification: Init these three.
+ uint32_t rtcp_sender_packets_sent = 0;
+ uint32_t rtcp_sender_octets_sent = 0;
+ int64_t rtcp_sender_ntp_timestamp_ms = 0;
+// Mozilla modification: VideoReceiveStream2 and friends do not surface RTCP
+// stats at all, and even on the most recent libwebrtc code there does not
+// seem to be any support for these stats right now. So, we hack this in.
+void RtpVideoStreamReceiver2::RemoteRTCPSenderInfo(
+ uint32_t* packet_count, uint32_t* octet_count,
+ int64_t* ntp_timestamp_ms) const {
+ RTC_DCHECK_RUN_ON(&worker_task_checker_);
+ rtp_rtcp_->RemoteRTCPSenderInfo(packet_count, octet_count, ntp_timestamp_ms);
+}
+
void RtpVideoStreamReceiver2::ManageFrame(
std::unique_ptr<RtpFrameObject> frame) {
RTC_DCHECK_RUN_ON(&packet_sequence_checker_);
diff --git a/video/rtp_video_stream_receiver2.h b/video/rtp_video_stream_receiver2.h
index 0178355262..be8bce770f 100644
--- a/video/rtp_video_stream_receiver2.h
+++ b/video/rtp_video_stream_receiver2.h
@@ -207,6 +207,12 @@ class RtpVideoStreamReceiver2 : public LossNotificationSender,
absl::optional<uint32_t> LastReceivedFrameRtpTimestamp() const;
absl::optional<int64_t> LastReceivedKeyframePacketMs() const;
+ // Mozilla modification: VideoReceiveStream2 and friends do not surface RTCP
+ // stats at all, and even on the most recent libwebrtc code there does not
+ // seem to be any support for these stats right now. So, we hack this in.
+ void RemoteRTCPSenderInfo(uint32_t* packet_count, uint32_t* octet_count,
+ int64_t* ntp_timestamp_ms) const;
+
private:
// Implements RtpVideoFrameReceiver.
void ManageFrame(std::unique_ptr<RtpFrameObject> frame) override;
diff --git a/video/video_receive_stream2.cc b/video/video_receive_stream2.cc
index 6c1df7d874..f50c3d0775 100644
--- a/video/video_receive_stream2.cc
+++ b/video/video_receive_stream2.cc
@@ -573,6 +573,14 @@ VideoReceiveStreamInterface::Stats VideoReceiveStream2::GetStats() const {
}
}
}
+
+ // Mozilla modification: VideoReceiveStream2 and friends do not surface RTCP
+ // stats at all, and even on the most recent libwebrtc code there does not
+ // seem to be any support for these stats right now. So, we hack this in.
+ rtp_video_stream_receiver_.RemoteRTCPSenderInfo(
+ &stats.rtcp_sender_packets_sent, &stats.rtcp_sender_octets_sent,
+ &stats.rtcp_sender_ntp_timestamp_ms);
+
return stats;
}
// Timing frame info: all important timestamps for a full lifetime of a
// single 'timing frame'.

Просмотреть файл

@ -1,73 +1,35 @@
From: "Byron Campen [:bwc]" <docfaraday@gmail.com>
Date: Fri, 12 Mar 2021 08:55:00 -0600
Subject: Bug 1654112 - libwebrtc modification: Surface video RTCP SR stats
again. r=ng
From: Nico Grunbaum <na-g@nostrum.com>
Date: Mon, 26 Jul 2021 22:51:00 -0700
Subject: Bug 1654112 - fix timestamp issues with RTP sources; r=mjf
libwebrtc has stopped surfacing these, and Chromium does not support
these stats at all.
Differential Revision: https://phabricator.services.mozilla.com/D108674
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/edac9d01a9ac7594f4b22708a4690753638ca32c
Differential Revision: https://phabricator.services.mozilla.com/D120930
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/de8c14e4972f717bf937b6f2fffcd08c35e21ced
---
video/rtp_video_stream_receiver2.cc | 10 ++++++++++
video/rtp_video_stream_receiver2.h | 6 ++++++
video/video_receive_stream2.cc | 8 ++++++++
3 files changed, 24 insertions(+)
modules/rtp_rtcp/source/source_tracker.cc | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/video/rtp_video_stream_receiver2.cc b/video/rtp_video_stream_receiver2.cc
index d756722978..b3d4d8a05d 100644
--- a/video/rtp_video_stream_receiver2.cc
+++ b/video/rtp_video_stream_receiver2.cc
@@ -1060,6 +1060,16 @@ absl::optional<int64_t> RtpVideoStreamReceiver2::LastReceivedKeyframePacketMs()
return absl::nullopt;
}
diff --git a/modules/rtp_rtcp/source/source_tracker.cc b/modules/rtp_rtcp/source/source_tracker.cc
index 51e8f1cd38..7dfe2b71c5 100644
--- a/modules/rtp_rtcp/source/source_tracker.cc
+++ b/modules/rtp_rtcp/source/source_tracker.cc
@@ -47,7 +47,8 @@ void SourceTracker::OnFrameDeliveredInternal(
SourceKey key(RtpSourceType::CSRC, csrc);
SourceEntry& entry = UpdateEntry(key);
+// Mozilla modification: VideoReceiveStream2 and friends do not surface RTCP
+// stats at all, and even on the most recent libwebrtc code there does not
+// seem to be any support for these stats right now. So, we hack this in.
+void RtpVideoStreamReceiver2::RemoteRTCPSenderInfo(
+ uint32_t* packet_count, uint32_t* octet_count,
+ int64_t* ntp_timestamp_ms) const {
+ RTC_DCHECK_RUN_ON(&worker_task_checker_);
+ rtp_rtcp_->RemoteRTCPSenderInfo(packet_count, octet_count, ntp_timestamp_ms);
+}
+
void RtpVideoStreamReceiver2::ManageFrame(
std::unique_ptr<RtpFrameObject> frame) {
RTC_DCHECK_RUN_ON(&packet_sequence_checker_);
diff --git a/video/rtp_video_stream_receiver2.h b/video/rtp_video_stream_receiver2.h
index 0178355262..be8bce770f 100644
--- a/video/rtp_video_stream_receiver2.h
+++ b/video/rtp_video_stream_receiver2.h
@@ -207,6 +207,12 @@ class RtpVideoStreamReceiver2 : public LossNotificationSender,
absl::optional<uint32_t> LastReceivedFrameRtpTimestamp() const;
absl::optional<int64_t> LastReceivedKeyframePacketMs() const;
+ // Mozilla modification: VideoReceiveStream2 and friends do not surface RTCP
+ // stats at all, and even on the most recent libwebrtc code there does not
+ // seem to be any support for these stats right now. So, we hack this in.
+ void RemoteRTCPSenderInfo(uint32_t* packet_count, uint32_t* octet_count,
+ int64_t* ntp_timestamp_ms) const;
+
private:
// Implements RtpVideoFrameReceiver.
void ManageFrame(std::unique_ptr<RtpFrameObject> frame) override;
diff --git a/video/video_receive_stream2.cc b/video/video_receive_stream2.cc
index 6c1df7d874..f50c3d0775 100644
--- a/video/video_receive_stream2.cc
+++ b/video/video_receive_stream2.cc
@@ -573,6 +573,14 @@ VideoReceiveStreamInterface::Stats VideoReceiveStream2::GetStats() const {
}
}
- entry.timestamp = now;
+ const auto packet_time = packet_info.receive_time();
+ entry.timestamp = packet_time.ms() ? packet_time : now;
entry.audio_level = packet_info.audio_level();
entry.absolute_capture_time = packet_info.absolute_capture_time();
entry.local_capture_clock_offset =
@@ -86,6 +87,10 @@ std::vector<RtpSource> SourceTracker::GetSources() const {
.local_capture_clock_offset = entry.local_capture_clock_offset});
}
+ std::sort(sources.begin(), sources.end(), [](const auto &a, const auto &b){
+ return a.timestamp_ms() > b.timestamp_ms();
+ });
+
+ // Mozilla modification: VideoReceiveStream2 and friends do not surface RTCP
+ // stats at all, and even on the most recent libwebrtc code there does not
+ // seem to be any support for these stats right now. So, we hack this in.
+ rtp_video_stream_receiver_.RemoteRTCPSenderInfo(
+ &stats.rtcp_sender_packets_sent, &stats.rtcp_sender_octets_sent,
+ &stats.rtcp_sender_ntp_timestamp_ms);
+
return stats;
return sources;
}

Просмотреть файл

@ -1,35 +1,29 @@
From: Nico Grunbaum <na-g@nostrum.com>
Date: Mon, 26 Jul 2021 22:51:00 -0700
Subject: Bug 1654112 - fix timestamp issues with RTP sources; r=mjf
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Fri, 20 Aug 2021 13:52:00 +0200
Subject: Bug 1654112 - Don't check the calling thread in
webrtc::AudioReceiveStream::GetSources. r=ng
Differential Revision: https://phabricator.services.mozilla.com/D120930
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/de8c14e4972f717bf937b6f2fffcd08c35e21ced
source_tracker_ is thread safe with its own internal mutex, so this call is safe
as long as the caller has a guarantee for the lifetime of the
AudioReceiveStream. This is similar to webrtc::VideoReceiveStream.
Upliftable.
Differential Revision: https://phabricator.services.mozilla.com/D123226
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/c186df8a088e46285a15e40149182daa34cc6805
---
modules/rtp_rtcp/source/source_tracker.cc | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
audio/audio_receive_stream.cc | 1 -
1 file changed, 1 deletion(-)
diff --git a/modules/rtp_rtcp/source/source_tracker.cc b/modules/rtp_rtcp/source/source_tracker.cc
index 51e8f1cd38..7dfe2b71c5 100644
--- a/modules/rtp_rtcp/source/source_tracker.cc
+++ b/modules/rtp_rtcp/source/source_tracker.cc
@@ -47,7 +47,8 @@ void SourceTracker::OnFrameDeliveredInternal(
SourceKey key(RtpSourceType::CSRC, csrc);
SourceEntry& entry = UpdateEntry(key);
- entry.timestamp = now;
+ const auto packet_time = packet_info.receive_time();
+ entry.timestamp = packet_time.ms() ? packet_time : now;
entry.audio_level = packet_info.audio_level();
entry.absolute_capture_time = packet_info.absolute_capture_time();
entry.local_capture_clock_offset =
@@ -86,6 +87,10 @@ std::vector<RtpSource> SourceTracker::GetSources() const {
.local_capture_clock_offset = entry.local_capture_clock_offset});
}
+ std::sort(sources.begin(), sources.end(), [](const auto &a, const auto &b){
+ return a.timestamp_ms() > b.timestamp_ms();
+ });
+
return sources;
diff --git a/audio/audio_receive_stream.cc b/audio/audio_receive_stream.cc
index 655b2761ac..c49b83f95f 100644
--- a/audio/audio_receive_stream.cc
+++ b/audio/audio_receive_stream.cc
@@ -366,7 +366,6 @@ int AudioReceiveStreamImpl::GetBaseMinimumPlayoutDelayMs() const {
}
std::vector<RtpSource> AudioReceiveStreamImpl::GetSources() const {
- RTC_DCHECK_RUN_ON(&worker_thread_checker_);
return source_tracker_.GetSources();
}

1093
third_party/libwebrtc/moz-patch-stack/0047.patch поставляемый

Разница между файлами не показана из-за своего большого размера Загрузить разницу

1091
third_party/libwebrtc/moz-patch-stack/0048.patch поставляемый

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,27 +1,26 @@
From: Nico Grunbaum <na-g@nostrum.com>
Date: Thu, 28 Oct 2021 18:13:00 +0000
Subject: Bug 1729367 - P6 - Restore PID recording post cherry-pick;r=mjf
Subject: Bug 1729367 - P7 - restore mac PID tracking using new API;r=mjf
a=webrtc-update
This restores the code from P0, which was removed to make cherry-picking 439ffe462a66ad9fa9a251b265e4ab28c2647d25 and 449a78b1e20ea85b11f967cf3a184ee610ce21c3 easier.
Differential Revision: https://phabricator.services.mozilla.com/D129714
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/72a83cb2e571023cd4150bbdef5be5455ce851f4
Differential Revision: https://phabricator.services.mozilla.com/D129721
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/1495ca5ef535f8ad692a3a579ca42eddc14f39a8
---
modules/desktop_capture/win/window_capture_utils.cc | 4 ++++
1 file changed, 4 insertions(+)
modules/desktop_capture/window_capturer_mac.mm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/modules/desktop_capture/win/window_capture_utils.cc b/modules/desktop_capture/win/window_capture_utils.cc
index ccfef49bc5..d58c02e17c 100644
--- a/modules/desktop_capture/win/window_capture_utils.cc
+++ b/modules/desktop_capture/win/window_capture_utils.cc
@@ -79,6 +79,10 @@ BOOL CALLBACK GetWindowListHandler(HWND hwnd, LPARAM param) {
DesktopCapturer::Source window;
window.id = reinterpret_cast<WindowId>(hwnd);
+ DWORD pid;
+ GetWindowThreadProcessId(hwnd, &pid);
+ window.pid = static_cast<pid_t>(pid);
+
// GetWindowText* are potentially blocking operations if `hwnd` is
// owned by the current process. The APIs will send messages to the window's
// message loop, and if the message loop is waiting on this operation we will
diff --git a/modules/desktop_capture/window_capturer_mac.mm b/modules/desktop_capture/window_capturer_mac.mm
index f99b4a74d1..10f6a74650 100644
--- a/modules/desktop_capture/window_capturer_mac.mm
+++ b/modules/desktop_capture/window_capturer_mac.mm
@@ -170,8 +170,9 @@ void WindowCapturerMac::CaptureFrame() {
return webrtc::GetWindowList(
[sources](CFDictionaryRef window) {
WindowId window_id = GetWindowId(window);
+ int pid = GetWindowOwnerPid(window);
if (window_id != kNullWindowId) {
- sources->push_back(DesktopCapturer::Source{window_id, GetWindowTitle(window)});
+ sources->push_back(DesktopCapturer::Source{window_id, pid, GetWindowTitle(window)});
}
return true;
},

Просмотреть файл

@ -1,26 +1,205 @@
From: Nico Grunbaum <na-g@nostrum.com>
Date: Thu, 28 Oct 2021 18:13:00 +0000
Subject: Bug 1729367 - P7 - restore mac PID tracking using new API;r=mjf
a=webrtc-update
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Tue, 2 Nov 2021 14:35:00 +0000
Subject: Bug 1729455 - Add to stats the local receive time for receiving video
Sender Reports. r=ng
Differential Revision: https://phabricator.services.mozilla.com/D129721
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/1495ca5ef535f8ad692a3a579ca42eddc14f39a8
Differential Revision: https://phabricator.services.mozilla.com/D125712
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/99267b6d193fbcb3e4c845c5e80770424d6d06e2
---
modules/desktop_capture/window_capturer_mac.mm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
call/video_receive_stream.h | 3 ++-
modules/rtp_rtcp/source/rtcp_receiver.cc | 6 ++++--
modules/rtp_rtcp/source/rtcp_receiver.h | 3 ++-
modules/rtp_rtcp/source/rtp_rtcp_impl.cc | 10 +++++-----
modules/rtp_rtcp/source/rtp_rtcp_impl.h | 3 ++-
modules/rtp_rtcp/source/rtp_rtcp_impl2.cc | 10 +++++-----
modules/rtp_rtcp/source/rtp_rtcp_impl2.h | 3 ++-
modules/rtp_rtcp/source/rtp_rtcp_interface.h | 5 +++--
video/rtp_video_stream_receiver2.cc | 5 +++--
video/rtp_video_stream_receiver2.h | 3 ++-
video/video_receive_stream2.cc | 3 ++-
11 files changed, 32 insertions(+), 22 deletions(-)
diff --git a/modules/desktop_capture/window_capturer_mac.mm b/modules/desktop_capture/window_capturer_mac.mm
index f99b4a74d1..10f6a74650 100644
--- a/modules/desktop_capture/window_capturer_mac.mm
+++ b/modules/desktop_capture/window_capturer_mac.mm
@@ -170,8 +170,9 @@ void WindowCapturerMac::CaptureFrame() {
return webrtc::GetWindowList(
[sources](CFDictionaryRef window) {
WindowId window_id = GetWindowId(window);
+ int pid = GetWindowOwnerPid(window);
if (window_id != kNullWindowId) {
- sources->push_back(DesktopCapturer::Source{window_id, GetWindowTitle(window)});
+ sources->push_back(DesktopCapturer::Source{window_id, pid, GetWindowTitle(window)});
}
return true;
},
diff --git a/call/video_receive_stream.h b/call/video_receive_stream.h
index 01fb08a009..87ee39e142 100644
--- a/call/video_receive_stream.h
+++ b/call/video_receive_stream.h
@@ -152,10 +152,11 @@ class VideoReceiveStreamInterface : public MediaReceiveStreamInterface {
RtcpPacketTypeCounter rtcp_packet_type_counts;
absl::optional<RtpReceiveStats> rtx_rtp_stats;
- // Mozilla modification: Init these three.
+ // Mozilla modification: Init these.
uint32_t rtcp_sender_packets_sent = 0;
uint32_t rtcp_sender_octets_sent = 0;
int64_t rtcp_sender_ntp_timestamp_ms = 0;
+ int64_t rtcp_sender_remote_ntp_timestamp_ms = 0;
// Timing frame info: all important timestamps for a full lifetime of a
// single 'timing frame'.
diff --git a/modules/rtp_rtcp/source/rtcp_receiver.cc b/modules/rtp_rtcp/source/rtcp_receiver.cc
index e2ad674012..94de316421 100644
--- a/modules/rtp_rtcp/source/rtcp_receiver.cc
+++ b/modules/rtp_rtcp/source/rtcp_receiver.cc
@@ -365,11 +365,13 @@ RTCPReceiver::ConsumeReceivedXrReferenceTimeInfo() {
void RTCPReceiver::RemoteRTCPSenderInfo(uint32_t* packet_count,
uint32_t* octet_count,
- int64_t* ntp_timestamp_ms) const {
+ int64_t* ntp_timestamp_ms,
+ int64_t* remote_ntp_timestamp_ms) const {
MutexLock lock(&rtcp_receiver_lock_);
*packet_count = remote_sender_packet_count_;
*octet_count = remote_sender_octet_count_;
- *ntp_timestamp_ms = remote_sender_ntp_time_.ToMs();
+ *ntp_timestamp_ms = last_received_sr_ntp_.ToMs();
+ *remote_ntp_timestamp_ms = remote_sender_ntp_time_.ToMs();
}
std::vector<ReportBlockData> RTCPReceiver::GetLatestReportBlockData() const {
diff --git a/modules/rtp_rtcp/source/rtcp_receiver.h b/modules/rtp_rtcp/source/rtcp_receiver.h
index 36e117af55..7fc541585c 100644
--- a/modules/rtp_rtcp/source/rtcp_receiver.h
+++ b/modules/rtp_rtcp/source/rtcp_receiver.h
@@ -120,7 +120,8 @@ class RTCPReceiver final {
// Get received sender packet and octet counts
void RemoteRTCPSenderInfo(uint32_t* packet_count,
uint32_t* octet_count,
- int64_t* ntp_timestamp_ms) const;
+ int64_t* ntp_timestamp_ms,
+ int64_t* remote_ntp_timestamp_ms) const;
absl::optional<TimeDelta> AverageRtt() const;
absl::optional<TimeDelta> LastRtt() const;
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
index 83690f160c..a63067141d 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
@@ -500,11 +500,11 @@ void ModuleRtpRtcpImpl::GetSendStreamDataCounters(
}
// Received RTCP report.
-void ModuleRtpRtcpImpl::RemoteRTCPSenderInfo(uint32_t* packet_count,
- uint32_t* octet_count,
- int64_t* ntp_timestamp_ms) const {
- return rtcp_receiver_.RemoteRTCPSenderInfo(packet_count, octet_count,
- ntp_timestamp_ms);
+void ModuleRtpRtcpImpl::RemoteRTCPSenderInfo(
+ uint32_t* packet_count, uint32_t* octet_count, int64_t* ntp_timestamp_ms,
+ int64_t* remote_ntp_timestamp_ms) const {
+ return rtcp_receiver_.RemoteRTCPSenderInfo(
+ packet_count, octet_count, ntp_timestamp_ms, remote_ntp_timestamp_ms);
}
std::vector<ReportBlockData> ModuleRtpRtcpImpl::GetLatestReportBlockData()
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.h b/modules/rtp_rtcp/source/rtp_rtcp_impl.h
index 742a69cce3..0b1266a2db 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl.h
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.h
@@ -184,7 +184,8 @@ class ABSL_DEPRECATED("") ModuleRtpRtcpImpl
void RemoteRTCPSenderInfo(uint32_t* packet_count,
uint32_t* octet_count,
- int64_t* ntp_timestamp_ms) const override;
+ int64_t* ntp_timestamp_ms,
+ int64_t* remote_ntp_timestamp_ms) const override;
// A snapshot of the most recent Report Block with additional data of
// interest to statistics. Used to implement RTCRemoteInboundRtpStreamStats.
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc
index 31a1b764b3..ff482b39b6 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc
@@ -503,11 +503,11 @@ void ModuleRtpRtcpImpl2::GetSendStreamDataCounters(
}
// Received RTCP report.
-void ModuleRtpRtcpImpl2::RemoteRTCPSenderInfo(uint32_t* packet_count,
- uint32_t* octet_count,
- int64_t* ntp_timestamp_ms) const {
- return rtcp_receiver_.RemoteRTCPSenderInfo(packet_count, octet_count,
- ntp_timestamp_ms);
+void ModuleRtpRtcpImpl2::RemoteRTCPSenderInfo(
+ uint32_t* packet_count, uint32_t* octet_count, int64_t* ntp_timestamp_ms,
+ int64_t* remote_ntp_timestamp_ms) const {
+ return rtcp_receiver_.RemoteRTCPSenderInfo(
+ packet_count, octet_count, ntp_timestamp_ms, remote_ntp_timestamp_ms);
}
std::vector<ReportBlockData> ModuleRtpRtcpImpl2::GetLatestReportBlockData()
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl2.h b/modules/rtp_rtcp/source/rtp_rtcp_impl2.h
index a9d18ec44a..54ca61a705 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl2.h
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl2.h
@@ -196,7 +196,8 @@ class ModuleRtpRtcpImpl2 final : public RtpRtcpInterface,
void RemoteRTCPSenderInfo(uint32_t* packet_count,
uint32_t* octet_count,
- int64_t* ntp_timestamp_ms) const override;
+ int64_t* ntp_timestamp_ms,
+ int64_t* remote_ntp_timestamp_ms) const override;
// A snapshot of the most recent Report Block with additional data of
// interest to statistics. Used to implement RTCRemoteInboundRtpStreamStats.
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_interface.h b/modules/rtp_rtcp/source/rtp_rtcp_interface.h
index 889b099abd..2614461b2e 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_interface.h
+++ b/modules/rtp_rtcp/source/rtp_rtcp_interface.h
@@ -392,10 +392,11 @@ class RtpRtcpInterface : public RtcpFeedbackSenderInterface {
StreamDataCounters* rtx_counters) const = 0;
- // Returns packet count, octet count, and timestamp from RTCP sender report.
+ // Returns packet count, octet count, and timestamps from RTCP sender report.
virtual void RemoteRTCPSenderInfo(uint32_t* packet_count,
uint32_t* octet_count,
- int64_t* ntp_timestamp_ms) const = 0;
+ int64_t* ntp_timestamp_ms,
+ int64_t* remote_ntp_timestamp_ms) const = 0;
// A snapshot of Report Blocks with additional data of interest to statistics.
// Within this list, the sender-source SSRC pair is unique and per-pair the
// ReportBlockData represents the latest Report Block that was received for
diff --git a/video/rtp_video_stream_receiver2.cc b/video/rtp_video_stream_receiver2.cc
index b3d4d8a05d..ebfdf2b695 100644
--- a/video/rtp_video_stream_receiver2.cc
+++ b/video/rtp_video_stream_receiver2.cc
@@ -1065,9 +1065,10 @@ absl::optional<int64_t> RtpVideoStreamReceiver2::LastReceivedKeyframePacketMs()
// seem to be any support for these stats right now. So, we hack this in.
void RtpVideoStreamReceiver2::RemoteRTCPSenderInfo(
uint32_t* packet_count, uint32_t* octet_count,
- int64_t* ntp_timestamp_ms) const {
+ int64_t* ntp_timestamp_ms, int64_t* remote_ntp_timestamp_ms) const {
RTC_DCHECK_RUN_ON(&worker_task_checker_);
- rtp_rtcp_->RemoteRTCPSenderInfo(packet_count, octet_count, ntp_timestamp_ms);
+ rtp_rtcp_->RemoteRTCPSenderInfo(packet_count, octet_count, ntp_timestamp_ms,
+ remote_ntp_timestamp_ms);
}
void RtpVideoStreamReceiver2::ManageFrame(
diff --git a/video/rtp_video_stream_receiver2.h b/video/rtp_video_stream_receiver2.h
index be8bce770f..0e96d7f2cd 100644
--- a/video/rtp_video_stream_receiver2.h
+++ b/video/rtp_video_stream_receiver2.h
@@ -211,7 +211,8 @@ class RtpVideoStreamReceiver2 : public LossNotificationSender,
// stats at all, and even on the most recent libwebrtc code there does not
// seem to be any support for these stats right now. So, we hack this in.
void RemoteRTCPSenderInfo(uint32_t* packet_count, uint32_t* octet_count,
- int64_t* ntp_timestamp_ms) const;
+ int64_t* ntp_timestamp_ms,
+ int64_t* remote_ntp_timestamp_ms) const;
private:
// Implements RtpVideoFrameReceiver.
diff --git a/video/video_receive_stream2.cc b/video/video_receive_stream2.cc
index f50c3d0775..2067f255f7 100644
--- a/video/video_receive_stream2.cc
+++ b/video/video_receive_stream2.cc
@@ -579,7 +579,8 @@ VideoReceiveStreamInterface::Stats VideoReceiveStream2::GetStats() const {
// seem to be any support for these stats right now. So, we hack this in.
rtp_video_stream_receiver_.RemoteRTCPSenderInfo(
&stats.rtcp_sender_packets_sent, &stats.rtcp_sender_octets_sent,
- &stats.rtcp_sender_ntp_timestamp_ms);
+ &stats.rtcp_sender_ntp_timestamp_ms,
+ &stats.rtcp_sender_remote_ntp_timestamp_ms);
return stats;
}

Просмотреть файл

@ -1,205 +1,23 @@
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Tue, 2 Nov 2021 14:35:00 +0000
Subject: Bug 1729455 - Add to stats the local receive time for receiving video
Sender Reports. r=ng
Subject: Bug 1729455 - Ensure the libwebrtc system clock is not used. r=bwc
Differential Revision: https://phabricator.services.mozilla.com/D125712
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/99267b6d193fbcb3e4c845c5e80770424d6d06e2
Differential Revision: https://phabricator.services.mozilla.com/D128244
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/3e8ac168ee3db089dd892bf140df53e15d6f0918
---
call/video_receive_stream.h | 3 ++-
modules/rtp_rtcp/source/rtcp_receiver.cc | 6 ++++--
modules/rtp_rtcp/source/rtcp_receiver.h | 3 ++-
modules/rtp_rtcp/source/rtp_rtcp_impl.cc | 10 +++++-----
modules/rtp_rtcp/source/rtp_rtcp_impl.h | 3 ++-
modules/rtp_rtcp/source/rtp_rtcp_impl2.cc | 10 +++++-----
modules/rtp_rtcp/source/rtp_rtcp_impl2.h | 3 ++-
modules/rtp_rtcp/source/rtp_rtcp_interface.h | 5 +++--
video/rtp_video_stream_receiver2.cc | 5 +++--
video/rtp_video_stream_receiver2.h | 3 ++-
video/video_receive_stream2.cc | 3 ++-
11 files changed, 32 insertions(+), 22 deletions(-)
rtc_base/system_time.cc | 2 ++
1 file changed, 2 insertions(+)
diff --git a/call/video_receive_stream.h b/call/video_receive_stream.h
index 01fb08a009..87ee39e142 100644
--- a/call/video_receive_stream.h
+++ b/call/video_receive_stream.h
@@ -152,10 +152,11 @@ class VideoReceiveStreamInterface : public MediaReceiveStreamInterface {
RtcpPacketTypeCounter rtcp_packet_type_counts;
absl::optional<RtpReceiveStats> rtx_rtp_stats;
diff --git a/rtc_base/system_time.cc b/rtc_base/system_time.cc
index 058e6c2990..1a5e447916 100644
--- a/rtc_base/system_time.cc
+++ b/rtc_base/system_time.cc
@@ -12,6 +12,8 @@
// rtc::SystemTimeNanos() must be provided externally.
#ifndef WEBRTC_EXCLUDE_SYSTEM_TIME
- // Mozilla modification: Init these three.
+ // Mozilla modification: Init these.
uint32_t rtcp_sender_packets_sent = 0;
uint32_t rtcp_sender_octets_sent = 0;
int64_t rtcp_sender_ntp_timestamp_ms = 0;
+ int64_t rtcp_sender_remote_ntp_timestamp_ms = 0;
+#error Mozilla: Must not use the built-in libwebrtc clock
+
#include <stdint.h>
// Timing frame info: all important timestamps for a full lifetime of a
// single 'timing frame'.
diff --git a/modules/rtp_rtcp/source/rtcp_receiver.cc b/modules/rtp_rtcp/source/rtcp_receiver.cc
index e2ad674012..94de316421 100644
--- a/modules/rtp_rtcp/source/rtcp_receiver.cc
+++ b/modules/rtp_rtcp/source/rtcp_receiver.cc
@@ -365,11 +365,13 @@ RTCPReceiver::ConsumeReceivedXrReferenceTimeInfo() {
void RTCPReceiver::RemoteRTCPSenderInfo(uint32_t* packet_count,
uint32_t* octet_count,
- int64_t* ntp_timestamp_ms) const {
+ int64_t* ntp_timestamp_ms,
+ int64_t* remote_ntp_timestamp_ms) const {
MutexLock lock(&rtcp_receiver_lock_);
*packet_count = remote_sender_packet_count_;
*octet_count = remote_sender_octet_count_;
- *ntp_timestamp_ms = remote_sender_ntp_time_.ToMs();
+ *ntp_timestamp_ms = last_received_sr_ntp_.ToMs();
+ *remote_ntp_timestamp_ms = remote_sender_ntp_time_.ToMs();
}
std::vector<ReportBlockData> RTCPReceiver::GetLatestReportBlockData() const {
diff --git a/modules/rtp_rtcp/source/rtcp_receiver.h b/modules/rtp_rtcp/source/rtcp_receiver.h
index 36e117af55..7fc541585c 100644
--- a/modules/rtp_rtcp/source/rtcp_receiver.h
+++ b/modules/rtp_rtcp/source/rtcp_receiver.h
@@ -120,7 +120,8 @@ class RTCPReceiver final {
// Get received sender packet and octet counts
void RemoteRTCPSenderInfo(uint32_t* packet_count,
uint32_t* octet_count,
- int64_t* ntp_timestamp_ms) const;
+ int64_t* ntp_timestamp_ms,
+ int64_t* remote_ntp_timestamp_ms) const;
absl::optional<TimeDelta> AverageRtt() const;
absl::optional<TimeDelta> LastRtt() const;
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
index 83690f160c..a63067141d 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
@@ -500,11 +500,11 @@ void ModuleRtpRtcpImpl::GetSendStreamDataCounters(
}
// Received RTCP report.
-void ModuleRtpRtcpImpl::RemoteRTCPSenderInfo(uint32_t* packet_count,
- uint32_t* octet_count,
- int64_t* ntp_timestamp_ms) const {
- return rtcp_receiver_.RemoteRTCPSenderInfo(packet_count, octet_count,
- ntp_timestamp_ms);
+void ModuleRtpRtcpImpl::RemoteRTCPSenderInfo(
+ uint32_t* packet_count, uint32_t* octet_count, int64_t* ntp_timestamp_ms,
+ int64_t* remote_ntp_timestamp_ms) const {
+ return rtcp_receiver_.RemoteRTCPSenderInfo(
+ packet_count, octet_count, ntp_timestamp_ms, remote_ntp_timestamp_ms);
}
std::vector<ReportBlockData> ModuleRtpRtcpImpl::GetLatestReportBlockData()
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.h b/modules/rtp_rtcp/source/rtp_rtcp_impl.h
index 742a69cce3..0b1266a2db 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl.h
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.h
@@ -184,7 +184,8 @@ class ABSL_DEPRECATED("") ModuleRtpRtcpImpl
void RemoteRTCPSenderInfo(uint32_t* packet_count,
uint32_t* octet_count,
- int64_t* ntp_timestamp_ms) const override;
+ int64_t* ntp_timestamp_ms,
+ int64_t* remote_ntp_timestamp_ms) const override;
// A snapshot of the most recent Report Block with additional data of
// interest to statistics. Used to implement RTCRemoteInboundRtpStreamStats.
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc
index 31a1b764b3..ff482b39b6 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc
@@ -503,11 +503,11 @@ void ModuleRtpRtcpImpl2::GetSendStreamDataCounters(
}
// Received RTCP report.
-void ModuleRtpRtcpImpl2::RemoteRTCPSenderInfo(uint32_t* packet_count,
- uint32_t* octet_count,
- int64_t* ntp_timestamp_ms) const {
- return rtcp_receiver_.RemoteRTCPSenderInfo(packet_count, octet_count,
- ntp_timestamp_ms);
+void ModuleRtpRtcpImpl2::RemoteRTCPSenderInfo(
+ uint32_t* packet_count, uint32_t* octet_count, int64_t* ntp_timestamp_ms,
+ int64_t* remote_ntp_timestamp_ms) const {
+ return rtcp_receiver_.RemoteRTCPSenderInfo(
+ packet_count, octet_count, ntp_timestamp_ms, remote_ntp_timestamp_ms);
}
std::vector<ReportBlockData> ModuleRtpRtcpImpl2::GetLatestReportBlockData()
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl2.h b/modules/rtp_rtcp/source/rtp_rtcp_impl2.h
index a9d18ec44a..54ca61a705 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl2.h
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl2.h
@@ -196,7 +196,8 @@ class ModuleRtpRtcpImpl2 final : public RtpRtcpInterface,
void RemoteRTCPSenderInfo(uint32_t* packet_count,
uint32_t* octet_count,
- int64_t* ntp_timestamp_ms) const override;
+ int64_t* ntp_timestamp_ms,
+ int64_t* remote_ntp_timestamp_ms) const override;
// A snapshot of the most recent Report Block with additional data of
// interest to statistics. Used to implement RTCRemoteInboundRtpStreamStats.
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_interface.h b/modules/rtp_rtcp/source/rtp_rtcp_interface.h
index 889b099abd..2614461b2e 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_interface.h
+++ b/modules/rtp_rtcp/source/rtp_rtcp_interface.h
@@ -392,10 +392,11 @@ class RtpRtcpInterface : public RtcpFeedbackSenderInterface {
StreamDataCounters* rtx_counters) const = 0;
- // Returns packet count, octet count, and timestamp from RTCP sender report.
+ // Returns packet count, octet count, and timestamps from RTCP sender report.
virtual void RemoteRTCPSenderInfo(uint32_t* packet_count,
uint32_t* octet_count,
- int64_t* ntp_timestamp_ms) const = 0;
+ int64_t* ntp_timestamp_ms,
+ int64_t* remote_ntp_timestamp_ms) const = 0;
// A snapshot of Report Blocks with additional data of interest to statistics.
// Within this list, the sender-source SSRC pair is unique and per-pair the
// ReportBlockData represents the latest Report Block that was received for
diff --git a/video/rtp_video_stream_receiver2.cc b/video/rtp_video_stream_receiver2.cc
index b3d4d8a05d..ebfdf2b695 100644
--- a/video/rtp_video_stream_receiver2.cc
+++ b/video/rtp_video_stream_receiver2.cc
@@ -1065,9 +1065,10 @@ absl::optional<int64_t> RtpVideoStreamReceiver2::LastReceivedKeyframePacketMs()
// seem to be any support for these stats right now. So, we hack this in.
void RtpVideoStreamReceiver2::RemoteRTCPSenderInfo(
uint32_t* packet_count, uint32_t* octet_count,
- int64_t* ntp_timestamp_ms) const {
+ int64_t* ntp_timestamp_ms, int64_t* remote_ntp_timestamp_ms) const {
RTC_DCHECK_RUN_ON(&worker_task_checker_);
- rtp_rtcp_->RemoteRTCPSenderInfo(packet_count, octet_count, ntp_timestamp_ms);
+ rtp_rtcp_->RemoteRTCPSenderInfo(packet_count, octet_count, ntp_timestamp_ms,
+ remote_ntp_timestamp_ms);
}
void RtpVideoStreamReceiver2::ManageFrame(
diff --git a/video/rtp_video_stream_receiver2.h b/video/rtp_video_stream_receiver2.h
index be8bce770f..0e96d7f2cd 100644
--- a/video/rtp_video_stream_receiver2.h
+++ b/video/rtp_video_stream_receiver2.h
@@ -211,7 +211,8 @@ class RtpVideoStreamReceiver2 : public LossNotificationSender,
// stats at all, and even on the most recent libwebrtc code there does not
// seem to be any support for these stats right now. So, we hack this in.
void RemoteRTCPSenderInfo(uint32_t* packet_count, uint32_t* octet_count,
- int64_t* ntp_timestamp_ms) const;
+ int64_t* ntp_timestamp_ms,
+ int64_t* remote_ntp_timestamp_ms) const;
private:
// Implements RtpVideoFrameReceiver.
diff --git a/video/video_receive_stream2.cc b/video/video_receive_stream2.cc
index f50c3d0775..2067f255f7 100644
--- a/video/video_receive_stream2.cc
+++ b/video/video_receive_stream2.cc
@@ -579,7 +579,8 @@ VideoReceiveStreamInterface::Stats VideoReceiveStream2::GetStats() const {
// seem to be any support for these stats right now. So, we hack this in.
rtp_video_stream_receiver_.RemoteRTCPSenderInfo(
&stats.rtcp_sender_packets_sent, &stats.rtcp_sender_octets_sent,
- &stats.rtcp_sender_ntp_timestamp_ms);
+ &stats.rtcp_sender_ntp_timestamp_ms,
+ &stats.rtcp_sender_remote_ntp_timestamp_ms);
return stats;
}
#include <limits>

Просмотреть файл

@ -1,23 +1,196 @@
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Tue, 2 Nov 2021 14:35:00 +0000
Subject: Bug 1729455 - Ensure the libwebrtc system clock is not used. r=bwc
Subject: Bug 1729455 - Inject RTCStatsTimestampMakerRealtimeClock into Call
instances. r=bwc
Differential Revision: https://phabricator.services.mozilla.com/D128244
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/3e8ac168ee3db089dd892bf140df53e15d6f0918
This patch makes libwebrtc use our clock for timestamps.
It also makes sure there's no use of the libwebrtc realtime clock, other than
for relative time tracking (like timeouts), and that future libwebrtc updates
don't introduce unaudited use of it.
Differential Revision: https://phabricator.services.mozilla.com/D127714
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/0744d68b8c944e69945de4ac5c4ca71332e78ad8
---
rtc_base/system_time.cc | 2 ++
1 file changed, 2 insertions(+)
audio/channel_send.cc | 2 +-
call/call.cc | 2 ++
call/call_factory.cc | 4 ++++
call/degraded_call.cc | 2 ++
modules/audio_coding/acm2/acm_receiver.cc | 2 +-
modules/rtp_rtcp/include/flexfec_receiver.h | 2 ++
modules/rtp_rtcp/source/flexfec_receiver.cc | 2 ++
rtc_base/task_utils/repeating_task.h | 4 ++--
system_wrappers/include/clock.h | 2 +-
system_wrappers/source/clock.cc | 2 +-
10 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/rtc_base/system_time.cc b/rtc_base/system_time.cc
index 058e6c2990..1a5e447916 100644
--- a/rtc_base/system_time.cc
+++ b/rtc_base/system_time.cc
@@ -12,6 +12,8 @@
// rtc::SystemTimeNanos() must be provided externally.
#ifndef WEBRTC_EXCLUDE_SYSTEM_TIME
diff --git a/audio/channel_send.cc b/audio/channel_send.cc
index 000427c833..e99aa291a1 100644
--- a/audio/channel_send.cc
+++ b/audio/channel_send.cc
@@ -429,7 +429,7 @@ ChannelSend::ChannelSend(
transport_controller->GetRtcpObserver();
configuration.transport_feedback_callback =
transport_controller->transport_feedback_observer();
- configuration.clock = (clock ? clock : Clock::GetRealTimeClock());
+ configuration.clock = clock;
configuration.audio = true;
configuration.outgoing_transport = rtp_transport;
+#error Mozilla: Must not use the built-in libwebrtc clock
+
#include <stdint.h>
diff --git a/call/call.cc b/call/call.cc
index fa5d14d204..85297d9568 100644
--- a/call/call.cc
+++ b/call/call.cc
@@ -478,12 +478,14 @@ std::string Call::Stats::ToString(int64_t time_ms) const {
return ss.str();
}
#include <limits>
+/* Mozilla: Avoid this since it could use GetRealTimeClock().
Call* Call::Create(const Call::Config& config) {
Clock* clock = Clock::GetRealTimeClock();
return Create(config, clock,
RtpTransportControllerSendFactory().Create(
config.ExtractTransportConfig(), clock));
}
+ */
Call* Call::Create(const Call::Config& config,
Clock* clock,
diff --git a/call/call_factory.cc b/call/call_factory.cc
index 380e80ce12..253f8cd7de 100644
--- a/call/call_factory.cc
+++ b/call/call_factory.cc
@@ -95,6 +95,9 @@ Call* CallFactory::CreateCall(const Call::Config& config) {
RtpTransportConfig transportConfig = config.ExtractTransportConfig();
+ RTC_CHECK(false);
+ return nullptr;
+ /* Mozilla: Avoid this since it could use GetRealTimeClock().
Call* call =
Call::Create(config, Clock::GetRealTimeClock(),
config.rtp_transport_controller_send_factory->Create(
@@ -107,6 +110,7 @@ Call* CallFactory::CreateCall(const Call::Config& config) {
}
return call;
+ */
}
std::unique_ptr<CallFactoryInterface> CreateCallFactory() {
diff --git a/call/degraded_call.cc b/call/degraded_call.cc
index a511eda7bd..75a4a1cac0 100644
--- a/call/degraded_call.cc
+++ b/call/degraded_call.cc
@@ -126,6 +126,7 @@ bool DegradedCall::FakeNetworkPipeTransportAdapter::SendRtcp(
return true;
}
+/* Mozilla: Avoid this since it could use GetRealTimeClock().
DegradedCall::DegradedCall(
std::unique_ptr<Call> call,
const std::vector<TimeScopedNetworkConfig>& send_configs,
@@ -162,6 +163,7 @@ DegradedCall::DegradedCall(
}
}
}
+*/
DegradedCall::~DegradedCall() {
RTC_DCHECK_RUN_ON(call_->worker_thread());
diff --git a/modules/audio_coding/acm2/acm_receiver.cc b/modules/audio_coding/acm2/acm_receiver.cc
index a77e472ec1..a5bf88e547 100644
--- a/modules/audio_coding/acm2/acm_receiver.cc
+++ b/modules/audio_coding/acm2/acm_receiver.cc
@@ -50,7 +50,7 @@ std::unique_ptr<NetEq> CreateNetEq(
AcmReceiver::Config::Config(
rtc::scoped_refptr<AudioDecoderFactory> decoder_factory)
- : clock(*Clock::GetRealTimeClock()), decoder_factory(decoder_factory) {
+ : clock(*Clock::GetRealTimeClockRaw()), decoder_factory(decoder_factory) {
// Post-decode VAD is disabled by default in NetEq, however, Audio
// Conference Mixer relies on VAD decisions and fails without them.
neteq_config.enable_post_decode_vad = true;
diff --git a/modules/rtp_rtcp/include/flexfec_receiver.h b/modules/rtp_rtcp/include/flexfec_receiver.h
index a869c8ad41..b6a33882d1 100644
--- a/modules/rtp_rtcp/include/flexfec_receiver.h
+++ b/modules/rtp_rtcp/include/flexfec_receiver.h
@@ -30,9 +30,11 @@ class Clock;
class FlexfecReceiver {
public:
+ /* Mozilla: Avoid this since it could use GetRealTimeClock().
FlexfecReceiver(uint32_t ssrc,
uint32_t protected_media_ssrc,
RecoveredPacketReceiver* recovered_packet_receiver);
+ */
FlexfecReceiver(Clock* clock,
uint32_t ssrc,
uint32_t protected_media_ssrc,
diff --git a/modules/rtp_rtcp/source/flexfec_receiver.cc b/modules/rtp_rtcp/source/flexfec_receiver.cc
index 7f2cc0cb3c..2ba85a2157 100644
--- a/modules/rtp_rtcp/source/flexfec_receiver.cc
+++ b/modules/rtp_rtcp/source/flexfec_receiver.cc
@@ -31,6 +31,7 @@ constexpr TimeDelta kPacketLogInterval = TimeDelta::Seconds(10);
} // namespace
+/* Mozilla: Avoid this since it could use GetRealTimeClock().
FlexfecReceiver::FlexfecReceiver(
uint32_t ssrc,
uint32_t protected_media_ssrc,
@@ -39,6 +40,7 @@ FlexfecReceiver::FlexfecReceiver(
ssrc,
protected_media_ssrc,
recovered_packet_receiver) {}
+ */
FlexfecReceiver::FlexfecReceiver(
Clock* clock,
diff --git a/rtc_base/task_utils/repeating_task.h b/rtc_base/task_utils/repeating_task.h
index c45de95ecc..28c691c3de 100644
--- a/rtc_base/task_utils/repeating_task.h
+++ b/rtc_base/task_utils/repeating_task.h
@@ -57,7 +57,7 @@ class RepeatingTaskHandle {
absl::AnyInvocable<TimeDelta()> closure,
TaskQueueBase::DelayPrecision precision =
TaskQueueBase::DelayPrecision::kLow,
- Clock* clock = Clock::GetRealTimeClock(),
+ Clock* clock = Clock::GetRealTimeClockRaw(),
const Location& location = Location::Current());
// DelayedStart is equivalent to Start except that the first invocation of the
@@ -68,7 +68,7 @@ class RepeatingTaskHandle {
absl::AnyInvocable<TimeDelta()> closure,
TaskQueueBase::DelayPrecision precision =
TaskQueueBase::DelayPrecision::kLow,
- Clock* clock = Clock::GetRealTimeClock(),
+ Clock* clock = Clock::GetRealTimeClockRaw(),
const Location& location = Location::Current());
// Stops future invocations of the repeating task closure. Can only be called
diff --git a/system_wrappers/include/clock.h b/system_wrappers/include/clock.h
index 60296070cc..214b34c970 100644
--- a/system_wrappers/include/clock.h
+++ b/system_wrappers/include/clock.h
@@ -49,7 +49,7 @@ class RTC_EXPORT Clock {
}
// Returns an instance of the real-time system clock implementation.
- static Clock* GetRealTimeClock();
+ static Clock* GetRealTimeClockRaw();
};
class SimulatedClock : public Clock {
diff --git a/system_wrappers/source/clock.cc b/system_wrappers/source/clock.cc
index 88c99d6a68..f7460b831c 100644
--- a/system_wrappers/source/clock.cc
+++ b/system_wrappers/source/clock.cc
@@ -57,7 +57,7 @@ class RealTimeClock : public Clock {
}
};
-Clock* Clock::GetRealTimeClock() {
+Clock* Clock::GetRealTimeClockRaw() {
static Clock* const clock = new RealTimeClock();
return clock;
}

Просмотреть файл

@ -1,196 +1,88 @@
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Tue, 2 Nov 2021 14:35:00 +0000
Subject: Bug 1729455 - Inject RTCStatsTimestampMakerRealtimeClock into Call
instances. r=bwc
From: Landry Breuil <landry@openbsd.org>
Date: Wed, 22 Dec 2021 00:09:00 +0000
Subject: Bug 1654448 - P2 - readd partial support for BSD to webrtc
build;r=mjf
This patch makes libwebrtc use our clock for timestamps.
It also makes sure there's no use of the libwebrtc realtime clock, other than
for relative time tracking (like timeouts), and that future libwebrtc updates
don't introduce unaudited use of it.
only OpenBSD/amd64 is supported for now
Differential Revision: https://phabricator.services.mozilla.com/D127714
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/0744d68b8c944e69945de4ac5c4ca71332e78ad8
Depends on D134432
Differential Revision: https://phabricator.services.mozilla.com/D134433
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/0300b32b7de70fb8976dc82d7d3bb3adb9685857
---
audio/channel_send.cc | 2 +-
call/call.cc | 2 ++
call/call_factory.cc | 4 ++++
call/degraded_call.cc | 2 ++
modules/audio_coding/acm2/acm_receiver.cc | 2 +-
modules/rtp_rtcp/include/flexfec_receiver.h | 2 ++
modules/rtp_rtcp/source/flexfec_receiver.cc | 2 ++
rtc_base/task_utils/repeating_task.h | 4 ++--
system_wrappers/include/clock.h | 2 +-
system_wrappers/source/clock.cc | 2 +-
10 files changed, 18 insertions(+), 6 deletions(-)
BUILD.gn | 3 +++
modules/video_capture/BUILD.gn | 2 +-
modules/video_capture/linux/device_info_v4l2.h | 2 ++
rtc_base/platform_thread_types.cc | 4 +++-
webrtc.gni | 2 +-
5 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/audio/channel_send.cc b/audio/channel_send.cc
index 000427c833..e99aa291a1 100644
--- a/audio/channel_send.cc
+++ b/audio/channel_send.cc
@@ -429,7 +429,7 @@ ChannelSend::ChannelSend(
transport_controller->GetRtcpObserver();
configuration.transport_feedback_callback =
transport_controller->transport_feedback_observer();
- configuration.clock = (clock ? clock : Clock::GetRealTimeClock());
+ configuration.clock = clock;
configuration.audio = true;
configuration.outgoing_transport = rtp_transport;
diff --git a/call/call.cc b/call/call.cc
index fa5d14d204..85297d9568 100644
--- a/call/call.cc
+++ b/call/call.cc
@@ -478,12 +478,14 @@ std::string Call::Stats::ToString(int64_t time_ms) const {
return ss.str();
}
+/* Mozilla: Avoid this since it could use GetRealTimeClock().
Call* Call::Create(const Call::Config& config) {
Clock* clock = Clock::GetRealTimeClock();
return Create(config, clock,
RtpTransportControllerSendFactory().Create(
config.ExtractTransportConfig(), clock));
}
+ */
Call* Call::Create(const Call::Config& config,
Clock* clock,
diff --git a/call/call_factory.cc b/call/call_factory.cc
index 380e80ce12..253f8cd7de 100644
--- a/call/call_factory.cc
+++ b/call/call_factory.cc
@@ -95,6 +95,9 @@ Call* CallFactory::CreateCall(const Call::Config& config) {
RtpTransportConfig transportConfig = config.ExtractTransportConfig();
+ RTC_CHECK(false);
+ return nullptr;
+ /* Mozilla: Avoid this since it could use GetRealTimeClock().
Call* call =
Call::Create(config, Clock::GetRealTimeClock(),
config.rtp_transport_controller_send_factory->Create(
@@ -107,6 +110,7 @@ Call* CallFactory::CreateCall(const Call::Config& config) {
diff --git a/BUILD.gn b/BUILD.gn
index b8b20fb04d..d507eb86b8 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -220,6 +220,9 @@ config("common_inherited_config") {
if (is_linux || is_chromeos) {
defines += [ "WEBRTC_LINUX" ]
}
return call;
+ */
}
std::unique_ptr<CallFactoryInterface> CreateCallFactory() {
diff --git a/call/degraded_call.cc b/call/degraded_call.cc
index a511eda7bd..75a4a1cac0 100644
--- a/call/degraded_call.cc
+++ b/call/degraded_call.cc
@@ -126,6 +126,7 @@ bool DegradedCall::FakeNetworkPipeTransportAdapter::SendRtcp(
return true;
}
+/* Mozilla: Avoid this since it could use GetRealTimeClock().
DegradedCall::DegradedCall(
std::unique_ptr<Call> call,
const std::vector<TimeScopedNetworkConfig>& send_configs,
@@ -162,6 +163,7 @@ DegradedCall::DegradedCall(
}
+ if (is_bsd) {
+ defines += [ "WEBRTC_BSD" ]
+ }
if (is_mac) {
defines += [ "WEBRTC_MAC" ]
}
diff --git a/modules/video_capture/BUILD.gn b/modules/video_capture/BUILD.gn
index d473dbb74c..8f89918359 100644
--- a/modules/video_capture/BUILD.gn
+++ b/modules/video_capture/BUILD.gn
@@ -71,7 +71,7 @@ if (!build_with_chromium || is_linux || is_chromeos) {
"video_capture_options.h",
]
- if (is_linux || is_chromeos) {
+ if (is_linux || is_bsd || is_chromeos) {
sources += [
"linux/device_info_linux.cc",
"linux/device_info_v4l2.cc",
diff --git a/modules/video_capture/linux/device_info_v4l2.h b/modules/video_capture/linux/device_info_v4l2.h
index e3c2395f49..119cb07ab8 100644
--- a/modules/video_capture/linux/device_info_v4l2.h
+++ b/modules/video_capture/linux/device_info_v4l2.h
@@ -16,7 +16,9 @@
#include "modules/video_capture/device_info_impl.h"
#include "rtc_base/platform_thread.h"
+#ifdef WEBRTC_LINUX
#include <sys/inotify.h>
+#endif
struct v4l2_capability;
diff --git a/rtc_base/platform_thread_types.cc b/rtc_base/platform_thread_types.cc
index d64ea689bb..c3c6955a7b 100644
--- a/rtc_base/platform_thread_types.cc
+++ b/rtc_base/platform_thread_types.cc
@@ -50,7 +50,9 @@ PlatformThreadId CurrentThreadId() {
return static_cast<PlatformThreadId>(pthread_self());
#else
// Default implementation for nacl and solaris.
- return reinterpret_cast<PlatformThreadId>(pthread_self());
+ // WEBRTC_BSD: pthread_t is a pointer, so cannot be casted to pid_t
+ // (aka int32_t) on 64-bit archs. Required on OpenBSD.
+ return reinterpret_cast<long>(pthread_self());
#endif
#endif // defined(WEBRTC_POSIX)
}
+*/
diff --git a/webrtc.gni b/webrtc.gni
index ae2a2b6f3c..9b7a706f20 100644
--- a/webrtc.gni
+++ b/webrtc.gni
@@ -360,7 +360,7 @@ rtc_opus_dir = "//third_party/opus"
DegradedCall::~DegradedCall() {
RTC_DCHECK_RUN_ON(call_->worker_thread());
diff --git a/modules/audio_coding/acm2/acm_receiver.cc b/modules/audio_coding/acm2/acm_receiver.cc
index a77e472ec1..a5bf88e547 100644
--- a/modules/audio_coding/acm2/acm_receiver.cc
+++ b/modules/audio_coding/acm2/acm_receiver.cc
@@ -50,7 +50,7 @@ std::unique_ptr<NetEq> CreateNetEq(
# Desktop capturer is supported only on Windows, OSX and Linux.
rtc_desktop_capture_supported =
- (is_win && current_os != "winuwp") || is_mac ||
+ (is_win && current_os != "winuwp") || is_mac || is_bsd ||
((is_linux || is_chromeos) && (rtc_use_x11_extensions || rtc_use_pipewire))
AcmReceiver::Config::Config(
rtc::scoped_refptr<AudioDecoderFactory> decoder_factory)
- : clock(*Clock::GetRealTimeClock()), decoder_factory(decoder_factory) {
+ : clock(*Clock::GetRealTimeClockRaw()), decoder_factory(decoder_factory) {
// Post-decode VAD is disabled by default in NetEq, however, Audio
// Conference Mixer relies on VAD decisions and fails without them.
neteq_config.enable_post_decode_vad = true;
diff --git a/modules/rtp_rtcp/include/flexfec_receiver.h b/modules/rtp_rtcp/include/flexfec_receiver.h
index a869c8ad41..b6a33882d1 100644
--- a/modules/rtp_rtcp/include/flexfec_receiver.h
+++ b/modules/rtp_rtcp/include/flexfec_receiver.h
@@ -30,9 +30,11 @@ class Clock;
class FlexfecReceiver {
public:
+ /* Mozilla: Avoid this since it could use GetRealTimeClock().
FlexfecReceiver(uint32_t ssrc,
uint32_t protected_media_ssrc,
RecoveredPacketReceiver* recovered_packet_receiver);
+ */
FlexfecReceiver(Clock* clock,
uint32_t ssrc,
uint32_t protected_media_ssrc,
diff --git a/modules/rtp_rtcp/source/flexfec_receiver.cc b/modules/rtp_rtcp/source/flexfec_receiver.cc
index 7f2cc0cb3c..2ba85a2157 100644
--- a/modules/rtp_rtcp/source/flexfec_receiver.cc
+++ b/modules/rtp_rtcp/source/flexfec_receiver.cc
@@ -31,6 +31,7 @@ constexpr TimeDelta kPacketLogInterval = TimeDelta::Seconds(10);
} // namespace
+/* Mozilla: Avoid this since it could use GetRealTimeClock().
FlexfecReceiver::FlexfecReceiver(
uint32_t ssrc,
uint32_t protected_media_ssrc,
@@ -39,6 +40,7 @@ FlexfecReceiver::FlexfecReceiver(
ssrc,
protected_media_ssrc,
recovered_packet_receiver) {}
+ */
FlexfecReceiver::FlexfecReceiver(
Clock* clock,
diff --git a/rtc_base/task_utils/repeating_task.h b/rtc_base/task_utils/repeating_task.h
index c45de95ecc..28c691c3de 100644
--- a/rtc_base/task_utils/repeating_task.h
+++ b/rtc_base/task_utils/repeating_task.h
@@ -57,7 +57,7 @@ class RepeatingTaskHandle {
absl::AnyInvocable<TimeDelta()> closure,
TaskQueueBase::DelayPrecision precision =
TaskQueueBase::DelayPrecision::kLow,
- Clock* clock = Clock::GetRealTimeClock(),
+ Clock* clock = Clock::GetRealTimeClockRaw(),
const Location& location = Location::Current());
// DelayedStart is equivalent to Start except that the first invocation of the
@@ -68,7 +68,7 @@ class RepeatingTaskHandle {
absl::AnyInvocable<TimeDelta()> closure,
TaskQueueBase::DelayPrecision precision =
TaskQueueBase::DelayPrecision::kLow,
- Clock* clock = Clock::GetRealTimeClock(),
+ Clock* clock = Clock::GetRealTimeClockRaw(),
const Location& location = Location::Current());
// Stops future invocations of the repeating task closure. Can only be called
diff --git a/system_wrappers/include/clock.h b/system_wrappers/include/clock.h
index 60296070cc..214b34c970 100644
--- a/system_wrappers/include/clock.h
+++ b/system_wrappers/include/clock.h
@@ -49,7 +49,7 @@ class RTC_EXPORT Clock {
}
// Returns an instance of the real-time system clock implementation.
- static Clock* GetRealTimeClock();
+ static Clock* GetRealTimeClockRaw();
};
class SimulatedClock : public Clock {
diff --git a/system_wrappers/source/clock.cc b/system_wrappers/source/clock.cc
index 88c99d6a68..f7460b831c 100644
--- a/system_wrappers/source/clock.cc
+++ b/system_wrappers/source/clock.cc
@@ -57,7 +57,7 @@ class RealTimeClock : public Clock {
}
};
-Clock* Clock::GetRealTimeClock() {
+Clock* Clock::GetRealTimeClockRaw() {
static Clock* const clock = new RealTimeClock();
return clock;
}
###############################################################################

Просмотреть файл

@ -1,88 +1,160 @@
From: Landry Breuil <landry@openbsd.org>
Date: Wed, 22 Dec 2021 00:09:00 +0000
Subject: Bug 1654448 - P2 - readd partial support for BSD to webrtc
build;r=mjf
From: Michael Froman <mjfroman@mac.com>
Date: Mon, 4 Apr 2022 12:25:26 -0500
Subject: Bug 1766646 - (fix) breakout Call::Stats and SharedModuleThread into
seperate files
only OpenBSD/amd64 is supported for now
Depends on D134432
Differential Revision: https://phabricator.services.mozilla.com/D134433
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/0300b32b7de70fb8976dc82d7d3bb3adb9685857
---
BUILD.gn | 3 +++
modules/video_capture/BUILD.gn | 2 +-
modules/video_capture/linux/device_info_v4l2.h | 2 ++
rtc_base/platform_thread_types.cc | 4 +++-
webrtc.gni | 2 +-
5 files changed, 10 insertions(+), 3 deletions(-)
call/BUILD.gn | 6 ++++++
call/call.cc | 13 -------------
call/call.h | 13 ++-----------
call/call_basic_stats.cc | 20 ++++++++++++++++++++
call/call_basic_stats.h | 21 +++++++++++++++++++++
video/video_send_stream.h | 1 -
6 files changed, 49 insertions(+), 25 deletions(-)
create mode 100644 call/call_basic_stats.cc
create mode 100644 call/call_basic_stats.h
diff --git a/BUILD.gn b/BUILD.gn
index b8b20fb04d..d507eb86b8 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -220,6 +220,9 @@ config("common_inherited_config") {
if (is_linux || is_chromeos) {
defines += [ "WEBRTC_LINUX" ]
}
+ if (is_bsd) {
+ defines += [ "WEBRTC_BSD" ]
diff --git a/call/BUILD.gn b/call/BUILD.gn
index 173c220b9b..161cce992f 100644
--- a/call/BUILD.gn
+++ b/call/BUILD.gn
@@ -33,6 +33,12 @@ rtc_library("call_interfaces") {
"syncable.cc",
"syncable.h",
]
+ if (build_with_mozilla) {
+ sources += [
+ "call_basic_stats.cc",
+ "call_basic_stats.h",
+ ]
+ }
if (is_mac) {
defines += [ "WEBRTC_MAC" ]
}
diff --git a/modules/video_capture/BUILD.gn b/modules/video_capture/BUILD.gn
index d473dbb74c..8f89918359 100644
--- a/modules/video_capture/BUILD.gn
+++ b/modules/video_capture/BUILD.gn
@@ -71,7 +71,7 @@ if (!build_with_chromium || is_linux || is_chromeos) {
"video_capture_options.h",
]
- if (is_linux || is_chromeos) {
+ if (is_linux || is_bsd || is_chromeos) {
sources += [
"linux/device_info_linux.cc",
"linux/device_info_v4l2.cc",
diff --git a/modules/video_capture/linux/device_info_v4l2.h b/modules/video_capture/linux/device_info_v4l2.h
index e3c2395f49..119cb07ab8 100644
--- a/modules/video_capture/linux/device_info_v4l2.h
+++ b/modules/video_capture/linux/device_info_v4l2.h
@@ -16,7 +16,9 @@
#include "modules/video_capture/device_info_impl.h"
deps = [
":audio_sender_interface",
diff --git a/call/call.cc b/call/call.cc
index 85297d9568..bca6072042 100644
--- a/call/call.cc
+++ b/call/call.cc
@@ -465,19 +465,6 @@ class Call final : public webrtc::Call,
};
} // namespace internal
#include "rtc_base/platform_thread.h"
+#ifdef WEBRTC_LINUX
#include <sys/inotify.h>
+#endif
-std::string Call::Stats::ToString(int64_t time_ms) const {
- char buf[1024];
- rtc::SimpleStringBuilder ss(buf);
- ss << "Call stats: " << time_ms << ", {";
- ss << "send_bw_bps: " << send_bandwidth_bps << ", ";
- ss << "recv_bw_bps: " << recv_bandwidth_bps << ", ";
- ss << "max_pad_bps: " << max_padding_bitrate_bps << ", ";
- ss << "pacer_delay_ms: " << pacer_delay_ms << ", ";
- ss << "rtt_ms: " << rtt_ms;
- ss << '}';
- return ss.str();
-}
-
/* Mozilla: Avoid this since it could use GetRealTimeClock().
Call* Call::Create(const Call::Config& config) {
Clock* clock = Clock::GetRealTimeClock();
diff --git a/call/call.h b/call/call.h
index 366978392e..42daa95a6c 100644
--- a/call/call.h
+++ b/call/call.h
@@ -21,6 +21,7 @@
#include "api/task_queue/task_queue_base.h"
#include "call/audio_receive_stream.h"
#include "call/audio_send_stream.h"
+#include "call/call_basic_stats.h"
#include "call/call_config.h"
#include "call/flexfec_receive_stream.h"
#include "call/packet_receiver.h"
@@ -30,7 +31,6 @@
#include "rtc_base/copy_on_write_buffer.h"
#include "rtc_base/network/sent_packet.h"
#include "rtc_base/network_route.h"
-#include "rtc_base/ref_count.h"
struct v4l2_capability;
namespace webrtc {
diff --git a/rtc_base/platform_thread_types.cc b/rtc_base/platform_thread_types.cc
index d64ea689bb..c3c6955a7b 100644
--- a/rtc_base/platform_thread_types.cc
+++ b/rtc_base/platform_thread_types.cc
@@ -50,7 +50,9 @@ PlatformThreadId CurrentThreadId() {
return static_cast<PlatformThreadId>(pthread_self());
#else
// Default implementation for nacl and solaris.
- return reinterpret_cast<PlatformThreadId>(pthread_self());
+ // WEBRTC_BSD: pthread_t is a pointer, so cannot be casted to pid_t
+ // (aka int32_t) on 64-bit archs. Required on OpenBSD.
+ return reinterpret_cast<long>(pthread_self());
#endif
#endif // defined(WEBRTC_POSIX)
}
diff --git a/webrtc.gni b/webrtc.gni
index ae2a2b6f3c..9b7a706f20 100644
--- a/webrtc.gni
+++ b/webrtc.gni
@@ -360,7 +360,7 @@ rtc_opus_dir = "//third_party/opus"
@@ -47,16 +47,7 @@ namespace webrtc {
class Call {
public:
using Config = CallConfig;
-
- struct Stats {
- std::string ToString(int64_t time_ms) const;
-
- int send_bandwidth_bps = 0; // Estimated available send bandwidth.
- int max_padding_bitrate_bps = 0; // Cumulative configured max padding.
- int recv_bandwidth_bps = 0; // Estimated available receive bandwidth.
- int64_t pacer_delay_ms = 0;
- int64_t rtt_ms = -1;
- };
+ using Stats = CallBasicStats;
# Desktop capturer is supported only on Windows, OSX and Linux.
rtc_desktop_capture_supported =
- (is_win && current_os != "winuwp") || is_mac ||
+ (is_win && current_os != "winuwp") || is_mac || is_bsd ||
((is_linux || is_chromeos) && (rtc_use_x11_extensions || rtc_use_pipewire))
static Call* Create(const Call::Config& config);
static Call* Create(const Call::Config& config,
diff --git a/call/call_basic_stats.cc b/call/call_basic_stats.cc
new file mode 100644
index 0000000000..74333a663b
--- /dev/null
+++ b/call/call_basic_stats.cc
@@ -0,0 +1,20 @@
+#include "call/call_basic_stats.h"
+
+#include "rtc_base/strings/string_builder.h"
+
+namespace webrtc {
+
+std::string CallBasicStats::ToString(int64_t time_ms) const {
+ char buf[1024];
+ rtc::SimpleStringBuilder ss(buf);
+ ss << "Call stats: " << time_ms << ", {";
+ ss << "send_bw_bps: " << send_bandwidth_bps << ", ";
+ ss << "recv_bw_bps: " << recv_bandwidth_bps << ", ";
+ ss << "max_pad_bps: " << max_padding_bitrate_bps << ", ";
+ ss << "pacer_delay_ms: " << pacer_delay_ms << ", ";
+ ss << "rtt_ms: " << rtt_ms;
+ ss << '}';
+ return ss.str();
+}
+
+} // namespace webrtc
diff --git a/call/call_basic_stats.h b/call/call_basic_stats.h
new file mode 100644
index 0000000000..98febe9405
--- /dev/null
+++ b/call/call_basic_stats.h
@@ -0,0 +1,21 @@
+#ifndef CALL_CALL_BASIC_STATS_H_
+#define CALL_CALL_BASIC_STATS_H_
+
+#include <string>
+
+namespace webrtc {
+
+// named to avoid conflicts with video/call_stats.h
+struct CallBasicStats {
+ std::string ToString(int64_t time_ms) const;
+
+ int send_bandwidth_bps = 0; // Estimated available send bandwidth.
+ int max_padding_bitrate_bps = 0; // Cumulative configured max padding.
+ int recv_bandwidth_bps = 0; // Estimated available receive bandwidth.
+ int64_t pacer_delay_ms = 0;
+ int64_t rtt_ms = -1;
+};
+
+} // namespace webrtc
+
+#endif // CALL_CALL_BASIC_STATS_H_
diff --git a/video/video_send_stream.h b/video/video_send_stream.h
index 1f4717fbec..55103ac979 100644
--- a/video/video_send_stream.h
+++ b/video/video_send_stream.h
@@ -36,7 +36,6 @@ namespace test {
class VideoSendStreamPeer;
} // namespace test
###############################################################################
-class CallStats;
class IvfFileWriter;
class RateLimiter;
class RtpRtcp;

Просмотреть файл

@ -1,160 +1,29 @@
From: Michael Froman <mjfroman@mac.com>
Date: Mon, 4 Apr 2022 12:25:26 -0500
Subject: Bug 1766646 - (fix) breakout Call::Stats and SharedModuleThread into
seperate files
Date: Fri, 8 Apr 2022 11:36:36 -0500
Subject: Bug 1766646 - (fix-b556b08668) avoid InlinedVector method that can
throw exception
---
call/BUILD.gn | 6 ++++++
call/call.cc | 13 -------------
call/call.h | 13 ++-----------
call/call_basic_stats.cc | 20 ++++++++++++++++++++
call/call_basic_stats.h | 21 +++++++++++++++++++++
video/video_send_stream.h | 1 -
6 files changed, 49 insertions(+), 25 deletions(-)
create mode 100644 call/call_basic_stats.cc
create mode 100644 call/call_basic_stats.h
api/video_codecs/video_encoder.cc | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/call/BUILD.gn b/call/BUILD.gn
index 173c220b9b..161cce992f 100644
--- a/call/BUILD.gn
+++ b/call/BUILD.gn
@@ -33,6 +33,12 @@ rtc_library("call_interfaces") {
"syncable.cc",
"syncable.h",
]
+ if (build_with_mozilla) {
+ sources += [
+ "call_basic_stats.cc",
+ "call_basic_stats.h",
+ ]
+ }
deps = [
":audio_sender_interface",
diff --git a/call/call.cc b/call/call.cc
index 85297d9568..bca6072042 100644
--- a/call/call.cc
+++ b/call/call.cc
@@ -465,19 +465,6 @@ class Call final : public webrtc::Call,
};
} // namespace internal
-std::string Call::Stats::ToString(int64_t time_ms) const {
- char buf[1024];
- rtc::SimpleStringBuilder ss(buf);
- ss << "Call stats: " << time_ms << ", {";
- ss << "send_bw_bps: " << send_bandwidth_bps << ", ";
- ss << "recv_bw_bps: " << recv_bandwidth_bps << ", ";
- ss << "max_pad_bps: " << max_padding_bitrate_bps << ", ";
- ss << "pacer_delay_ms: " << pacer_delay_ms << ", ";
- ss << "rtt_ms: " << rtt_ms;
- ss << '}';
- return ss.str();
-}
-
/* Mozilla: Avoid this since it could use GetRealTimeClock().
Call* Call::Create(const Call::Config& config) {
Clock* clock = Clock::GetRealTimeClock();
diff --git a/call/call.h b/call/call.h
index 366978392e..42daa95a6c 100644
--- a/call/call.h
+++ b/call/call.h
@@ -21,6 +21,7 @@
#include "api/task_queue/task_queue_base.h"
#include "call/audio_receive_stream.h"
#include "call/audio_send_stream.h"
+#include "call/call_basic_stats.h"
#include "call/call_config.h"
#include "call/flexfec_receive_stream.h"
#include "call/packet_receiver.h"
@@ -30,7 +31,6 @@
#include "rtc_base/copy_on_write_buffer.h"
#include "rtc_base/network/sent_packet.h"
#include "rtc_base/network_route.h"
-#include "rtc_base/ref_count.h"
namespace webrtc {
@@ -47,16 +47,7 @@ namespace webrtc {
class Call {
public:
using Config = CallConfig;
-
- struct Stats {
- std::string ToString(int64_t time_ms) const;
-
- int send_bandwidth_bps = 0; // Estimated available send bandwidth.
- int max_padding_bitrate_bps = 0; // Cumulative configured max padding.
- int recv_bandwidth_bps = 0; // Estimated available receive bandwidth.
- int64_t pacer_delay_ms = 0;
- int64_t rtt_ms = -1;
- };
+ using Stats = CallBasicStats;
static Call* Create(const Call::Config& config);
static Call* Create(const Call::Config& config,
diff --git a/call/call_basic_stats.cc b/call/call_basic_stats.cc
new file mode 100644
index 0000000000..74333a663b
--- /dev/null
+++ b/call/call_basic_stats.cc
@@ -0,0 +1,20 @@
+#include "call/call_basic_stats.h"
+
+#include "rtc_base/strings/string_builder.h"
+
+namespace webrtc {
+
+std::string CallBasicStats::ToString(int64_t time_ms) const {
+ char buf[1024];
+ rtc::SimpleStringBuilder ss(buf);
+ ss << "Call stats: " << time_ms << ", {";
+ ss << "send_bw_bps: " << send_bandwidth_bps << ", ";
+ ss << "recv_bw_bps: " << recv_bandwidth_bps << ", ";
+ ss << "max_pad_bps: " << max_padding_bitrate_bps << ", ";
+ ss << "pacer_delay_ms: " << pacer_delay_ms << ", ";
+ ss << "rtt_ms: " << rtt_ms;
+ ss << '}';
+ return ss.str();
+}
+
+} // namespace webrtc
diff --git a/call/call_basic_stats.h b/call/call_basic_stats.h
new file mode 100644
index 0000000000..98febe9405
--- /dev/null
+++ b/call/call_basic_stats.h
@@ -0,0 +1,21 @@
+#ifndef CALL_CALL_BASIC_STATS_H_
+#define CALL_CALL_BASIC_STATS_H_
+
+#include <string>
+
+namespace webrtc {
+
+// named to avoid conflicts with video/call_stats.h
+struct CallBasicStats {
+ std::string ToString(int64_t time_ms) const;
+
+ int send_bandwidth_bps = 0; // Estimated available send bandwidth.
+ int max_padding_bitrate_bps = 0; // Cumulative configured max padding.
+ int recv_bandwidth_bps = 0; // Estimated available receive bandwidth.
+ int64_t pacer_delay_ms = 0;
+ int64_t rtt_ms = -1;
+};
+
+} // namespace webrtc
+
+#endif // CALL_CALL_BASIC_STATS_H_
diff --git a/video/video_send_stream.h b/video/video_send_stream.h
index 1f4717fbec..55103ac979 100644
--- a/video/video_send_stream.h
+++ b/video/video_send_stream.h
@@ -36,7 +36,6 @@ namespace test {
class VideoSendStreamPeer;
} // namespace test
-class CallStats;
class IvfFileWriter;
class RateLimiter;
class RtpRtcp;
diff --git a/api/video_codecs/video_encoder.cc b/api/video_codecs/video_encoder.cc
index b0fe078b37..d2de985d5c 100644
--- a/api/video_codecs/video_encoder.cc
+++ b/api/video_codecs/video_encoder.cc
@@ -180,7 +180,15 @@ std::string VideoEncoder::EncoderInfo::ToString() const {
for (size_t i = 0; i < preferred_pixel_formats.size(); ++i) {
if (i > 0)
oss << ", ";
+#if defined(WEBRTC_MOZILLA_BUILD)
+ // This could assert, as opposed to throw using the form in the
+ // else, but since we're in a for loop that uses .size() we can
+ // be fairly sure that this is safe without doing a further
+ // check to make sure 'i' is in-range.
+ oss << VideoFrameBufferTypeToString(preferred_pixel_formats[i]);
+#else
oss << VideoFrameBufferTypeToString(preferred_pixel_formats.at(i));
+#endif
}
oss << "]";
if (is_qp_trusted.has_value()) {

Просмотреть файл

@ -1,29 +1,67 @@
From: Michael Froman <mjfroman@mac.com>
Date: Fri, 8 Apr 2022 11:36:36 -0500
Subject: Bug 1766646 - (fix-b556b08668) avoid InlinedVector method that can
throw exception
Date: Thu, 28 Apr 2022 10:53:43 -0500
Subject: Bug 1766646 - (fix-a0bb2ef2dc) add back VideoType enum values
---
api/video_codecs/video_encoder.cc | 8 ++++++++
1 file changed, 8 insertions(+)
common_video/libyuv/include/webrtc_libyuv.h | 3 +++
common_video/libyuv/webrtc_libyuv.cc | 9 +++++++++
2 files changed, 12 insertions(+)
diff --git a/api/video_codecs/video_encoder.cc b/api/video_codecs/video_encoder.cc
index b0fe078b37..d2de985d5c 100644
--- a/api/video_codecs/video_encoder.cc
+++ b/api/video_codecs/video_encoder.cc
@@ -180,7 +180,15 @@ std::string VideoEncoder::EncoderInfo::ToString() const {
for (size_t i = 0; i < preferred_pixel_formats.size(); ++i) {
if (i > 0)
oss << ", ";
+#if defined(WEBRTC_MOZILLA_BUILD)
+ // This could assert, as opposed to throw using the form in the
+ // else, but since we're in a for loop that uses .size() we can
+ // be fairly sure that this is safe without doing a further
+ // check to make sure 'i' is in-range.
+ oss << VideoFrameBufferTypeToString(preferred_pixel_formats[i]);
+#else
oss << VideoFrameBufferTypeToString(preferred_pixel_formats.at(i));
+#endif
diff --git a/common_video/libyuv/include/webrtc_libyuv.h b/common_video/libyuv/include/webrtc_libyuv.h
index 68831c70ab..253a33294d 100644
--- a/common_video/libyuv/include/webrtc_libyuv.h
+++ b/common_video/libyuv/include/webrtc_libyuv.h
@@ -35,11 +35,14 @@ enum class VideoType {
kBGR24,
kARGB,
kABGR,
+ kARGB4444,
kRGB565,
+ kARGB1555,
kYUY2,
kYV12,
kUYVY,
kMJPEG,
+ kNV21,
kBGRA,
kNV12,
};
diff --git a/common_video/libyuv/webrtc_libyuv.cc b/common_video/libyuv/webrtc_libyuv.cc
index 31ba1feca3..05a4b184c2 100644
--- a/common_video/libyuv/webrtc_libyuv.cc
+++ b/common_video/libyuv/webrtc_libyuv.cc
@@ -24,6 +24,7 @@ size_t CalcBufferSize(VideoType type, int width, int height) {
RTC_DCHECK_GE(height, 0);
switch (type) {
case VideoType::kI420:
+ case VideoType::kNV21:
case VideoType::kIYUV:
case VideoType::kYV12:
case VideoType::kNV12: {
@@ -31,7 +32,9 @@ size_t CalcBufferSize(VideoType type, int width, int height) {
int half_height = (height + 1) >> 1;
return width * height + half_width * half_height * 2;
}
+ case VideoType::kARGB4444:
case VideoType::kRGB565:
+ case VideoType::kARGB1555:
case VideoType::kYUY2:
case VideoType::kUYVY:
return width * height * 2;
@@ -104,10 +107,16 @@ int ConvertVideoType(VideoType video_type) {
return libyuv::FOURCC_UYVY;
case VideoType::kMJPEG:
return libyuv::FOURCC_MJPG;
+ case VideoType::kNV21:
+ return libyuv::FOURCC_NV21;
case VideoType::kARGB:
return libyuv::FOURCC_ARGB;
case VideoType::kBGRA:
return libyuv::FOURCC_BGRA;
+ case VideoType::kARGB4444:
+ return libyuv::FOURCC_R444;
+ case VideoType::kARGB1555:
+ return libyuv::FOURCC_RGBO;
case VideoType::kNV12:
return libyuv::FOURCC_NV12;
}
oss << "]";
if (is_qp_trusted.has_value()) {

Просмотреть файл

@ -1,67 +1,73 @@
From: Michael Froman <mjfroman@mac.com>
Date: Thu, 28 Apr 2022 10:53:43 -0500
Subject: Bug 1766646 - (fix-a0bb2ef2dc) add back VideoType enum values
Date: Thu, 19 May 2022 15:32:32 -0500
Subject: Bug 1772380 - Build 1766646 - (fix-c89fdd716c) fixes for the
refactored PlatformThread API;r?mjf
---
common_video/libyuv/include/webrtc_libyuv.h | 3 +++
common_video/libyuv/webrtc_libyuv.cc | 9 +++++++++
2 files changed, 12 insertions(+)
.../video_capture/linux/device_info_v4l2.cc | 20 ++++++-------------
.../video_capture/linux/device_info_v4l2.h | 3 +--
2 files changed, 7 insertions(+), 16 deletions(-)
diff --git a/common_video/libyuv/include/webrtc_libyuv.h b/common_video/libyuv/include/webrtc_libyuv.h
index 68831c70ab..253a33294d 100644
--- a/common_video/libyuv/include/webrtc_libyuv.h
+++ b/common_video/libyuv/include/webrtc_libyuv.h
@@ -35,11 +35,14 @@ enum class VideoType {
kBGR24,
kARGB,
kABGR,
+ kARGB4444,
kRGB565,
+ kARGB1555,
kYUY2,
kYV12,
kUYVY,
kMJPEG,
+ kNV21,
kBGRA,
kNV12,
};
diff --git a/common_video/libyuv/webrtc_libyuv.cc b/common_video/libyuv/webrtc_libyuv.cc
index 31ba1feca3..05a4b184c2 100644
--- a/common_video/libyuv/webrtc_libyuv.cc
+++ b/common_video/libyuv/webrtc_libyuv.cc
@@ -24,6 +24,7 @@ size_t CalcBufferSize(VideoType type, int width, int height) {
RTC_DCHECK_GE(height, 0);
switch (type) {
case VideoType::kI420:
+ case VideoType::kNV21:
case VideoType::kIYUV:
case VideoType::kYV12:
case VideoType::kNV12: {
@@ -31,7 +32,9 @@ size_t CalcBufferSize(VideoType type, int width, int height) {
int half_height = (height + 1) >> 1;
return width * height + half_width * half_height * 2;
diff --git a/modules/video_capture/linux/device_info_v4l2.cc b/modules/video_capture/linux/device_info_v4l2.cc
index c5d33ff9a4..04caaea592 100644
--- a/modules/video_capture/linux/device_info_v4l2.cc
+++ b/modules/video_capture/linux/device_info_v4l2.cc
@@ -151,11 +151,6 @@ int DeviceInfoV4l2::ProcessInotifyEvents()
return 0;
}
-void DeviceInfoV4l2::InotifyEventThread(void* obj)
-{
- static_cast<DeviceInfoLinux*> (obj)->InotifyProcess();
-}
-
void DeviceInfoV4l2::InotifyProcess()
{
_fd_v4l = inotify_init();
@@ -181,16 +176,14 @@ void DeviceInfoV4l2::InotifyProcess()
DeviceInfoV4l2::DeviceInfoV4l2() : DeviceInfoImpl()
#ifdef WEBRTC_LINUX
- , _inotifyEventThread(new rtc::PlatformThread(
- InotifyEventThread, this, "InotifyEventThread"))
, _isShutdown(false)
#endif
{
#ifdef WEBRTC_LINUX
- if (_inotifyEventThread)
- {
- _inotifyEventThread->Start();
- }
+ _inotifyEventThread = rtc::PlatformThread::SpawnJoinable(
+ [this] {
+ InotifyProcess();
+ }, "InotifyEventThread");
#endif
}
@@ -202,9 +195,8 @@ DeviceInfoV4l2::~DeviceInfoV4l2() {
#ifdef WEBRTC_LINUX
_isShutdown = true;
- if (_inotifyEventThread) {
- _inotifyEventThread->Stop();
- _inotifyEventThread = nullptr;
+ if (!_inotifyEventThread.empty()) {
+ _inotifyEventThread.Finalize();
}
+ case VideoType::kARGB4444:
case VideoType::kRGB565:
+ case VideoType::kARGB1555:
case VideoType::kYUY2:
case VideoType::kUYVY:
return width * height * 2;
@@ -104,10 +107,16 @@ int ConvertVideoType(VideoType video_type) {
return libyuv::FOURCC_UYVY;
case VideoType::kMJPEG:
return libyuv::FOURCC_MJPG;
+ case VideoType::kNV21:
+ return libyuv::FOURCC_NV21;
case VideoType::kARGB:
return libyuv::FOURCC_ARGB;
case VideoType::kBGRA:
return libyuv::FOURCC_BGRA;
+ case VideoType::kARGB4444:
+ return libyuv::FOURCC_R444;
+ case VideoType::kARGB1555:
+ return libyuv::FOURCC_RGBO;
case VideoType::kNV12:
return libyuv::FOURCC_NV12;
}
#endif
}
diff --git a/modules/video_capture/linux/device_info_v4l2.h b/modules/video_capture/linux/device_info_v4l2.h
index 119cb07ab8..0bec3eb765 100644
--- a/modules/video_capture/linux/device_info_v4l2.h
+++ b/modules/video_capture/linux/device_info_v4l2.h
@@ -60,8 +60,7 @@ class DeviceInfoV4l2 : public DeviceInfoImpl {
int EventCheck(int fd);
int HandleEvents(int fd);
int ProcessInotifyEvents();
- std::unique_ptr<rtc::PlatformThread> _inotifyEventThread;
- static void InotifyEventThread(void*);
+ rtc::PlatformThread _inotifyEventThread;
void InotifyProcess();
int _fd_v4l, _fd_dev, _wd_v4l, _wd_dev; /* accessed on InotifyEventThread thread */
std::atomic<bool> _isShutdown;

Просмотреть файл

@ -1,73 +1,171 @@
From: Michael Froman <mjfroman@mac.com>
Date: Thu, 19 May 2022 15:32:32 -0500
Subject: Bug 1772380 - Build 1766646 - (fix-c89fdd716c) fixes for the
refactored PlatformThread API;r?mjf
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Mon, 18 Jan 2021 11:07:00 +0100
Subject: Bug 1766646 - (fix-ae0d117d51) ifdef our Csrc impl vs upstream's
impl, see Bug 1771332.
---
.../video_capture/linux/device_info_v4l2.cc | 20 ++++++-------------
.../video_capture/linux/device_info_v4l2.h | 3 +--
2 files changed, 7 insertions(+), 16 deletions(-)
modules/rtp_rtcp/source/rtp_header_extensions.cc | 4 ++++
modules/rtp_rtcp/source/rtp_header_extensions.h | 4 ++++
modules/rtp_rtcp/source/rtp_packet.cc | 4 ++++
modules/rtp_rtcp/source/rtp_sender.cc | 4 ++++
test/fuzzers/rtp_packet_fuzzer.cc | 4 ++++
5 files changed, 20 insertions(+)
diff --git a/modules/video_capture/linux/device_info_v4l2.cc b/modules/video_capture/linux/device_info_v4l2.cc
index c5d33ff9a4..04caaea592 100644
--- a/modules/video_capture/linux/device_info_v4l2.cc
+++ b/modules/video_capture/linux/device_info_v4l2.cc
@@ -151,11 +151,6 @@ int DeviceInfoV4l2::ProcessInotifyEvents()
return 0;
diff --git a/modules/rtp_rtcp/source/rtp_header_extensions.cc b/modules/rtp_rtcp/source/rtp_header_extensions.cc
index b86a7d775c..ea41226abf 100644
--- a/modules/rtp_rtcp/source/rtp_header_extensions.cc
+++ b/modules/rtp_rtcp/source/rtp_header_extensions.cc
@@ -181,6 +181,7 @@ bool AudioLevel::Write(rtc::ArrayView<uint8_t> data,
return true;
}
-void DeviceInfoV4l2::InotifyEventThread(void* obj)
-{
- static_cast<DeviceInfoLinux*> (obj)->InotifyProcess();
-}
-
void DeviceInfoV4l2::InotifyProcess()
{
_fd_v4l = inotify_init();
@@ -181,16 +176,14 @@ void DeviceInfoV4l2::InotifyProcess()
+#if !defined(WEBRTC_MOZILLA_BUILD)
// An RTP Header Extension for Mixer-to-Client Audio Level Indication
//
// https://tools.ietf.org/html/rfc6465
@@ -230,6 +231,7 @@ bool CsrcAudioLevel::Write(rtc::ArrayView<uint8_t> data,
}
return true;
}
+#endif
DeviceInfoV4l2::DeviceInfoV4l2() : DeviceInfoImpl()
#ifdef WEBRTC_LINUX
- , _inotifyEventThread(new rtc::PlatformThread(
- InotifyEventThread, this, "InotifyEventThread"))
, _isShutdown(false)
#endif
{
#ifdef WEBRTC_LINUX
- if (_inotifyEventThread)
- {
- _inotifyEventThread->Start();
- }
+ _inotifyEventThread = rtc::PlatformThread::SpawnJoinable(
+ [this] {
+ InotifyProcess();
+ }, "InotifyEventThread");
#endif
// From RFC 5450: Transmission Time Offsets in RTP Streams.
//
@@ -423,6 +425,7 @@ bool PlayoutDelayLimits::Write(rtc::ArrayView<uint8_t> data,
return true;
}
@@ -202,9 +195,8 @@ DeviceInfoV4l2::~DeviceInfoV4l2() {
#ifdef WEBRTC_LINUX
_isShutdown = true;
+#if defined(WEBRTC_MOZILLA_BUILD)
// CSRCAudioLevel
// Sample Audio Level Encoding Using the One-Byte Header Format
// Note that the range of len is 1 to 15 which is encoded as 0 to 14
@@ -461,6 +464,7 @@ bool CsrcAudioLevel::Write(rtc::ArrayView<uint8_t> data,
// This extension if used must have at least one audio level
return csrcAudioLevels.numAudioLevels;
}
+#endif
- if (_inotifyEventThread) {
- _inotifyEventThread->Stop();
- _inotifyEventThread = nullptr;
+ if (!_inotifyEventThread.empty()) {
+ _inotifyEventThread.Finalize();
// Video Content Type.
//
diff --git a/modules/rtp_rtcp/source/rtp_header_extensions.h b/modules/rtp_rtcp/source/rtp_header_extensions.h
index fff7db0294..09bd9912e1 100644
--- a/modules/rtp_rtcp/source/rtp_header_extensions.h
+++ b/modules/rtp_rtcp/source/rtp_header_extensions.h
@@ -94,6 +94,7 @@ class AudioLevel {
uint8_t audio_level);
};
+#if !defined(WEBRTC_MOZILLA_BUILD)
class CsrcAudioLevel {
public:
static constexpr RTPExtensionType kId = kRtpExtensionCsrcAudioLevel;
@@ -108,6 +109,7 @@ class CsrcAudioLevel {
static bool Write(rtc::ArrayView<uint8_t> data,
rtc::ArrayView<const uint8_t> csrc_audio_levels);
};
+#endif
class TransmissionOffset {
public:
@@ -298,6 +300,7 @@ class ColorSpaceExtension {
static size_t WriteLuminance(uint8_t* data, float f, int denominator);
};
+#if defined(WEBRTC_MOZILLA_BUILD)
class CsrcAudioLevel {
public:
static constexpr RTPExtensionType kId = kRtpExtensionCsrcAudioLevel;
@@ -312,6 +315,7 @@ class CsrcAudioLevel {
static size_t ValueSize(const CsrcAudioLevelList& csrcAudioLevels);
static bool Write(rtc::ArrayView<uint8_t> data, const CsrcAudioLevelList& csrcAudioLevels);
};
+#endif
// Base extension class for RTP header extensions which are strings.
// Subclasses must defined kId and kUri static constexpr members.
diff --git a/modules/rtp_rtcp/source/rtp_packet.cc b/modules/rtp_rtcp/source/rtp_packet.cc
index b152cdbd9e..7181b303e1 100644
--- a/modules/rtp_rtcp/source/rtp_packet.cc
+++ b/modules/rtp_rtcp/source/rtp_packet.cc
@@ -187,7 +187,9 @@ void RtpPacket::ZeroMutableExtensions() {
break;
}
case RTPExtensionType::kRtpExtensionAudioLevel:
+#if !defined(WEBRTC_MOZILLA_BUILD)
case RTPExtensionType::kRtpExtensionCsrcAudioLevel:
+#endif
case RTPExtensionType::kRtpExtensionAbsoluteCaptureTime:
case RTPExtensionType::kRtpExtensionColorSpace:
case RTPExtensionType::kRtpExtensionGenericFrameDescriptor:
@@ -205,10 +207,12 @@ void RtpPacket::ZeroMutableExtensions() {
// Non-mutable extension. Don't change it.
break;
}
+#if defined(WEBRTC_MOZILLA_BUILD)
case RTPExtensionType::kRtpExtensionCsrcAudioLevel: {
// TODO: This is a Mozilla addition, we need to add a handler for this.
RTC_CHECK(false);
}
+#endif
}
#endif
}
}
diff --git a/modules/video_capture/linux/device_info_v4l2.h b/modules/video_capture/linux/device_info_v4l2.h
index 119cb07ab8..0bec3eb765 100644
--- a/modules/video_capture/linux/device_info_v4l2.h
+++ b/modules/video_capture/linux/device_info_v4l2.h
@@ -60,8 +60,7 @@ class DeviceInfoV4l2 : public DeviceInfoImpl {
int EventCheck(int fd);
int HandleEvents(int fd);
int ProcessInotifyEvents();
- std::unique_ptr<rtc::PlatformThread> _inotifyEventThread;
- static void InotifyEventThread(void*);
+ rtc::PlatformThread _inotifyEventThread;
void InotifyProcess();
int _fd_v4l, _fd_dev, _wd_v4l, _wd_dev; /* accessed on InotifyEventThread thread */
std::atomic<bool> _isShutdown;
diff --git a/modules/rtp_rtcp/source/rtp_sender.cc b/modules/rtp_rtcp/source/rtp_sender.cc
index f4ba024444..4972aa0802 100644
--- a/modules/rtp_rtcp/source/rtp_sender.cc
+++ b/modules/rtp_rtcp/source/rtp_sender.cc
@@ -104,7 +104,9 @@ bool IsNonVolatile(RTPExtensionType type) {
switch (type) {
case kRtpExtensionTransmissionTimeOffset:
case kRtpExtensionAudioLevel:
+#if !defined(WEBRTC_MOZILLA_BUILD)
case kRtpExtensionCsrcAudioLevel:
+#endif
case kRtpExtensionAbsoluteSendTime:
case kRtpExtensionTransportSequenceNumber:
case kRtpExtensionTransportSequenceNumber02:
@@ -128,10 +130,12 @@ bool IsNonVolatile(RTPExtensionType type) {
case kRtpExtensionNumberOfExtensions:
RTC_DCHECK_NOTREACHED();
return false;
+#if defined(WEBRTC_MOZILLA_BUILD)
case kRtpExtensionCsrcAudioLevel:
// TODO: Mozilla implement for CsrcAudioLevel
RTC_CHECK(false);
return false;
+#endif
}
RTC_CHECK_NOTREACHED();
}
diff --git a/test/fuzzers/rtp_packet_fuzzer.cc b/test/fuzzers/rtp_packet_fuzzer.cc
index 0e10a8fa3a..5d117529bb 100644
--- a/test/fuzzers/rtp_packet_fuzzer.cc
+++ b/test/fuzzers/rtp_packet_fuzzer.cc
@@ -77,11 +77,13 @@ void FuzzOneInput(const uint8_t* data, size_t size) {
uint8_t audio_level;
packet.GetExtension<AudioLevel>(&voice_activity, &audio_level);
break;
+#if !defined(WEBRTC_MOZILLA_BUILD)
case kRtpExtensionCsrcAudioLevel: {
std::vector<uint8_t> audio_levels;
packet.GetExtension<CsrcAudioLevel>(&audio_levels);
break;
}
+#endif
case kRtpExtensionAbsoluteSendTime:
uint32_t sendtime;
packet.GetExtension<AbsoluteSendTime>(&sendtime);
@@ -164,11 +166,13 @@ void FuzzOneInput(const uint8_t* data, size_t size) {
// This extension requires state to read and so complicated that
// deserves own fuzzer.
break;
+#if defined(WEBRTC_MOZILLA_BUILD)
case kRtpExtensionCsrcAudioLevel: {
CsrcAudioLevelList levels;
packet.GetExtension<CsrcAudioLevel>(&levels);
break;
}
+#endif
}
}

Просмотреть файл

@ -1,171 +1,22 @@
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Mon, 18 Jan 2021 11:07:00 +0100
Subject: Bug 1766646 - (fix-ae0d117d51) ifdef our Csrc impl vs upstream's
impl, see Bug 1771332.
From: Michael Froman <mjfroman@mac.com>
Date: Wed, 1 Jun 2022 12:47:00 -0500
Subject: Bug 1766646 - (fix-f137b75a4d) specify default constructor on
config.emplace(...)
---
modules/rtp_rtcp/source/rtp_header_extensions.cc | 4 ++++
modules/rtp_rtcp/source/rtp_header_extensions.h | 4 ++++
modules/rtp_rtcp/source/rtp_packet.cc | 4 ++++
modules/rtp_rtcp/source/rtp_sender.cc | 4 ++++
test/fuzzers/rtp_packet_fuzzer.cc | 4 ++++
5 files changed, 20 insertions(+)
modules/congestion_controller/goog_cc/loss_based_bwe_v2.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/rtp_rtcp/source/rtp_header_extensions.cc b/modules/rtp_rtcp/source/rtp_header_extensions.cc
index b86a7d775c..ea41226abf 100644
--- a/modules/rtp_rtcp/source/rtp_header_extensions.cc
+++ b/modules/rtp_rtcp/source/rtp_header_extensions.cc
@@ -181,6 +181,7 @@ bool AudioLevel::Write(rtc::ArrayView<uint8_t> data,
return true;
}
+#if !defined(WEBRTC_MOZILLA_BUILD)
// An RTP Header Extension for Mixer-to-Client Audio Level Indication
//
// https://tools.ietf.org/html/rfc6465
@@ -230,6 +231,7 @@ bool CsrcAudioLevel::Write(rtc::ArrayView<uint8_t> data,
diff --git a/modules/congestion_controller/goog_cc/loss_based_bwe_v2.cc b/modules/congestion_controller/goog_cc/loss_based_bwe_v2.cc
index 4c0f5fc5ee..1afac9fb42 100644
--- a/modules/congestion_controller/goog_cc/loss_based_bwe_v2.cc
+++ b/modules/congestion_controller/goog_cc/loss_based_bwe_v2.cc
@@ -468,7 +468,7 @@ absl::optional<LossBasedBweV2::Config> LossBasedBweV2::CreateConfig(
if (!enabled.Get()) {
return config;
}
return true;
}
+#endif
// From RFC 5450: Transmission Time Offsets in RTP Streams.
//
@@ -423,6 +425,7 @@ bool PlayoutDelayLimits::Write(rtc::ArrayView<uint8_t> data,
return true;
}
+#if defined(WEBRTC_MOZILLA_BUILD)
// CSRCAudioLevel
// Sample Audio Level Encoding Using the One-Byte Header Format
// Note that the range of len is 1 to 15 which is encoded as 0 to 14
@@ -461,6 +464,7 @@ bool CsrcAudioLevel::Write(rtc::ArrayView<uint8_t> data,
// This extension if used must have at least one audio level
return csrcAudioLevels.numAudioLevels;
}
+#endif
// Video Content Type.
//
diff --git a/modules/rtp_rtcp/source/rtp_header_extensions.h b/modules/rtp_rtcp/source/rtp_header_extensions.h
index fff7db0294..09bd9912e1 100644
--- a/modules/rtp_rtcp/source/rtp_header_extensions.h
+++ b/modules/rtp_rtcp/source/rtp_header_extensions.h
@@ -94,6 +94,7 @@ class AudioLevel {
uint8_t audio_level);
};
+#if !defined(WEBRTC_MOZILLA_BUILD)
class CsrcAudioLevel {
public:
static constexpr RTPExtensionType kId = kRtpExtensionCsrcAudioLevel;
@@ -108,6 +109,7 @@ class CsrcAudioLevel {
static bool Write(rtc::ArrayView<uint8_t> data,
rtc::ArrayView<const uint8_t> csrc_audio_levels);
};
+#endif
class TransmissionOffset {
public:
@@ -298,6 +300,7 @@ class ColorSpaceExtension {
static size_t WriteLuminance(uint8_t* data, float f, int denominator);
};
+#if defined(WEBRTC_MOZILLA_BUILD)
class CsrcAudioLevel {
public:
static constexpr RTPExtensionType kId = kRtpExtensionCsrcAudioLevel;
@@ -312,6 +315,7 @@ class CsrcAudioLevel {
static size_t ValueSize(const CsrcAudioLevelList& csrcAudioLevels);
static bool Write(rtc::ArrayView<uint8_t> data, const CsrcAudioLevelList& csrcAudioLevels);
};
+#endif
// Base extension class for RTP header extensions which are strings.
// Subclasses must defined kId and kUri static constexpr members.
diff --git a/modules/rtp_rtcp/source/rtp_packet.cc b/modules/rtp_rtcp/source/rtp_packet.cc
index b152cdbd9e..7181b303e1 100644
--- a/modules/rtp_rtcp/source/rtp_packet.cc
+++ b/modules/rtp_rtcp/source/rtp_packet.cc
@@ -187,7 +187,9 @@ void RtpPacket::ZeroMutableExtensions() {
break;
}
case RTPExtensionType::kRtpExtensionAudioLevel:
+#if !defined(WEBRTC_MOZILLA_BUILD)
case RTPExtensionType::kRtpExtensionCsrcAudioLevel:
+#endif
case RTPExtensionType::kRtpExtensionAbsoluteCaptureTime:
case RTPExtensionType::kRtpExtensionColorSpace:
case RTPExtensionType::kRtpExtensionGenericFrameDescriptor:
@@ -205,10 +207,12 @@ void RtpPacket::ZeroMutableExtensions() {
// Non-mutable extension. Don't change it.
break;
}
+#if defined(WEBRTC_MOZILLA_BUILD)
case RTPExtensionType::kRtpExtensionCsrcAudioLevel: {
// TODO: This is a Mozilla addition, we need to add a handler for this.
RTC_CHECK(false);
}
+#endif
}
}
}
diff --git a/modules/rtp_rtcp/source/rtp_sender.cc b/modules/rtp_rtcp/source/rtp_sender.cc
index f4ba024444..4972aa0802 100644
--- a/modules/rtp_rtcp/source/rtp_sender.cc
+++ b/modules/rtp_rtcp/source/rtp_sender.cc
@@ -104,7 +104,9 @@ bool IsNonVolatile(RTPExtensionType type) {
switch (type) {
case kRtpExtensionTransmissionTimeOffset:
case kRtpExtensionAudioLevel:
+#if !defined(WEBRTC_MOZILLA_BUILD)
case kRtpExtensionCsrcAudioLevel:
+#endif
case kRtpExtensionAbsoluteSendTime:
case kRtpExtensionTransportSequenceNumber:
case kRtpExtensionTransportSequenceNumber02:
@@ -128,10 +130,12 @@ bool IsNonVolatile(RTPExtensionType type) {
case kRtpExtensionNumberOfExtensions:
RTC_DCHECK_NOTREACHED();
return false;
+#if defined(WEBRTC_MOZILLA_BUILD)
case kRtpExtensionCsrcAudioLevel:
// TODO: Mozilla implement for CsrcAudioLevel
RTC_CHECK(false);
return false;
+#endif
}
RTC_CHECK_NOTREACHED();
}
diff --git a/test/fuzzers/rtp_packet_fuzzer.cc b/test/fuzzers/rtp_packet_fuzzer.cc
index 0e10a8fa3a..5d117529bb 100644
--- a/test/fuzzers/rtp_packet_fuzzer.cc
+++ b/test/fuzzers/rtp_packet_fuzzer.cc
@@ -77,11 +77,13 @@ void FuzzOneInput(const uint8_t* data, size_t size) {
uint8_t audio_level;
packet.GetExtension<AudioLevel>(&voice_activity, &audio_level);
break;
+#if !defined(WEBRTC_MOZILLA_BUILD)
case kRtpExtensionCsrcAudioLevel: {
std::vector<uint8_t> audio_levels;
packet.GetExtension<CsrcAudioLevel>(&audio_levels);
break;
}
+#endif
case kRtpExtensionAbsoluteSendTime:
uint32_t sendtime;
packet.GetExtension<AbsoluteSendTime>(&sendtime);
@@ -164,11 +166,13 @@ void FuzzOneInput(const uint8_t* data, size_t size) {
// This extension requires state to read and so complicated that
// deserves own fuzzer.
break;
+#if defined(WEBRTC_MOZILLA_BUILD)
case kRtpExtensionCsrcAudioLevel: {
CsrcAudioLevelList levels;
packet.GetExtension<CsrcAudioLevel>(&levels);
break;
}
+#endif
}
}
- config.emplace();
+ config.emplace(Config());
config->bandwidth_rampup_upper_bound_factor =
bandwidth_rampup_upper_bound_factor.Get();
config->rampup_acceleration_max_factor = rampup_acceleration_max_factor.Get();

Просмотреть файл

@ -1,22 +1,24 @@
From: Michael Froman <mjfroman@mac.com>
Date: Wed, 1 Jun 2022 12:47:00 -0500
Subject: Bug 1766646 - (fix-f137b75a4d) specify default constructor on
config.emplace(...)
Date: Tue, 21 Jun 2022 11:11:09 -0500
Subject: Bug 1773223 - Generate webrtc moz.builds for all platforms at once.
r=mjf,firefox-build-system-reviewers,ahochheiden
---
modules/congestion_controller/goog_cc/loss_based_bwe_v2.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
build_overrides/build.gni | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/modules/congestion_controller/goog_cc/loss_based_bwe_v2.cc b/modules/congestion_controller/goog_cc/loss_based_bwe_v2.cc
index 4c0f5fc5ee..1afac9fb42 100644
--- a/modules/congestion_controller/goog_cc/loss_based_bwe_v2.cc
+++ b/modules/congestion_controller/goog_cc/loss_based_bwe_v2.cc
@@ -468,7 +468,7 @@ absl::optional<LossBasedBweV2::Config> LossBasedBweV2::CreateConfig(
if (!enabled.Get()) {
return config;
}
- config.emplace();
+ config.emplace(Config());
config->bandwidth_rampup_upper_bound_factor =
bandwidth_rampup_upper_bound_factor.Get();
config->rampup_acceleration_max_factor = rampup_acceleration_max_factor.Get();
diff --git a/build_overrides/build.gni b/build_overrides/build.gni
index cfa795870a..2272b01871 100644
--- a/build_overrides/build.gni
+++ b/build_overrides/build.gni
@@ -47,6 +47,10 @@ if (host_os == "mac" || host_os == "linux") {
use_system_xcode = _result == 0
}
+use_system_xcode = false
+xcode_version = "10.15"
+mac_xcode_version = "default"
+
declare_args() {
# WebRTC doesn't depend on //base from production code but only for testing
# purposes. In any case, it doesn't depend on //third_party/perfetto which

Просмотреть файл

@ -1,24 +1,23 @@
From: Michael Froman <mjfroman@mac.com>
Date: Tue, 21 Jun 2022 11:11:09 -0500
Subject: Bug 1773223 - Generate webrtc moz.builds for all platforms at once.
r=mjf,firefox-build-system-reviewers,ahochheiden
Date: Tue, 21 Jun 2022 11:17:46 -0500
Subject: Bug 1772380 - to upstream - ref count this in lambda capture
---
build_overrides/build.gni | 4 ++++
1 file changed, 4 insertions(+)
modules/video_capture/linux/video_capture_v4l2.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/build_overrides/build.gni b/build_overrides/build.gni
index cfa795870a..2272b01871 100644
--- a/build_overrides/build.gni
+++ b/build_overrides/build.gni
@@ -47,6 +47,10 @@ if (host_os == "mac" || host_os == "linux") {
use_system_xcode = _result == 0
}
+use_system_xcode = false
+xcode_version = "10.15"
+mac_xcode_version = "default"
+
declare_args() {
# WebRTC doesn't depend on //base from production code but only for testing
# purposes. In any case, it doesn't depend on //third_party/perfetto which
diff --git a/modules/video_capture/linux/video_capture_v4l2.cc b/modules/video_capture/linux/video_capture_v4l2.cc
index 00cede01cb..d6813b13fd 100644
--- a/modules/video_capture/linux/video_capture_v4l2.cc
+++ b/modules/video_capture/linux/video_capture_v4l2.cc
@@ -296,8 +296,8 @@ int32_t VideoCaptureModuleV4L2::StartCapture(
if (_captureThread.empty()) {
quit_ = false;
_captureThread = rtc::PlatformThread::SpawnJoinable(
- [this] {
- while (CaptureProcess()) {
+ [self = rtc::scoped_refptr(this)] {
+ while (self->CaptureProcess()) {
}
},
"CaptureThread",

Просмотреть файл

@ -1,23 +1,48 @@
From: Michael Froman <mjfroman@mac.com>
Date: Tue, 21 Jun 2022 11:17:46 -0500
Subject: Bug 1772380 - to upstream - ref count this in lambda capture
Date: Wed, 3 Aug 2022 20:21:25 -0500
Subject: Bug 1780582 - work around generating VideoFrameBufferType;r=mjf
---
modules/video_capture/linux/video_capture_v4l2.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
.../api/org/webrtc/VideoFrameBufferType.java | 33 +++++++++++++++++++
1 file changed, 33 insertions(+)
create mode 100644 sdk/android/api/org/webrtc/VideoFrameBufferType.java
diff --git a/modules/video_capture/linux/video_capture_v4l2.cc b/modules/video_capture/linux/video_capture_v4l2.cc
index 00cede01cb..d6813b13fd 100644
--- a/modules/video_capture/linux/video_capture_v4l2.cc
+++ b/modules/video_capture/linux/video_capture_v4l2.cc
@@ -296,8 +296,8 @@ int32_t VideoCaptureModuleV4L2::StartCapture(
if (_captureThread.empty()) {
quit_ = false;
_captureThread = rtc::PlatformThread::SpawnJoinable(
- [this] {
- while (CaptureProcess()) {
+ [self = rtc::scoped_refptr(this)] {
+ while (self->CaptureProcess()) {
}
},
"CaptureThread",
diff --git a/sdk/android/api/org/webrtc/VideoFrameBufferType.java b/sdk/android/api/org/webrtc/VideoFrameBufferType.java
new file mode 100644
index 0000000000..7b05b88cba
--- /dev/null
+++ b/sdk/android/api/org/webrtc/VideoFrameBufferType.java
@@ -0,0 +1,33 @@
+
+// Copyright 2022 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This file is autogenerated by
+// java_cpp_enum.py
+// From
+// ../../api/video/video_frame_buffer.h
+
+package org.webrtc;
+
+import androidx.annotation.IntDef;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@IntDef({
+ VideoFrameBufferType.NATIVE, VideoFrameBufferType.I420, VideoFrameBufferType.I420A,
+ VideoFrameBufferType.I422, VideoFrameBufferType.I444, VideoFrameBufferType.I010,
+ VideoFrameBufferType.I210, VideoFrameBufferType.NV12
+})
+@Retention(RetentionPolicy.SOURCE)
+public @interface VideoFrameBufferType {
+ int NATIVE = 0;
+ int I420 = 1;
+ int I420A = 2;
+ int I422 = 3;
+ int I444 = 4;
+ int I010 = 5;
+ int I210 = 6;
+ int NV12 = 7;
+}

Просмотреть файл

@ -1,48 +1,53 @@
From: Michael Froman <mjfroman@mac.com>
Date: Wed, 3 Aug 2022 20:21:25 -0500
Subject: Bug 1780582 - work around generating VideoFrameBufferType;r=mjf
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Mon, 5 Sep 2022 13:56:00 +0000
Subject: Bug 1786502 - Lock access to DeviceInfo devicechange callbacks.
r=webrtc-reviewers,jib
Differential Revision: https://phabricator.services.mozilla.com/D155365
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/e826dfadfe1264c59d9b13e3c17d6f75a40f5c33
---
.../api/org/webrtc/VideoFrameBufferType.java | 33 +++++++++++++++++++
1 file changed, 33 insertions(+)
create mode 100644 sdk/android/api/org/webrtc/VideoFrameBufferType.java
modules/video_capture/video_capture.h | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/sdk/android/api/org/webrtc/VideoFrameBufferType.java b/sdk/android/api/org/webrtc/VideoFrameBufferType.java
new file mode 100644
index 0000000000..7b05b88cba
--- /dev/null
+++ b/sdk/android/api/org/webrtc/VideoFrameBufferType.java
@@ -0,0 +1,33 @@
+
+// Copyright 2022 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This file is autogenerated by
+// java_cpp_enum.py
+// From
+// ../../api/video/video_frame_buffer.h
+
+package org.webrtc;
+
+import androidx.annotation.IntDef;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@IntDef({
+ VideoFrameBufferType.NATIVE, VideoFrameBufferType.I420, VideoFrameBufferType.I420A,
+ VideoFrameBufferType.I422, VideoFrameBufferType.I444, VideoFrameBufferType.I010,
+ VideoFrameBufferType.I210, VideoFrameBufferType.NV12
+})
+@Retention(RetentionPolicy.SOURCE)
+public @interface VideoFrameBufferType {
+ int NATIVE = 0;
+ int I420 = 1;
+ int I420A = 2;
+ int I422 = 3;
+ int I444 = 4;
+ int I010 = 5;
+ int I210 = 6;
+ int NV12 = 7;
+}
diff --git a/modules/video_capture/video_capture.h b/modules/video_capture/video_capture.h
index 58485f28e9..04203033b0 100644
--- a/modules/video_capture/video_capture.h
+++ b/modules/video_capture/video_capture.h
@@ -16,6 +16,8 @@
#include "modules/desktop_capture/desktop_capture_types.h"
#include "modules/video_capture/raw_video_sink_interface.h"
#include "modules/video_capture/video_capture_defines.h"
+#include "rtc_base/synchronization/mutex.h"
+#include "rtc_base/thread_annotations.h"
#include <set>
#if defined(ANDROID)
@@ -40,15 +42,18 @@ class VideoCaptureModule : public rtc::RefCountInterface {
virtual uint32_t NumberOfDevices() = 0;
virtual int32_t Refresh() = 0;
virtual void DeviceChange() {
+ MutexLock lock(&_inputCallbacksMutex);
for (auto inputCallBack : _inputCallBacks) {
inputCallBack->OnDeviceChange();
}
}
virtual void RegisterVideoInputFeedBack(VideoInputFeedBack* callBack) {
+ MutexLock lock(&_inputCallbacksMutex);
_inputCallBacks.insert(callBack);
}
virtual void DeRegisterVideoInputFeedBack(VideoInputFeedBack* callBack) {
+ MutexLock lock(&_inputCallbacksMutex);
auto it = _inputCallBacks.find(callBack);
if (it != _inputCallBacks.end()) {
_inputCallBacks.erase(it);
@@ -102,7 +107,8 @@ class VideoCaptureModule : public rtc::RefCountInterface {
virtual ~DeviceInfo() {}
private:
- std::set<VideoInputFeedBack*> _inputCallBacks;
+ Mutex _inputCallbacksMutex;
+ std::set<VideoInputFeedBack*> _inputCallBacks RTC_GUARDED_BY(_inputCallbacksMutex);
};
// Register capture data callback

Просмотреть файл

@ -1,53 +1,49 @@
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Mon, 5 Sep 2022 13:56:00 +0000
Subject: Bug 1786502 - Lock access to DeviceInfo devicechange callbacks.
r=webrtc-reviewers,jib
From: Michael Froman <mfroman@mozilla.com>
Date: Mon, 24 Oct 2022 13:00:00 -0500
Subject: Bug 1797161 - pt1 - tweak BUILD.gn around task_queue_win usage. r?ng!
Differential Revision: https://phabricator.services.mozilla.com/D155365
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/e826dfadfe1264c59d9b13e3c17d6f75a40f5c33
Add assurance that we will not build task_queue_win.cc to avoid
possible win32k API usage.
Differential Revision: https://phabricator.services.mozilla.com/D160115
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/f097eb8cbd8b7686ce306a46a4db691194fd39c1
---
modules/video_capture/video_capture.h | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
api/task_queue/BUILD.gn | 5 +++++
rtc_base/BUILD.gn | 4 ++++
2 files changed, 9 insertions(+)
diff --git a/modules/video_capture/video_capture.h b/modules/video_capture/video_capture.h
index 58485f28e9..04203033b0 100644
--- a/modules/video_capture/video_capture.h
+++ b/modules/video_capture/video_capture.h
@@ -16,6 +16,8 @@
#include "modules/desktop_capture/desktop_capture_types.h"
#include "modules/video_capture/raw_video_sink_interface.h"
#include "modules/video_capture/video_capture_defines.h"
+#include "rtc_base/synchronization/mutex.h"
+#include "rtc_base/thread_annotations.h"
#include <set>
diff --git a/api/task_queue/BUILD.gn b/api/task_queue/BUILD.gn
index 392158b5ce..94a2127907 100644
--- a/api/task_queue/BUILD.gn
+++ b/api/task_queue/BUILD.gn
@@ -31,6 +31,11 @@ rtc_library("task_queue") {
]
}
#if defined(ANDROID)
@@ -40,15 +42,18 @@ class VideoCaptureModule : public rtc::RefCountInterface {
virtual uint32_t NumberOfDevices() = 0;
virtual int32_t Refresh() = 0;
virtual void DeviceChange() {
+ MutexLock lock(&_inputCallbacksMutex);
for (auto inputCallBack : _inputCallBacks) {
inputCallBack->OnDeviceChange();
}
}
virtual void RegisterVideoInputFeedBack(VideoInputFeedBack* callBack) {
+ MutexLock lock(&_inputCallbacksMutex);
_inputCallBacks.insert(callBack);
}
virtual void DeRegisterVideoInputFeedBack(VideoInputFeedBack* callBack) {
+ MutexLock lock(&_inputCallbacksMutex);
auto it = _inputCallBacks.find(callBack);
if (it != _inputCallBacks.end()) {
_inputCallBacks.erase(it);
@@ -102,7 +107,8 @@ class VideoCaptureModule : public rtc::RefCountInterface {
virtual ~DeviceInfo() {}
private:
- std::set<VideoInputFeedBack*> _inputCallBacks;
+ Mutex _inputCallbacksMutex;
+ std::set<VideoInputFeedBack*> _inputCallBacks RTC_GUARDED_BY(_inputCallbacksMutex);
};
// Register capture data callback
+# Mozilla - we want to ensure that rtc_include_tests is set to false
+# to guarantee that default_task_queue_factory is not used so we
+# know that remaining win32k code in task_queue_win.cc is not built.
+# See Bug 1797161 for more info.
+assert(!rtc_include_tests, "Mozilla - verify rtc_include_tests is off")
if (rtc_include_tests) {
rtc_library("task_queue_test") {
visibility = [ "*" ]
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
index be06a9d16b..0a8baabc11 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
@@ -738,10 +738,14 @@ if (is_mac || is_ios) {
if (is_win) {
rtc_library("rtc_task_queue_win") {
visibility = [ "../api/task_queue:default_task_queue_factory" ]
+# See Bug 1797161 for more info. Remove from build until win32k
+# usage is removed.
+if (!build_with_mozilla) {
sources = [
"task_queue_win.cc",
"task_queue_win.h",
]
+}
deps = [
":checks",
":logging",

Просмотреть файл

@ -1,49 +1,31 @@
From: Michael Froman <mfroman@mozilla.com>
Date: Mon, 24 Oct 2022 13:00:00 -0500
Subject: Bug 1797161 - pt1 - tweak BUILD.gn around task_queue_win usage. r?ng!
Date: Mon, 24 Oct 2022 14:03:00 -0500
Subject: Bug 1797161 - pt3 - add static_assert to ensure we don't include
task_queue_win.cc in Mozilla builds. r?ng!
Add assurance that we will not build task_queue_win.cc to avoid
possible win32k API usage.
Differential Revision: https://phabricator.services.mozilla.com/D160115
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/f097eb8cbd8b7686ce306a46a4db691194fd39c1
Differential Revision: https://phabricator.services.mozilla.com/D160117
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/50b15e036924203147e34ec20e2689fe4a847645
---
api/task_queue/BUILD.gn | 5 +++++
rtc_base/BUILD.gn | 4 ++++
2 files changed, 9 insertions(+)
rtc_base/task_queue_win.cc | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/api/task_queue/BUILD.gn b/api/task_queue/BUILD.gn
index 392158b5ce..94a2127907 100644
--- a/api/task_queue/BUILD.gn
+++ b/api/task_queue/BUILD.gn
@@ -31,6 +31,11 @@ rtc_library("task_queue") {
]
}
diff --git a/rtc_base/task_queue_win.cc b/rtc_base/task_queue_win.cc
index 7e46d58e27..bf55a25c69 100644
--- a/rtc_base/task_queue_win.cc
+++ b/rtc_base/task_queue_win.cc
@@ -8,6 +8,15 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+# Mozilla - we want to ensure that rtc_include_tests is set to false
+# to guarantee that default_task_queue_factory is not used so we
+# know that remaining win32k code in task_queue_win.cc is not built.
+# See Bug 1797161 for more info.
+assert(!rtc_include_tests, "Mozilla - verify rtc_include_tests is off")
if (rtc_include_tests) {
rtc_library("task_queue_test") {
visibility = [ "*" ]
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
index be06a9d16b..0a8baabc11 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
@@ -738,10 +738,14 @@ if (is_mac || is_ios) {
if (is_win) {
rtc_library("rtc_task_queue_win") {
visibility = [ "../api/task_queue:default_task_queue_factory" ]
+# See Bug 1797161 for more info. Remove from build until win32k
+# usage is removed.
+if (!build_with_mozilla) {
sources = [
"task_queue_win.cc",
"task_queue_win.h",
]
+}
deps = [
":checks",
":logging",
+// Mozilla - this file should not be included in Mozilla builds until
+// win32k API usage is removed. This was once done in Bug 1395259, but
+// the upstreaming attempt stalled. Until win32k usage is officially
+// removed upstream, we have reverted to upstream's version of the file
+// (to reduce or elminate merge conflicts), and a static assert is
+// placed here to ensure this file isn't accidentally included in the
+// Mozilla build.
+static_assert(false, "This file should not be built, see Bug 1797161.");
+
#include "rtc_base/task_queue_win.h"
// clang-format off

Просмотреть файл

@ -1,31 +1,78 @@
From: Michael Froman <mfroman@mozilla.com>
Date: Mon, 24 Oct 2022 14:03:00 -0500
Subject: Bug 1797161 - pt3 - add static_assert to ensure we don't include
task_queue_win.cc in Mozilla builds. r?ng!
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Mon, 12 Dec 2022 15:47:00 +0000
Subject: Bug 1451394 - Expose mac camera capture backend in .gn and switch it
to gecko libyuv. r=webrtc-reviewers,mjf
Differential Revision: https://phabricator.services.mozilla.com/D160117
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/50b15e036924203147e34ec20e2689fe4a847645
Differential Revision: https://phabricator.services.mozilla.com/D163682
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/b0658888969395dca938597783c8a377b9bea209
---
rtc_base/task_queue_win.cc | 9 +++++++++
1 file changed, 9 insertions(+)
BUILD.gn | 4 ++++
sdk/BUILD.gn | 6 ++++++
2 files changed, 10 insertions(+)
diff --git a/rtc_base/task_queue_win.cc b/rtc_base/task_queue_win.cc
index 7e46d58e27..bf55a25c69 100644
--- a/rtc_base/task_queue_win.cc
+++ b/rtc_base/task_queue_win.cc
@@ -8,6 +8,15 @@
* be found in the AUTHORS file in the root of the source tree.
*/
diff --git a/BUILD.gn b/BUILD.gn
index d507eb86b8..8eba4e650c 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -592,6 +592,10 @@ if (!build_with_chromium) {
]
}
+// Mozilla - this file should not be included in Mozilla builds until
+// win32k API usage is removed. This was once done in Bug 1395259, but
+// the upstreaming attempt stalled. Until win32k usage is officially
+// removed upstream, we have reverted to upstream's version of the file
+// (to reduce or elminate merge conflicts), and a static assert is
+// placed here to ensure this file isn't accidentally included in the
+// Mozilla build.
+static_assert(false, "This file should not be built, see Bug 1797161.");
+ if (build_with_mozilla && is_mac) {
+ deps += [ "sdk:videocapture_objc" ]
+ }
+
#include "rtc_base/task_queue_win.h"
if (rtc_enable_protobuf) {
deps += [ "logging:rtc_event_log_proto" ]
}
diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn
index 4f5ceb5ed3..eea26dc31d 100644
--- a/sdk/BUILD.gn
+++ b/sdk/BUILD.gn
@@ -533,6 +533,7 @@ if (is_ios || is_mac) {
}
}
// clang-format off
+ if (!build_with_mozilla) {
rtc_library("videosource_objc") {
sources = [
"objc/api/peerconnection/RTCVideoSource+Private.h",
@@ -562,6 +563,7 @@ if (is_ios || is_mac) {
":used_from_extension",
]
}
+ }
rtc_library("videoframebuffer_objc") {
visibility = [ "*" ]
@@ -594,6 +596,7 @@ if (is_ios || is_mac) {
]
}
+ if (!build_with_mozilla) {
rtc_library("metal_objc") {
visibility = [ "*" ]
allow_poison = [
@@ -655,6 +658,7 @@ if (is_ios || is_mac) {
":videoframebuffer_objc",
]
}
+ }
rtc_library("videocapture_objc") {
visibility = [ "*" ]
@@ -683,6 +687,7 @@ if (is_ios || is_mac) {
]
}
+ if (!build_with_mozilla) {
rtc_library("videocodec_objc") {
visibility = [ "*" ]
configs += [ "..:no_global_constructors" ]
@@ -1729,5 +1734,6 @@ if (is_ios || is_mac) {
"VideoToolbox.framework",
]
}
+ }
}
}

Просмотреть файл

@ -1,78 +1,28 @@
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Mon, 12 Dec 2022 15:47:00 +0000
Subject: Bug 1451394 - Expose mac camera capture backend in .gn and switch it
to gecko libyuv. r=webrtc-reviewers,mjf
Subject: Bug 1451394 - Record video frame captures with PerformanceRecorder in
the new mac camera backend. r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D163682
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/b0658888969395dca938597783c8a377b9bea209
Also includes:
Bug 1806605 - Pass TrackingId instead of nsCString to CaptureStage.
Differential Revision: https://phabricator.services.mozilla.com/D163687
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/a7362238c9e6fbe0d28200f6b41fc40a0c9a2158
---
BUILD.gn | 4 ++++
sdk/BUILD.gn | 6 ++++++
2 files changed, 10 insertions(+)
modules/video_capture/video_capture.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/BUILD.gn b/BUILD.gn
index d507eb86b8..8eba4e650c 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -592,6 +592,10 @@ if (!build_with_chromium) {
]
}
diff --git a/modules/video_capture/video_capture.h b/modules/video_capture/video_capture.h
index 04203033b0..6614032299 100644
--- a/modules/video_capture/video_capture.h
+++ b/modules/video_capture/video_capture.h
@@ -154,6 +154,9 @@ class VideoCaptureModule : public rtc::RefCountInterface {
// Return whether the rotation is applied or left pending.
virtual bool GetApplyRotation() = 0;
+ if (build_with_mozilla && is_mac) {
+ deps += [ "sdk:videocapture_objc" ]
+ }
+ // Mozilla: TrackingId setter for use in profiler markers.
+ virtual void SetTrackingId(uint32_t aTrackingIdProcId) {}
+
if (rtc_enable_protobuf) {
deps += [ "logging:rtc_event_log_proto" ]
}
diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn
index 4f5ceb5ed3..eea26dc31d 100644
--- a/sdk/BUILD.gn
+++ b/sdk/BUILD.gn
@@ -533,6 +533,7 @@ if (is_ios || is_mac) {
}
}
+ if (!build_with_mozilla) {
rtc_library("videosource_objc") {
sources = [
"objc/api/peerconnection/RTCVideoSource+Private.h",
@@ -562,6 +563,7 @@ if (is_ios || is_mac) {
":used_from_extension",
]
}
+ }
rtc_library("videoframebuffer_objc") {
visibility = [ "*" ]
@@ -594,6 +596,7 @@ if (is_ios || is_mac) {
]
}
+ if (!build_with_mozilla) {
rtc_library("metal_objc") {
visibility = [ "*" ]
allow_poison = [
@@ -655,6 +658,7 @@ if (is_ios || is_mac) {
":videoframebuffer_objc",
]
}
+ }
rtc_library("videocapture_objc") {
visibility = [ "*" ]
@@ -683,6 +687,7 @@ if (is_ios || is_mac) {
]
}
+ if (!build_with_mozilla) {
rtc_library("videocodec_objc") {
visibility = [ "*" ]
configs += [ "..:no_global_constructors" ]
@@ -1729,5 +1734,6 @@ if (is_ios || is_mac) {
"VideoToolbox.framework",
]
}
+ }
}
}
protected:
~VideoCaptureModule() override {}
};

Просмотреть файл

@ -1,28 +1,346 @@
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Mon, 12 Dec 2022 15:47:00 +0000
Subject: Bug 1451394 - Record video frame captures with PerformanceRecorder in
the new mac camera backend. r=padenot
Date: Tue, 23 Nov 2021 14:11:00 +0000
Subject: Bug 1742181 - libwebrtc: Implement packetsDiscarded bookkeeping for
received video. r=ng
Depends on D131707
Differential Revision: https://phabricator.services.mozilla.com/D131708
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/d0196a45a1f449874fc2a759e85e403c45c25575
Also includes:
Bug 1806605 - Pass TrackingId instead of nsCString to CaptureStage.
Differential Revision: https://phabricator.services.mozilla.com/D163687
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/a7362238c9e6fbe0d28200f6b41fc40a0c9a2158
Bug 1804288 - (fix-de7ae5755b) reimplement Bug 1742181 - libwebrtc: Implement packetsDiscarded bookkeeping for received video. r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D163959
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/ee566d1bfb654d36e5d58dce637fb0580b989ac1
---
modules/video_capture/video_capture.h | 3 +++
1 file changed, 3 insertions(+)
api/video/frame_buffer.cc | 25 ++++++++++++++++++++++---
api/video/frame_buffer.h | 4 ++++
call/video_receive_stream.h | 2 ++
modules/video_coding/packet_buffer.cc | 10 +++++++---
modules/video_coding/packet_buffer.h | 5 ++++-
video/receive_statistics_proxy.cc | 5 +++++
video/receive_statistics_proxy.h | 1 +
video/rtp_video_stream_receiver2.cc | 5 ++++-
video/rtp_video_stream_receiver2.h | 3 +++
video/video_receive_stream2.cc | 1 +
video/video_stream_buffer_controller.cc | 12 ++++++++++++
video/video_stream_buffer_controller.h | 5 +++++
12 files changed, 70 insertions(+), 8 deletions(-)
diff --git a/modules/video_capture/video_capture.h b/modules/video_capture/video_capture.h
index 04203033b0..6614032299 100644
--- a/modules/video_capture/video_capture.h
+++ b/modules/video_capture/video_capture.h
@@ -154,6 +154,9 @@ class VideoCaptureModule : public rtc::RefCountInterface {
// Return whether the rotation is applied or left pending.
virtual bool GetApplyRotation() = 0;
diff --git a/api/video/frame_buffer.cc b/api/video/frame_buffer.cc
index 4cdf2212a6..8267b8e6cb 100644
--- a/api/video/frame_buffer.cc
+++ b/api/video/frame_buffer.cc
@@ -140,14 +140,29 @@ void FrameBuffer::DropNextDecodableTemporalUnit() {
}
+ // Mozilla: TrackingId setter for use in profiler markers.
+ virtual void SetTrackingId(uint32_t aTrackingIdProcId) {}
auto end_it = std::next(next_decodable_temporal_unit_->last_frame);
- num_dropped_frames_ += std::count_if(
- frames_.begin(), end_it,
- [](const auto& f) { return f.second.encoded_frame != nullptr; });
+
protected:
~VideoCaptureModule() override {}
+ UpdateDroppedFramesAndDiscardedPackets(frames_.begin(), end_it);
frames_.erase(frames_.begin(), end_it);
FindNextAndLastDecodableTemporalUnit();
}
+void FrameBuffer::UpdateDroppedFramesAndDiscardedPackets(FrameIterator begin_it,
+ FrameIterator end_it) {
+ unsigned int num_discarded_packets = 0;
+ unsigned int num_dropped_frames =
+ std::count_if(begin_it, end_it, [&](const auto& f) {
+ if (f.second.encoded_frame) {
+ const auto& packetInfos = f.second.encoded_frame->PacketInfos();
+ num_discarded_packets += packetInfos.size();
+ }
+ return f.second.encoded_frame != nullptr;
+ });
+
+ num_dropped_frames_ += num_dropped_frames;
+ num_discarded_packets_ += num_discarded_packets;
+}
+
absl::optional<int64_t> FrameBuffer::LastContinuousFrameId() const {
return last_continuous_frame_id_;
}
@@ -167,6 +182,9 @@ int FrameBuffer::GetTotalNumberOfContinuousTemporalUnits() const {
int FrameBuffer::GetTotalNumberOfDroppedFrames() const {
return num_dropped_frames_;
}
+int FrameBuffer::GetTotalNumberOfDiscardedPackets() const {
+ return num_discarded_packets_;
+}
size_t FrameBuffer::CurrentSize() const {
return frames_.size();
@@ -269,6 +287,7 @@ void FrameBuffer::FindNextAndLastDecodableTemporalUnit() {
}
void FrameBuffer::Clear() {
+ UpdateDroppedFramesAndDiscardedPackets(frames_.begin(), frames_.end());
frames_.clear();
next_decodable_temporal_unit_.reset();
decodable_temporal_units_info_.reset();
diff --git a/api/video/frame_buffer.h b/api/video/frame_buffer.h
index 94edf64d5a..81fd12da58 100644
--- a/api/video/frame_buffer.h
+++ b/api/video/frame_buffer.h
@@ -66,6 +66,7 @@ class FrameBuffer {
int GetTotalNumberOfContinuousTemporalUnits() const;
int GetTotalNumberOfDroppedFrames() const;
+ int GetTotalNumberOfDiscardedPackets() const;
size_t CurrentSize() const;
private:
@@ -87,6 +88,8 @@ class FrameBuffer {
void PropagateContinuity(const FrameIterator& frame_it);
void FindNextAndLastDecodableTemporalUnit();
void Clear();
+ void UpdateDroppedFramesAndDiscardedPackets(FrameIterator begin_it,
+ FrameIterator end_it);
const bool legacy_frame_id_jump_behavior_;
const size_t max_size_;
@@ -99,6 +102,7 @@ class FrameBuffer {
int num_continuous_temporal_units_ = 0;
int num_dropped_frames_ = 0;
+ int num_discarded_packets_ = 0;
};
} // namespace webrtc
diff --git a/call/video_receive_stream.h b/call/video_receive_stream.h
index 87ee39e142..0dc7dee71d 100644
--- a/call/video_receive_stream.h
+++ b/call/video_receive_stream.h
@@ -112,6 +112,8 @@ class VideoReceiveStreamInterface : public MediaReceiveStreamInterface {
// https://www.w3.org/TR/webrtc-stats/#dom-rtcvideoreceiverstats-framesdropped
uint32_t frames_dropped = 0;
uint32_t frames_decoded = 0;
+ // https://w3c.github.io/webrtc-stats/#dom-rtcreceivedrtpstreamstats-packetsdiscarded
+ uint64_t packets_discarded = 0;
// https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-totaldecodetime
TimeDelta total_decode_time = TimeDelta::Zero();
// https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-totalprocessingdelay
diff --git a/modules/video_coding/packet_buffer.cc b/modules/video_coding/packet_buffer.cc
index 52ef5c2d85..be45db6ef0 100644
--- a/modules/video_coding/packet_buffer.cc
+++ b/modules/video_coding/packet_buffer.cc
@@ -115,25 +115,27 @@ PacketBuffer::InsertResult PacketBuffer::InsertPacket(
return result;
}
-void PacketBuffer::ClearTo(uint16_t seq_num) {
+uint32_t PacketBuffer::ClearTo(uint16_t seq_num) {
// We have already cleared past this sequence number, no need to do anything.
if (is_cleared_to_first_seq_num_ &&
AheadOf<uint16_t>(first_seq_num_, seq_num)) {
- return;
+ return 0;
}
// If the packet buffer was cleared between a frame was created and returned.
if (!first_packet_received_)
- return;
+ return 0;
// Avoid iterating over the buffer more than once by capping the number of
// iterations to the `size_` of the buffer.
++seq_num;
+ uint32_t num_cleared_packets = 0;
size_t diff = ForwardDiff<uint16_t>(first_seq_num_, seq_num);
size_t iterations = std::min(diff, buffer_.size());
for (size_t i = 0; i < iterations; ++i) {
auto& stored = buffer_[first_seq_num_ % buffer_.size()];
if (stored != nullptr && AheadOf<uint16_t>(seq_num, stored->seq_num)) {
+ ++num_cleared_packets;
stored = nullptr;
}
++first_seq_num_;
@@ -149,6 +151,8 @@ void PacketBuffer::ClearTo(uint16_t seq_num) {
received_padding_.erase(received_padding_.begin(),
received_padding_.lower_bound(seq_num));
+
+ return num_cleared_packets;
}
void PacketBuffer::Clear() {
diff --git a/modules/video_coding/packet_buffer.h b/modules/video_coding/packet_buffer.h
index 53e08c95a1..47b2ffe199 100644
--- a/modules/video_coding/packet_buffer.h
+++ b/modules/video_coding/packet_buffer.h
@@ -78,7 +78,10 @@ class PacketBuffer {
ABSL_MUST_USE_RESULT InsertResult
InsertPacket(std::unique_ptr<Packet> packet);
ABSL_MUST_USE_RESULT InsertResult InsertPadding(uint16_t seq_num);
- void ClearTo(uint16_t seq_num);
+
+ // Clear all packets older than |seq_num|. Returns the number of packets
+ // cleared.
+ uint32_t ClearTo(uint16_t seq_num);
void Clear();
void ForceSpsPpsIdrIsH264Keyframe();
diff --git a/video/receive_statistics_proxy.cc b/video/receive_statistics_proxy.cc
index 75512a2465..8ef4d553ad 100644
--- a/video/receive_statistics_proxy.cc
+++ b/video/receive_statistics_proxy.cc
@@ -799,6 +799,11 @@ void ReceiveStatisticsProxy::OnDroppedFrames(uint32_t frames_dropped) {
}));
}
+void ReceiveStatisticsProxy::OnDiscardedPackets(uint32_t packets_discarded) {
+ RTC_DCHECK_RUN_ON(&main_thread_);
+ stats_.packets_discarded += packets_discarded;
+}
+
void ReceiveStatisticsProxy::OnPreDecode(VideoCodecType codec_type, int qp) {
RTC_DCHECK_RUN_ON(&main_thread_);
last_codec_type_ = codec_type;
diff --git a/video/receive_statistics_proxy.h b/video/receive_statistics_proxy.h
index 8e4941f961..7bcfc7c057 100644
--- a/video/receive_statistics_proxy.h
+++ b/video/receive_statistics_proxy.h
@@ -94,6 +94,7 @@ class ReceiveStatisticsProxy : public VideoStreamBufferControllerStatsObserver,
void OnDecodableFrame(TimeDelta jitter_buffer_delay,
TimeDelta target_delay,
TimeDelta minimum_delay) override;
+ void OnDiscardedPackets(uint32_t packets_discarded) override;
void OnFrameBufferTimingsUpdated(int estimated_max_decode_time_ms,
int current_delay_ms,
int target_delay_ms,
diff --git a/video/rtp_video_stream_receiver2.cc b/video/rtp_video_stream_receiver2.cc
index ebfdf2b695..0c4f5e30af 100644
--- a/video/rtp_video_stream_receiver2.cc
+++ b/video/rtp_video_stream_receiver2.cc
@@ -244,6 +244,7 @@ RtpVideoStreamReceiver2::RtpVideoStreamReceiver2(
RtcpPacketTypeCounterObserver* rtcp_packet_type_counter_observer,
RtcpCnameCallback* rtcp_cname_callback,
NackPeriodicProcessor* nack_periodic_processor,
+ VideoStreamBufferControllerStatsObserver* vcm_receive_statistics,
OnCompleteFrameCallback* complete_frame_callback,
rtc::scoped_refptr<FrameDecryptorInterface> frame_decryptor,
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer,
@@ -292,6 +293,7 @@ RtpVideoStreamReceiver2::RtpVideoStreamReceiver2(
&rtcp_feedback_buffer_,
&rtcp_feedback_buffer_,
field_trials_)),
+ vcm_receive_statistics_(vcm_receive_statistics),
packet_buffer_(kPacketBufferStartSize,
PacketBufferMaxSize(field_trials_)),
reference_finder_(std::make_unique<RtpFrameReferenceFinder>()),
@@ -1213,7 +1215,8 @@ void RtpVideoStreamReceiver2::FrameDecoded(int64_t picture_id) {
int64_t unwrapped_rtp_seq_num = rtp_seq_num_unwrapper_.Unwrap(seq_num);
packet_infos_.erase(packet_infos_.begin(),
packet_infos_.upper_bound(unwrapped_rtp_seq_num));
- packet_buffer_.ClearTo(seq_num);
+ uint32_t num_packets_cleared = packet_buffer_.ClearTo(seq_num);
+ vcm_receive_statistics_->OnDiscardedPackets(num_packets_cleared);
reference_finder_->ClearTo(seq_num);
}
}
diff --git a/video/rtp_video_stream_receiver2.h b/video/rtp_video_stream_receiver2.h
index 0e96d7f2cd..10329005ba 100644
--- a/video/rtp_video_stream_receiver2.h
+++ b/video/rtp_video_stream_receiver2.h
@@ -49,6 +49,7 @@
#include "rtc_base/thread_annotations.h"
#include "video/buffered_frame_decryptor.h"
#include "video/unique_timestamp_counter.h"
+#include "video/video_stream_buffer_controller.h"
namespace webrtc {
@@ -91,6 +92,7 @@ class RtpVideoStreamReceiver2 : public LossNotificationSender,
RtcpPacketTypeCounterObserver* rtcp_packet_type_counter_observer,
RtcpCnameCallback* rtcp_cname_callback,
NackPeriodicProcessor* nack_periodic_processor,
+ VideoStreamBufferControllerStatsObserver* vcm_receive_statistics,
// The KeyFrameRequestSender is optional; if not provided, key frame
// requests are sent via the internal RtpRtcp module.
OnCompleteFrameCallback* complete_frame_callback,
@@ -362,6 +364,7 @@ class RtpVideoStreamReceiver2 : public LossNotificationSender,
std::unique_ptr<LossNotificationController> loss_notification_controller_
RTC_GUARDED_BY(packet_sequence_checker_);
+ VideoStreamBufferControllerStatsObserver* const vcm_receive_statistics_;
video_coding::PacketBuffer packet_buffer_
RTC_GUARDED_BY(packet_sequence_checker_);
UniqueTimestampCounter frame_counter_
diff --git a/video/video_receive_stream2.cc b/video/video_receive_stream2.cc
index 2067f255f7..85cc0aa0dc 100644
--- a/video/video_receive_stream2.cc
+++ b/video/video_receive_stream2.cc
@@ -210,6 +210,7 @@ VideoReceiveStream2::VideoReceiveStream2(
&stats_proxy_,
&stats_proxy_,
nack_periodic_processor,
+ &stats_proxy_,
this, // OnCompleteFrameCallback
std::move(config_.frame_decryptor),
std::move(config_.frame_transformer),
diff --git a/video/video_stream_buffer_controller.cc b/video/video_stream_buffer_controller.cc
index 455f064b01..20588fbcad 100644
--- a/video/video_stream_buffer_controller.cc
+++ b/video/video_stream_buffer_controller.cc
@@ -263,6 +263,7 @@ void VideoStreamBufferController::OnFrameReady(
// Update stats.
UpdateDroppedFrames();
+ UpdateDiscardedPackets();
UpdateFrameBufferTimings(min_receive_time, now);
UpdateTimingFrameInfo();
@@ -328,6 +329,17 @@ void VideoStreamBufferController::UpdateDroppedFrames()
buffer_->GetTotalNumberOfDroppedFrames();
}
+void VideoStreamBufferController::UpdateDiscardedPackets()
+ RTC_RUN_ON(&worker_sequence_checker_) {
+ const int discarded_packets = buffer_->GetTotalNumberOfDiscardedPackets() -
+ packets_discarded_before_last_new_frame_;
+ if (discarded_packets > 0) {
+ stats_proxy_->OnDiscardedPackets(discarded_packets);
+ }
+ packets_discarded_before_last_new_frame_ =
+ buffer_->GetTotalNumberOfDiscardedPackets();
+}
+
void VideoStreamBufferController::UpdateFrameBufferTimings(
Timestamp min_receive_time,
Timestamp now) {
diff --git a/video/video_stream_buffer_controller.h b/video/video_stream_buffer_controller.h
index f8793851dd..e89977d1ed 100644
--- a/video/video_stream_buffer_controller.h
+++ b/video/video_stream_buffer_controller.h
@@ -53,6 +53,8 @@ class VideoStreamBufferControllerStatsObserver {
TimeDelta target_delay,
TimeDelta minimum_delay) = 0;
+ virtual void OnDiscardedPackets(uint32_t packets_discarded) = 0;
+
// Various jitter buffer delays determined by VCMTiming.
virtual void OnFrameBufferTimingsUpdated(int estimated_max_decode_time_ms,
int current_delay_ms,
@@ -95,6 +97,7 @@ class VideoStreamBufferController {
void OnTimeout(TimeDelta delay);
void FrameReadyForDecode(uint32_t rtp_timestamp, Timestamp render_time);
void UpdateDroppedFrames() RTC_RUN_ON(&worker_sequence_checker_);
+ void UpdateDiscardedPackets() RTC_RUN_ON(&worker_sequence_checker_);
void UpdateFrameBufferTimings(Timestamp min_receive_time, Timestamp now);
void UpdateTimingFrameInfo();
bool IsTooManyFramesQueued() const RTC_RUN_ON(&worker_sequence_checker_);
@@ -123,6 +126,8 @@ class VideoStreamBufferController {
RTC_GUARDED_BY(&worker_sequence_checker_);
int frames_dropped_before_last_new_frame_
RTC_GUARDED_BY(&worker_sequence_checker_) = 0;
+ int packets_discarded_before_last_new_frame_
+ RTC_GUARDED_BY(&worker_sequence_checker_) = 0;
VCMVideoProtection protection_mode_
RTC_GUARDED_BY(&worker_sequence_checker_) = kProtectionNack;

Просмотреть файл

@ -1,346 +1,46 @@
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Tue, 23 Nov 2021 14:11:00 +0000
Subject: Bug 1742181 - libwebrtc: Implement packetsDiscarded bookkeeping for
received video. r=ng
Date: Thu, 6 Jan 2022 00:16:00 +0000
Subject: Bug 1748478 - Propagate calculated discarded packets to stats. r=bwc
Depends on D131707
Differential Revision: https://phabricator.services.mozilla.com/D131708
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/d0196a45a1f449874fc2a759e85e403c45c25575
Also includes:
Bug 1804288 - (fix-de7ae5755b) reimplement Bug 1742181 - libwebrtc: Implement packetsDiscarded bookkeeping for received video. r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D163959
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/ee566d1bfb654d36e5d58dce637fb0580b989ac1
Differential Revision: https://phabricator.services.mozilla.com/D135061
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/56fbf0469e25fa0d589c51ca112ce534a7c0ab91
---
api/video/frame_buffer.cc | 25 ++++++++++++++++++++++---
api/video/frame_buffer.h | 4 ++++
call/video_receive_stream.h | 2 ++
modules/video_coding/packet_buffer.cc | 10 +++++++---
modules/video_coding/packet_buffer.h | 5 ++++-
video/receive_statistics_proxy.cc | 5 +++++
video/receive_statistics_proxy.h | 1 +
video/rtp_video_stream_receiver2.cc | 5 ++++-
video/rtp_video_stream_receiver2.h | 3 +++
video/video_receive_stream2.cc | 1 +
video/video_stream_buffer_controller.cc | 12 ++++++++++++
video/video_stream_buffer_controller.h | 5 +++++
12 files changed, 70 insertions(+), 8 deletions(-)
video/receive_statistics_proxy.cc | 9 +++++++--
video/rtp_video_stream_receiver2.cc | 4 +++-
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/api/video/frame_buffer.cc b/api/video/frame_buffer.cc
index 4cdf2212a6..8267b8e6cb 100644
--- a/api/video/frame_buffer.cc
+++ b/api/video/frame_buffer.cc
@@ -140,14 +140,29 @@ void FrameBuffer::DropNextDecodableTemporalUnit() {
}
auto end_it = std::next(next_decodable_temporal_unit_->last_frame);
- num_dropped_frames_ += std::count_if(
- frames_.begin(), end_it,
- [](const auto& f) { return f.second.encoded_frame != nullptr; });
+
+ UpdateDroppedFramesAndDiscardedPackets(frames_.begin(), end_it);
frames_.erase(frames_.begin(), end_it);
FindNextAndLastDecodableTemporalUnit();
}
+void FrameBuffer::UpdateDroppedFramesAndDiscardedPackets(FrameIterator begin_it,
+ FrameIterator end_it) {
+ unsigned int num_discarded_packets = 0;
+ unsigned int num_dropped_frames =
+ std::count_if(begin_it, end_it, [&](const auto& f) {
+ if (f.second.encoded_frame) {
+ const auto& packetInfos = f.second.encoded_frame->PacketInfos();
+ num_discarded_packets += packetInfos.size();
+ }
+ return f.second.encoded_frame != nullptr;
+ });
+
+ num_dropped_frames_ += num_dropped_frames;
+ num_discarded_packets_ += num_discarded_packets;
+}
+
absl::optional<int64_t> FrameBuffer::LastContinuousFrameId() const {
return last_continuous_frame_id_;
}
@@ -167,6 +182,9 @@ int FrameBuffer::GetTotalNumberOfContinuousTemporalUnits() const {
int FrameBuffer::GetTotalNumberOfDroppedFrames() const {
return num_dropped_frames_;
}
+int FrameBuffer::GetTotalNumberOfDiscardedPackets() const {
+ return num_discarded_packets_;
+}
size_t FrameBuffer::CurrentSize() const {
return frames_.size();
@@ -269,6 +287,7 @@ void FrameBuffer::FindNextAndLastDecodableTemporalUnit() {
}
void FrameBuffer::Clear() {
+ UpdateDroppedFramesAndDiscardedPackets(frames_.begin(), frames_.end());
frames_.clear();
next_decodable_temporal_unit_.reset();
decodable_temporal_units_info_.reset();
diff --git a/api/video/frame_buffer.h b/api/video/frame_buffer.h
index 94edf64d5a..81fd12da58 100644
--- a/api/video/frame_buffer.h
+++ b/api/video/frame_buffer.h
@@ -66,6 +66,7 @@ class FrameBuffer {
int GetTotalNumberOfContinuousTemporalUnits() const;
int GetTotalNumberOfDroppedFrames() const;
+ int GetTotalNumberOfDiscardedPackets() const;
size_t CurrentSize() const;
private:
@@ -87,6 +88,8 @@ class FrameBuffer {
void PropagateContinuity(const FrameIterator& frame_it);
void FindNextAndLastDecodableTemporalUnit();
void Clear();
+ void UpdateDroppedFramesAndDiscardedPackets(FrameIterator begin_it,
+ FrameIterator end_it);
const bool legacy_frame_id_jump_behavior_;
const size_t max_size_;
@@ -99,6 +102,7 @@ class FrameBuffer {
int num_continuous_temporal_units_ = 0;
int num_dropped_frames_ = 0;
+ int num_discarded_packets_ = 0;
};
} // namespace webrtc
diff --git a/call/video_receive_stream.h b/call/video_receive_stream.h
index 87ee39e142..0dc7dee71d 100644
--- a/call/video_receive_stream.h
+++ b/call/video_receive_stream.h
@@ -112,6 +112,8 @@ class VideoReceiveStreamInterface : public MediaReceiveStreamInterface {
// https://www.w3.org/TR/webrtc-stats/#dom-rtcvideoreceiverstats-framesdropped
uint32_t frames_dropped = 0;
uint32_t frames_decoded = 0;
+ // https://w3c.github.io/webrtc-stats/#dom-rtcreceivedrtpstreamstats-packetsdiscarded
+ uint64_t packets_discarded = 0;
// https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-totaldecodetime
TimeDelta total_decode_time = TimeDelta::Zero();
// https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-totalprocessingdelay
diff --git a/modules/video_coding/packet_buffer.cc b/modules/video_coding/packet_buffer.cc
index 52ef5c2d85..be45db6ef0 100644
--- a/modules/video_coding/packet_buffer.cc
+++ b/modules/video_coding/packet_buffer.cc
@@ -115,25 +115,27 @@ PacketBuffer::InsertResult PacketBuffer::InsertPacket(
return result;
}
-void PacketBuffer::ClearTo(uint16_t seq_num) {
+uint32_t PacketBuffer::ClearTo(uint16_t seq_num) {
// We have already cleared past this sequence number, no need to do anything.
if (is_cleared_to_first_seq_num_ &&
AheadOf<uint16_t>(first_seq_num_, seq_num)) {
- return;
+ return 0;
}
// If the packet buffer was cleared between a frame was created and returned.
if (!first_packet_received_)
- return;
+ return 0;
// Avoid iterating over the buffer more than once by capping the number of
// iterations to the `size_` of the buffer.
++seq_num;
+ uint32_t num_cleared_packets = 0;
size_t diff = ForwardDiff<uint16_t>(first_seq_num_, seq_num);
size_t iterations = std::min(diff, buffer_.size());
for (size_t i = 0; i < iterations; ++i) {
auto& stored = buffer_[first_seq_num_ % buffer_.size()];
if (stored != nullptr && AheadOf<uint16_t>(seq_num, stored->seq_num)) {
+ ++num_cleared_packets;
stored = nullptr;
}
++first_seq_num_;
@@ -149,6 +151,8 @@ void PacketBuffer::ClearTo(uint16_t seq_num) {
received_padding_.erase(received_padding_.begin(),
received_padding_.lower_bound(seq_num));
+
+ return num_cleared_packets;
}
void PacketBuffer::Clear() {
diff --git a/modules/video_coding/packet_buffer.h b/modules/video_coding/packet_buffer.h
index 53e08c95a1..47b2ffe199 100644
--- a/modules/video_coding/packet_buffer.h
+++ b/modules/video_coding/packet_buffer.h
@@ -78,7 +78,10 @@ class PacketBuffer {
ABSL_MUST_USE_RESULT InsertResult
InsertPacket(std::unique_ptr<Packet> packet);
ABSL_MUST_USE_RESULT InsertResult InsertPadding(uint16_t seq_num);
- void ClearTo(uint16_t seq_num);
+
+ // Clear all packets older than |seq_num|. Returns the number of packets
+ // cleared.
+ uint32_t ClearTo(uint16_t seq_num);
void Clear();
void ForceSpsPpsIdrIsH264Keyframe();
diff --git a/video/receive_statistics_proxy.cc b/video/receive_statistics_proxy.cc
index 75512a2465..8ef4d553ad 100644
index 8ef4d553ad..a0f19999d8 100644
--- a/video/receive_statistics_proxy.cc
+++ b/video/receive_statistics_proxy.cc
@@ -799,6 +799,11 @@ void ReceiveStatisticsProxy::OnDroppedFrames(uint32_t frames_dropped) {
}));
@@ -800,8 +800,13 @@ void ReceiveStatisticsProxy::OnDroppedFrames(uint32_t frames_dropped) {
}
void ReceiveStatisticsProxy::OnDiscardedPackets(uint32_t packets_discarded) {
- RTC_DCHECK_RUN_ON(&main_thread_);
- stats_.packets_discarded += packets_discarded;
+ // Can be called on either the decode queue or the worker thread
+ // See FrameBuffer2 for more details.
+ worker_thread_->PostTask(
+ SafeTask(task_safety_.flag(), [packets_discarded, this]() {
+ RTC_DCHECK_RUN_ON(&main_thread_);
+ stats_.packets_discarded += packets_discarded;
+ }));
}
+void ReceiveStatisticsProxy::OnDiscardedPackets(uint32_t packets_discarded) {
+ RTC_DCHECK_RUN_ON(&main_thread_);
+ stats_.packets_discarded += packets_discarded;
+}
+
void ReceiveStatisticsProxy::OnPreDecode(VideoCodecType codec_type, int qp) {
RTC_DCHECK_RUN_ON(&main_thread_);
last_codec_type_ = codec_type;
diff --git a/video/receive_statistics_proxy.h b/video/receive_statistics_proxy.h
index 8e4941f961..7bcfc7c057 100644
--- a/video/receive_statistics_proxy.h
+++ b/video/receive_statistics_proxy.h
@@ -94,6 +94,7 @@ class ReceiveStatisticsProxy : public VideoStreamBufferControllerStatsObserver,
void OnDecodableFrame(TimeDelta jitter_buffer_delay,
TimeDelta target_delay,
TimeDelta minimum_delay) override;
+ void OnDiscardedPackets(uint32_t packets_discarded) override;
void OnFrameBufferTimingsUpdated(int estimated_max_decode_time_ms,
int current_delay_ms,
int target_delay_ms,
diff --git a/video/rtp_video_stream_receiver2.cc b/video/rtp_video_stream_receiver2.cc
index ebfdf2b695..0c4f5e30af 100644
index 0c4f5e30af..d906b0b2df 100644
--- a/video/rtp_video_stream_receiver2.cc
+++ b/video/rtp_video_stream_receiver2.cc
@@ -244,6 +244,7 @@ RtpVideoStreamReceiver2::RtpVideoStreamReceiver2(
RtcpPacketTypeCounterObserver* rtcp_packet_type_counter_observer,
RtcpCnameCallback* rtcp_cname_callback,
NackPeriodicProcessor* nack_periodic_processor,
+ VideoStreamBufferControllerStatsObserver* vcm_receive_statistics,
OnCompleteFrameCallback* complete_frame_callback,
rtc::scoped_refptr<FrameDecryptorInterface> frame_decryptor,
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer,
@@ -292,6 +293,7 @@ RtpVideoStreamReceiver2::RtpVideoStreamReceiver2(
&rtcp_feedback_buffer_,
&rtcp_feedback_buffer_,
field_trials_)),
+ vcm_receive_statistics_(vcm_receive_statistics),
packet_buffer_(kPacketBufferStartSize,
PacketBufferMaxSize(field_trials_)),
reference_finder_(std::make_unique<RtpFrameReferenceFinder>()),
@@ -1213,7 +1215,8 @@ void RtpVideoStreamReceiver2::FrameDecoded(int64_t picture_id) {
int64_t unwrapped_rtp_seq_num = rtp_seq_num_unwrapper_.Unwrap(seq_num);
@@ -1216,7 +1216,9 @@ void RtpVideoStreamReceiver2::FrameDecoded(int64_t picture_id) {
packet_infos_.erase(packet_infos_.begin(),
packet_infos_.upper_bound(unwrapped_rtp_seq_num));
- packet_buffer_.ClearTo(seq_num);
+ uint32_t num_packets_cleared = packet_buffer_.ClearTo(seq_num);
+ vcm_receive_statistics_->OnDiscardedPackets(num_packets_cleared);
uint32_t num_packets_cleared = packet_buffer_.ClearTo(seq_num);
- vcm_receive_statistics_->OnDiscardedPackets(num_packets_cleared);
+ if (num_packets_cleared > 0) {
+ vcm_receive_statistics_->OnDiscardedPackets(num_packets_cleared);
+ }
reference_finder_->ClearTo(seq_num);
}
}
diff --git a/video/rtp_video_stream_receiver2.h b/video/rtp_video_stream_receiver2.h
index 0e96d7f2cd..10329005ba 100644
--- a/video/rtp_video_stream_receiver2.h
+++ b/video/rtp_video_stream_receiver2.h
@@ -49,6 +49,7 @@
#include "rtc_base/thread_annotations.h"
#include "video/buffered_frame_decryptor.h"
#include "video/unique_timestamp_counter.h"
+#include "video/video_stream_buffer_controller.h"
namespace webrtc {
@@ -91,6 +92,7 @@ class RtpVideoStreamReceiver2 : public LossNotificationSender,
RtcpPacketTypeCounterObserver* rtcp_packet_type_counter_observer,
RtcpCnameCallback* rtcp_cname_callback,
NackPeriodicProcessor* nack_periodic_processor,
+ VideoStreamBufferControllerStatsObserver* vcm_receive_statistics,
// The KeyFrameRequestSender is optional; if not provided, key frame
// requests are sent via the internal RtpRtcp module.
OnCompleteFrameCallback* complete_frame_callback,
@@ -362,6 +364,7 @@ class RtpVideoStreamReceiver2 : public LossNotificationSender,
std::unique_ptr<LossNotificationController> loss_notification_controller_
RTC_GUARDED_BY(packet_sequence_checker_);
+ VideoStreamBufferControllerStatsObserver* const vcm_receive_statistics_;
video_coding::PacketBuffer packet_buffer_
RTC_GUARDED_BY(packet_sequence_checker_);
UniqueTimestampCounter frame_counter_
diff --git a/video/video_receive_stream2.cc b/video/video_receive_stream2.cc
index 2067f255f7..85cc0aa0dc 100644
--- a/video/video_receive_stream2.cc
+++ b/video/video_receive_stream2.cc
@@ -210,6 +210,7 @@ VideoReceiveStream2::VideoReceiveStream2(
&stats_proxy_,
&stats_proxy_,
nack_periodic_processor,
+ &stats_proxy_,
this, // OnCompleteFrameCallback
std::move(config_.frame_decryptor),
std::move(config_.frame_transformer),
diff --git a/video/video_stream_buffer_controller.cc b/video/video_stream_buffer_controller.cc
index 455f064b01..20588fbcad 100644
--- a/video/video_stream_buffer_controller.cc
+++ b/video/video_stream_buffer_controller.cc
@@ -263,6 +263,7 @@ void VideoStreamBufferController::OnFrameReady(
// Update stats.
UpdateDroppedFrames();
+ UpdateDiscardedPackets();
UpdateFrameBufferTimings(min_receive_time, now);
UpdateTimingFrameInfo();
@@ -328,6 +329,17 @@ void VideoStreamBufferController::UpdateDroppedFrames()
buffer_->GetTotalNumberOfDroppedFrames();
}
+void VideoStreamBufferController::UpdateDiscardedPackets()
+ RTC_RUN_ON(&worker_sequence_checker_) {
+ const int discarded_packets = buffer_->GetTotalNumberOfDiscardedPackets() -
+ packets_discarded_before_last_new_frame_;
+ if (discarded_packets > 0) {
+ stats_proxy_->OnDiscardedPackets(discarded_packets);
+ }
+ packets_discarded_before_last_new_frame_ =
+ buffer_->GetTotalNumberOfDiscardedPackets();
+}
+
void VideoStreamBufferController::UpdateFrameBufferTimings(
Timestamp min_receive_time,
Timestamp now) {
diff --git a/video/video_stream_buffer_controller.h b/video/video_stream_buffer_controller.h
index f8793851dd..e89977d1ed 100644
--- a/video/video_stream_buffer_controller.h
+++ b/video/video_stream_buffer_controller.h
@@ -53,6 +53,8 @@ class VideoStreamBufferControllerStatsObserver {
TimeDelta target_delay,
TimeDelta minimum_delay) = 0;
+ virtual void OnDiscardedPackets(uint32_t packets_discarded) = 0;
+
// Various jitter buffer delays determined by VCMTiming.
virtual void OnFrameBufferTimingsUpdated(int estimated_max_decode_time_ms,
int current_delay_ms,
@@ -95,6 +97,7 @@ class VideoStreamBufferController {
void OnTimeout(TimeDelta delay);
void FrameReadyForDecode(uint32_t rtp_timestamp, Timestamp render_time);
void UpdateDroppedFrames() RTC_RUN_ON(&worker_sequence_checker_);
+ void UpdateDiscardedPackets() RTC_RUN_ON(&worker_sequence_checker_);
void UpdateFrameBufferTimings(Timestamp min_receive_time, Timestamp now);
void UpdateTimingFrameInfo();
bool IsTooManyFramesQueued() const RTC_RUN_ON(&worker_sequence_checker_);
@@ -123,6 +126,8 @@ class VideoStreamBufferController {
RTC_GUARDED_BY(&worker_sequence_checker_);
int frames_dropped_before_last_new_frame_
RTC_GUARDED_BY(&worker_sequence_checker_) = 0;
+ int packets_discarded_before_last_new_frame_
+ RTC_GUARDED_BY(&worker_sequence_checker_) = 0;
VCMVideoProtection protection_mode_
RTC_GUARDED_BY(&worker_sequence_checker_) = kProtectionNack;

Просмотреть файл

@ -1,46 +1,221 @@
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Thu, 6 Jan 2022 00:16:00 +0000
Subject: Bug 1748478 - Propagate calculated discarded packets to stats. r=bwc
Subject: Bug 1748458 - Add TRACE_EVENTs for dropped frames and packets for
received video. r=bwc
Differential Revision: https://phabricator.services.mozilla.com/D135061
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/56fbf0469e25fa0d589c51ca112ce534a7c0ab91
This lets us see in the profiler how many received frames and packets we decide
to drop and the reasons why.
Differential Revision: https://phabricator.services.mozilla.com/D135062
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/08e252da94c4752eccfd845eef13d8517953cc6a
Also includes:
Bug 1804288 - (fix-de7ae5755b) reimplement Bug 1748458 - Add TRACE_EVENTs for dropped frames and packets for received video. r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D163960
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/8e9a326a99cd5eaa6e447ff57c01ad9d79a09744
---
video/receive_statistics_proxy.cc | 9 +++++++--
video/rtp_video_stream_receiver2.cc | 4 +++-
2 files changed, 10 insertions(+), 3 deletions(-)
api/video/frame_buffer.cc | 33 +++++++++++++++++++++++++
video/receive_statistics_proxy.cc | 11 +++++++++
video/rtp_video_stream_receiver2.cc | 4 +++
video/video_stream_buffer_controller.cc | 7 ++++++
4 files changed, 55 insertions(+)
diff --git a/api/video/frame_buffer.cc b/api/video/frame_buffer.cc
index 8267b8e6cb..f5d93f5f76 100644
--- a/api/video/frame_buffer.cc
+++ b/api/video/frame_buffer.cc
@@ -16,6 +16,7 @@
#include "absl/container/inlined_vector.h"
#include "rtc_base/logging.h"
#include "rtc_base/numerics/sequence_number_util.h"
+#include "rtc_base/trace_event.h"
namespace webrtc {
namespace {
@@ -68,7 +69,12 @@ FrameBuffer::FrameBuffer(int max_size,
decoded_frame_history_(max_decode_history) {}
bool FrameBuffer::InsertFrame(std::unique_ptr<EncodedFrame> frame) {
+ const uint32_t ssrc =
+ frame->PacketInfos().empty() ? 0 : frame->PacketInfos()[0].ssrc();
if (!ValidReferences(*frame)) {
+ TRACE_EVENT2("webrtc",
+ "FrameBuffer::InsertFrame Frame dropped (Invalid references)",
+ "remote_ssrc", ssrc, "frame_id", frame->Id());
RTC_DLOG(LS_WARNING) << "Frame " << frame->Id()
<< " has invalid references, dropping frame.";
return false;
@@ -78,23 +84,35 @@ bool FrameBuffer::InsertFrame(std::unique_ptr<EncodedFrame> frame) {
if (legacy_frame_id_jump_behavior_ && frame->is_keyframe() &&
AheadOf(frame->Timestamp(),
*decoded_frame_history_.GetLastDecodedFrameTimestamp())) {
+ TRACE_EVENT2("webrtc",
+ "FrameBuffer::InsertFrame Frames dropped (OOO + PicId jump)",
+ "remote_ssrc", ssrc, "frame_id", frame->Id());
RTC_DLOG(LS_WARNING)
<< "Keyframe " << frame->Id()
<< " has newer timestamp but older picture id, clearing buffer.";
Clear();
} else {
// Already decoded past this frame.
+ TRACE_EVENT2("webrtc",
+ "FrameBuffer::InsertFrame Frame dropped (Out of order)",
+ "remote_ssrc", ssrc, "frame_id", frame->Id());
return false;
}
}
if (frames_.size() == max_size_) {
if (frame->is_keyframe()) {
+ TRACE_EVENT2("webrtc",
+ "FrameBuffer::InsertFrame Frames dropped (KF + Full buffer)",
+ "remote_ssrc", ssrc, "frame_id", frame->Id());
RTC_DLOG(LS_WARNING) << "Keyframe " << frame->Id()
<< " inserted into full buffer, clearing buffer.";
Clear();
} else {
// No space for this frame.
+ TRACE_EVENT2("webrtc",
+ "FrameBuffer::InsertFrame Frame dropped (Full buffer)",
+ "remote_ssrc", ssrc, "frame_id", frame->Id());
return false;
}
}
@@ -149,16 +167,31 @@ void FrameBuffer::DropNextDecodableTemporalUnit() {
void FrameBuffer::UpdateDroppedFramesAndDiscardedPackets(FrameIterator begin_it,
FrameIterator end_it) {
+ uint32_t dropped_ssrc = 0;
+ int64_t dropped_frame_id = 0;
unsigned int num_discarded_packets = 0;
unsigned int num_dropped_frames =
std::count_if(begin_it, end_it, [&](const auto& f) {
if (f.second.encoded_frame) {
const auto& packetInfos = f.second.encoded_frame->PacketInfos();
+ dropped_frame_id = f.first;
+ if (!packetInfos.empty()) {
+ dropped_ssrc = packetInfos[0].ssrc();
+ }
num_discarded_packets += packetInfos.size();
}
return f.second.encoded_frame != nullptr;
});
+ if (num_dropped_frames > 0) {
+ TRACE_EVENT2("webrtc", "FrameBuffer Dropping Old Frames", "remote_ssrc",
+ dropped_ssrc, "frame_id", dropped_frame_id);
+ }
+ if (num_discarded_packets > 0) {
+ TRACE_EVENT2("webrtc", "FrameBuffer Discarding Old Packets", "remote_ssrc",
+ dropped_ssrc, "frame_id", dropped_frame_id);
+ }
+
num_dropped_frames_ += num_dropped_frames;
num_discarded_packets_ += num_discarded_packets;
}
diff --git a/video/receive_statistics_proxy.cc b/video/receive_statistics_proxy.cc
index 8ef4d553ad..a0f19999d8 100644
index a0f19999d8..1764308c0a 100644
--- a/video/receive_statistics_proxy.cc
+++ b/video/receive_statistics_proxy.cc
@@ -800,8 +800,13 @@ void ReceiveStatisticsProxy::OnDroppedFrames(uint32_t frames_dropped) {
}
@@ -20,6 +20,7 @@
#include "rtc_base/strings/string_builder.h"
#include "rtc_base/thread.h"
#include "rtc_base/time_utils.h"
+#include "rtc_base/trace_event.h"
#include "system_wrappers/include/clock.h"
#include "system_wrappers/include/metrics.h"
#include "video/video_receive_stream2.h"
@@ -767,6 +768,9 @@ void ReceiveStatisticsProxy::OnCompleteFrame(bool is_keyframe,
VideoContentType content_type) {
RTC_DCHECK_RUN_ON(&main_thread_);
+ TRACE_EVENT2("webrtc", "ReceiveStatisticsProxy::OnCompleteFrame",
+ "remote_ssrc", remote_ssrc_, "is_keyframe", is_keyframe);
+
// Content type extension is set only for keyframes and should be propagated
// for all the following delta frames. Here we may receive frames out of order
// and miscategorise some delta frames near the layer switch.
@@ -792,6 +796,8 @@ void ReceiveStatisticsProxy::OnCompleteFrame(bool is_keyframe,
void ReceiveStatisticsProxy::OnDroppedFrames(uint32_t frames_dropped) {
// Can be called on either the decode queue or the worker thread
// See FrameBuffer2 for more details.
+ TRACE_EVENT2("webrtc", "ReceiveStatisticsProxy::OnDroppedFrames",
+ "remote_ssrc", remote_ssrc_, "frames_dropped", frames_dropped);
worker_thread_->PostTask(
SafeTask(task_safety_.flag(), [frames_dropped, this]() {
RTC_DCHECK_RUN_ON(&main_thread_);
@@ -802,6 +808,9 @@ void ReceiveStatisticsProxy::OnDroppedFrames(uint32_t frames_dropped) {
void ReceiveStatisticsProxy::OnDiscardedPackets(uint32_t packets_discarded) {
- RTC_DCHECK_RUN_ON(&main_thread_);
- stats_.packets_discarded += packets_discarded;
+ // Can be called on either the decode queue or the worker thread
+ // See FrameBuffer2 for more details.
+ worker_thread_->PostTask(
+ SafeTask(task_safety_.flag(), [packets_discarded, this]() {
+ RTC_DCHECK_RUN_ON(&main_thread_);
+ stats_.packets_discarded += packets_discarded;
+ }));
// Can be called on either the decode queue or the worker thread
// See FrameBuffer2 for more details.
+ TRACE_EVENT2("webrtc", "ReceiveStatisticsProxy::OnDiscardedPackets",
+ "remote_ssrc", remote_ssrc_, "packets_discarded",
+ packets_discarded);
worker_thread_->PostTask(
SafeTask(task_safety_.flag(), [packets_discarded, this]() {
RTC_DCHECK_RUN_ON(&main_thread_);
@@ -830,6 +839,8 @@ void ReceiveStatisticsProxy::OnStreamInactive() {
void ReceiveStatisticsProxy::OnRttUpdate(int64_t avg_rtt_ms) {
RTC_DCHECK_RUN_ON(&main_thread_);
+ TRACE_EVENT2("webrtc", "ReceiveStatisticsProxy::OnRttUpdate",
+ "remote_ssrc", remote_ssrc_, "avg_rtt_ms", avg_rtt_ms);
avg_rtt_ms_ = avg_rtt_ms;
}
void ReceiveStatisticsProxy::OnPreDecode(VideoCodecType codec_type, int qp) {
diff --git a/video/rtp_video_stream_receiver2.cc b/video/rtp_video_stream_receiver2.cc
index 0c4f5e30af..d906b0b2df 100644
index d906b0b2df..80fc4e8c68 100644
--- a/video/rtp_video_stream_receiver2.cc
+++ b/video/rtp_video_stream_receiver2.cc
@@ -1216,7 +1216,9 @@ void RtpVideoStreamReceiver2::FrameDecoded(int64_t picture_id) {
packet_infos_.erase(packet_infos_.begin(),
@@ -44,6 +44,7 @@
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/strings/string_builder.h"
+#include "rtc_base/trace_event.h"
#include "system_wrappers/include/metrics.h"
#include "system_wrappers/include/ntp_time.h"
@@ -1217,6 +1218,9 @@ void RtpVideoStreamReceiver2::FrameDecoded(int64_t picture_id) {
packet_infos_.upper_bound(unwrapped_rtp_seq_num));
uint32_t num_packets_cleared = packet_buffer_.ClearTo(seq_num);
- vcm_receive_statistics_->OnDiscardedPackets(num_packets_cleared);
+ if (num_packets_cleared > 0) {
+ vcm_receive_statistics_->OnDiscardedPackets(num_packets_cleared);
+ }
if (num_packets_cleared > 0) {
+ TRACE_EVENT2("webrtc",
+ "RtpVideoStreamReceiver2::FrameDecoded Cleared Old Packets",
+ "remote_ssrc", config_.rtp.remote_ssrc, "seq_num", seq_num);
vcm_receive_statistics_->OnDiscardedPackets(num_packets_cleared);
}
reference_finder_->ClearTo(seq_num);
}
}
diff --git a/video/video_stream_buffer_controller.cc b/video/video_stream_buffer_controller.cc
index 20588fbcad..9da894ab95 100644
--- a/video/video_stream_buffer_controller.cc
+++ b/video/video_stream_buffer_controller.cc
@@ -31,6 +31,7 @@
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/thread_annotations.h"
+#include "rtc_base/trace_event.h"
#include "video/frame_decode_scheduler.h"
#include "video/frame_decode_timing.h"
#include "video/task_queue_frame_decode_scheduler.h"
@@ -152,6 +153,9 @@ absl::optional<int64_t> VideoStreamBufferController::InsertFrame(
std::unique_ptr<EncodedFrame> frame) {
RTC_DCHECK_RUN_ON(&worker_sequence_checker_);
FrameMetadata metadata(*frame);
+ const uint32_t ssrc =
+ frame->PacketInfos().empty() ? 0 : frame->PacketInfos()[0].ssrc();
+ const int64_t frameId = frame->Id();
int complete_units = buffer_->GetTotalNumberOfContinuousTemporalUnits();
if (buffer_->InsertFrame(std::move(frame))) {
RTC_DCHECK(metadata.receive_time) << "Frame receive time must be set!";
@@ -162,6 +166,9 @@ absl::optional<int64_t> VideoStreamBufferController::InsertFrame(
*metadata.receive_time);
}
if (complete_units < buffer_->GetTotalNumberOfContinuousTemporalUnits()) {
+ TRACE_EVENT2("webrtc",
+ "VideoStreamBufferController::InsertFrame Frame Complete",
+ "remote_ssrc", ssrc, "frame_id", frameId);
stats_proxy_->OnCompleteFrame(metadata.is_keyframe, metadata.size,
metadata.contentType);
MaybeScheduleFrameForRelease();

Просмотреть файл

@ -1,221 +1,27 @@
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Thu, 6 Jan 2022 00:16:00 +0000
Subject: Bug 1748458 - Add TRACE_EVENTs for dropped frames and packets for
received video. r=bwc
Subject: Bug 1748458 - Add TRACE_EVENT for keyframe requests. r=bwc
This lets us see in the profiler how many received frames and packets we decide
to drop and the reasons why.
Differential Revision: https://phabricator.services.mozilla.com/D135062
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/08e252da94c4752eccfd845eef13d8517953cc6a
Also includes:
Bug 1804288 - (fix-de7ae5755b) reimplement Bug 1748458 - Add TRACE_EVENTs for dropped frames and packets for received video. r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D163960
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/8e9a326a99cd5eaa6e447ff57c01ad9d79a09744
Differential Revision: https://phabricator.services.mozilla.com/D135113
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/5b2a7894ef1cf096d0e8977754507c0820e757fc
---
api/video/frame_buffer.cc | 33 +++++++++++++++++++++++++
video/receive_statistics_proxy.cc | 11 +++++++++
video/rtp_video_stream_receiver2.cc | 4 +++
video/video_stream_buffer_controller.cc | 7 ++++++
4 files changed, 55 insertions(+)
video/rtp_video_stream_receiver2.cc | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/api/video/frame_buffer.cc b/api/video/frame_buffer.cc
index 8267b8e6cb..f5d93f5f76 100644
--- a/api/video/frame_buffer.cc
+++ b/api/video/frame_buffer.cc
@@ -16,6 +16,7 @@
#include "absl/container/inlined_vector.h"
#include "rtc_base/logging.h"
#include "rtc_base/numerics/sequence_number_util.h"
+#include "rtc_base/trace_event.h"
namespace webrtc {
namespace {
@@ -68,7 +69,12 @@ FrameBuffer::FrameBuffer(int max_size,
decoded_frame_history_(max_decode_history) {}
bool FrameBuffer::InsertFrame(std::unique_ptr<EncodedFrame> frame) {
+ const uint32_t ssrc =
+ frame->PacketInfos().empty() ? 0 : frame->PacketInfos()[0].ssrc();
if (!ValidReferences(*frame)) {
+ TRACE_EVENT2("webrtc",
+ "FrameBuffer::InsertFrame Frame dropped (Invalid references)",
+ "remote_ssrc", ssrc, "frame_id", frame->Id());
RTC_DLOG(LS_WARNING) << "Frame " << frame->Id()
<< " has invalid references, dropping frame.";
return false;
@@ -78,23 +84,35 @@ bool FrameBuffer::InsertFrame(std::unique_ptr<EncodedFrame> frame) {
if (legacy_frame_id_jump_behavior_ && frame->is_keyframe() &&
AheadOf(frame->Timestamp(),
*decoded_frame_history_.GetLastDecodedFrameTimestamp())) {
+ TRACE_EVENT2("webrtc",
+ "FrameBuffer::InsertFrame Frames dropped (OOO + PicId jump)",
+ "remote_ssrc", ssrc, "frame_id", frame->Id());
RTC_DLOG(LS_WARNING)
<< "Keyframe " << frame->Id()
<< " has newer timestamp but older picture id, clearing buffer.";
Clear();
} else {
// Already decoded past this frame.
+ TRACE_EVENT2("webrtc",
+ "FrameBuffer::InsertFrame Frame dropped (Out of order)",
+ "remote_ssrc", ssrc, "frame_id", frame->Id());
return false;
}
}
if (frames_.size() == max_size_) {
if (frame->is_keyframe()) {
+ TRACE_EVENT2("webrtc",
+ "FrameBuffer::InsertFrame Frames dropped (KF + Full buffer)",
+ "remote_ssrc", ssrc, "frame_id", frame->Id());
RTC_DLOG(LS_WARNING) << "Keyframe " << frame->Id()
<< " inserted into full buffer, clearing buffer.";
Clear();
} else {
// No space for this frame.
+ TRACE_EVENT2("webrtc",
+ "FrameBuffer::InsertFrame Frame dropped (Full buffer)",
+ "remote_ssrc", ssrc, "frame_id", frame->Id());
return false;
}
}
@@ -149,16 +167,31 @@ void FrameBuffer::DropNextDecodableTemporalUnit() {
void FrameBuffer::UpdateDroppedFramesAndDiscardedPackets(FrameIterator begin_it,
FrameIterator end_it) {
+ uint32_t dropped_ssrc = 0;
+ int64_t dropped_frame_id = 0;
unsigned int num_discarded_packets = 0;
unsigned int num_dropped_frames =
std::count_if(begin_it, end_it, [&](const auto& f) {
if (f.second.encoded_frame) {
const auto& packetInfos = f.second.encoded_frame->PacketInfos();
+ dropped_frame_id = f.first;
+ if (!packetInfos.empty()) {
+ dropped_ssrc = packetInfos[0].ssrc();
+ }
num_discarded_packets += packetInfos.size();
}
return f.second.encoded_frame != nullptr;
});
+ if (num_dropped_frames > 0) {
+ TRACE_EVENT2("webrtc", "FrameBuffer Dropping Old Frames", "remote_ssrc",
+ dropped_ssrc, "frame_id", dropped_frame_id);
+ }
+ if (num_discarded_packets > 0) {
+ TRACE_EVENT2("webrtc", "FrameBuffer Discarding Old Packets", "remote_ssrc",
+ dropped_ssrc, "frame_id", dropped_frame_id);
+ }
+
num_dropped_frames_ += num_dropped_frames;
num_discarded_packets_ += num_discarded_packets;
}
diff --git a/video/receive_statistics_proxy.cc b/video/receive_statistics_proxy.cc
index a0f19999d8..1764308c0a 100644
--- a/video/receive_statistics_proxy.cc
+++ b/video/receive_statistics_proxy.cc
@@ -20,6 +20,7 @@
#include "rtc_base/strings/string_builder.h"
#include "rtc_base/thread.h"
#include "rtc_base/time_utils.h"
+#include "rtc_base/trace_event.h"
#include "system_wrappers/include/clock.h"
#include "system_wrappers/include/metrics.h"
#include "video/video_receive_stream2.h"
@@ -767,6 +768,9 @@ void ReceiveStatisticsProxy::OnCompleteFrame(bool is_keyframe,
VideoContentType content_type) {
RTC_DCHECK_RUN_ON(&main_thread_);
+ TRACE_EVENT2("webrtc", "ReceiveStatisticsProxy::OnCompleteFrame",
+ "remote_ssrc", remote_ssrc_, "is_keyframe", is_keyframe);
+
// Content type extension is set only for keyframes and should be propagated
// for all the following delta frames. Here we may receive frames out of order
// and miscategorise some delta frames near the layer switch.
@@ -792,6 +796,8 @@ void ReceiveStatisticsProxy::OnCompleteFrame(bool is_keyframe,
void ReceiveStatisticsProxy::OnDroppedFrames(uint32_t frames_dropped) {
// Can be called on either the decode queue or the worker thread
// See FrameBuffer2 for more details.
+ TRACE_EVENT2("webrtc", "ReceiveStatisticsProxy::OnDroppedFrames",
+ "remote_ssrc", remote_ssrc_, "frames_dropped", frames_dropped);
worker_thread_->PostTask(
SafeTask(task_safety_.flag(), [frames_dropped, this]() {
RTC_DCHECK_RUN_ON(&main_thread_);
@@ -802,6 +808,9 @@ void ReceiveStatisticsProxy::OnDroppedFrames(uint32_t frames_dropped) {
void ReceiveStatisticsProxy::OnDiscardedPackets(uint32_t packets_discarded) {
// Can be called on either the decode queue or the worker thread
// See FrameBuffer2 for more details.
+ TRACE_EVENT2("webrtc", "ReceiveStatisticsProxy::OnDiscardedPackets",
+ "remote_ssrc", remote_ssrc_, "packets_discarded",
+ packets_discarded);
worker_thread_->PostTask(
SafeTask(task_safety_.flag(), [packets_discarded, this]() {
RTC_DCHECK_RUN_ON(&main_thread_);
@@ -830,6 +839,8 @@ void ReceiveStatisticsProxy::OnStreamInactive() {
void ReceiveStatisticsProxy::OnRttUpdate(int64_t avg_rtt_ms) {
RTC_DCHECK_RUN_ON(&main_thread_);
+ TRACE_EVENT2("webrtc", "ReceiveStatisticsProxy::OnRttUpdate",
+ "remote_ssrc", remote_ssrc_, "avg_rtt_ms", avg_rtt_ms);
avg_rtt_ms_ = avg_rtt_ms;
}
diff --git a/video/rtp_video_stream_receiver2.cc b/video/rtp_video_stream_receiver2.cc
index d906b0b2df..80fc4e8c68 100644
index 80fc4e8c68..94df09c440 100644
--- a/video/rtp_video_stream_receiver2.cc
+++ b/video/rtp_video_stream_receiver2.cc
@@ -44,6 +44,7 @@
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/strings/string_builder.h"
+#include "rtc_base/trace_event.h"
#include "system_wrappers/include/metrics.h"
#include "system_wrappers/include/ntp_time.h"
@@ -738,6 +738,12 @@ void RtpVideoStreamReceiver2::OnRtpPacket(const RtpPacketReceived& packet) {
@@ -1217,6 +1218,9 @@ void RtpVideoStreamReceiver2::FrameDecoded(int64_t picture_id) {
packet_infos_.upper_bound(unwrapped_rtp_seq_num));
uint32_t num_packets_cleared = packet_buffer_.ClearTo(seq_num);
if (num_packets_cleared > 0) {
+ TRACE_EVENT2("webrtc",
+ "RtpVideoStreamReceiver2::FrameDecoded Cleared Old Packets",
+ "remote_ssrc", config_.rtp.remote_ssrc, "seq_num", seq_num);
vcm_receive_statistics_->OnDiscardedPackets(num_packets_cleared);
}
reference_finder_->ClearTo(seq_num);
diff --git a/video/video_stream_buffer_controller.cc b/video/video_stream_buffer_controller.cc
index 20588fbcad..9da894ab95 100644
--- a/video/video_stream_buffer_controller.cc
+++ b/video/video_stream_buffer_controller.cc
@@ -31,6 +31,7 @@
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/thread_annotations.h"
+#include "rtc_base/trace_event.h"
#include "video/frame_decode_scheduler.h"
#include "video/frame_decode_timing.h"
#include "video/task_queue_frame_decode_scheduler.h"
@@ -152,6 +153,9 @@ absl::optional<int64_t> VideoStreamBufferController::InsertFrame(
std::unique_ptr<EncodedFrame> frame) {
RTC_DCHECK_RUN_ON(&worker_sequence_checker_);
FrameMetadata metadata(*frame);
+ const uint32_t ssrc =
+ frame->PacketInfos().empty() ? 0 : frame->PacketInfos()[0].ssrc();
+ const int64_t frameId = frame->Id();
int complete_units = buffer_->GetTotalNumberOfContinuousTemporalUnits();
if (buffer_->InsertFrame(std::move(frame))) {
RTC_DCHECK(metadata.receive_time) << "Frame receive time must be set!";
@@ -162,6 +166,9 @@ absl::optional<int64_t> VideoStreamBufferController::InsertFrame(
*metadata.receive_time);
}
if (complete_units < buffer_->GetTotalNumberOfContinuousTemporalUnits()) {
+ TRACE_EVENT2("webrtc",
+ "VideoStreamBufferController::InsertFrame Frame Complete",
+ "remote_ssrc", ssrc, "frame_id", frameId);
stats_proxy_->OnCompleteFrame(metadata.is_keyframe, metadata.size,
metadata.contentType);
MaybeScheduleFrameForRelease();
void RtpVideoStreamReceiver2::RequestKeyFrame() {
RTC_DCHECK_RUN_ON(&worker_task_checker_);
+ TRACE_EVENT2("webrtc", "RtpVideoStreamReceiver2::RequestKeyFrame",
+ "remote_ssrc", config_.rtp.remote_ssrc, "method",
+ keyframe_request_method_ == KeyFrameReqMethod::kPliRtcp ? "PLI"
+ : keyframe_request_method_ == KeyFrameReqMethod::kFirRtcp ? "FIR"
+ : keyframe_request_method_ == KeyFrameReqMethod::kNone ? "None"
+ : "Other");
// TODO(bugs.webrtc.org/10336): Allow the sender to ignore key frame requests
// issued by anything other than the LossNotificationController if it (the
// sender) is relying on LNTF alone.

Просмотреть файл

@ -1,27 +1,23 @@
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Thu, 6 Jan 2022 00:16:00 +0000
Subject: Bug 1748458 - Add TRACE_EVENT for keyframe requests. r=bwc
Date: Wed, 11 Jan 2023 22:42:00 +0000
Subject: Bug 1800942 - Add DCHECKs to
TimestampExtrapolator::ExtrapolateLocalTime. r=mjf
Differential Revision: https://phabricator.services.mozilla.com/D135113
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/5b2a7894ef1cf096d0e8977754507c0820e757fc
Differential Revision: https://phabricator.services.mozilla.com/D166536
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/c5df7f40392464ffc63f44a53ddcaab2091741e0
---
video/rtp_video_stream_receiver2.cc | 6 ++++++
1 file changed, 6 insertions(+)
modules/video_coding/timing/timestamp_extrapolator.cc | 1 +
1 file changed, 1 insertion(+)
diff --git a/video/rtp_video_stream_receiver2.cc b/video/rtp_video_stream_receiver2.cc
index 80fc4e8c68..94df09c440 100644
--- a/video/rtp_video_stream_receiver2.cc
+++ b/video/rtp_video_stream_receiver2.cc
@@ -738,6 +738,12 @@ void RtpVideoStreamReceiver2::OnRtpPacket(const RtpPacketReceived& packet) {
diff --git a/modules/video_coding/timing/timestamp_extrapolator.cc b/modules/video_coding/timing/timestamp_extrapolator.cc
index a90df8bf7f..77e5508a76 100644
--- a/modules/video_coding/timing/timestamp_extrapolator.cc
+++ b/modules/video_coding/timing/timestamp_extrapolator.cc
@@ -125,6 +125,7 @@ void TimestampExtrapolator::Update(Timestamp now, uint32_t ts90khz) {
absl::optional<Timestamp> TimestampExtrapolator::ExtrapolateLocalTime(
uint32_t timestamp90khz) const {
int64_t unwrapped_ts90khz = unwrapper_.PeekUnwrap(timestamp90khz);
+ RTC_DCHECK_GE(unwrapped_ts90khz, 0);
void RtpVideoStreamReceiver2::RequestKeyFrame() {
RTC_DCHECK_RUN_ON(&worker_task_checker_);
+ TRACE_EVENT2("webrtc", "RtpVideoStreamReceiver2::RequestKeyFrame",
+ "remote_ssrc", config_.rtp.remote_ssrc, "method",
+ keyframe_request_method_ == KeyFrameReqMethod::kPliRtcp ? "PLI"
+ : keyframe_request_method_ == KeyFrameReqMethod::kFirRtcp ? "FIR"
+ : keyframe_request_method_ == KeyFrameReqMethod::kNone ? "None"
+ : "Other");
// TODO(bugs.webrtc.org/10336): Allow the sender to ignore key frame requests
// issued by anything other than the LossNotificationController if it (the
// sender) is relying on LNTF alone.
if (!first_unwrapped_timestamp_) {
return absl::nullopt;

Просмотреть файл

@ -1,23 +1,25 @@
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Wed, 11 Jan 2023 22:42:00 +0000
Subject: Bug 1800942 - Add DCHECKs to
TimestampExtrapolator::ExtrapolateLocalTime. r=mjf
Date: Wed, 8 Feb 2023 08:01:00 +0000
Subject: Bug 1814692 - Don't attempt realtime scheduling rtc::PlatformThreads.
r=webrtc-reviewers,bwc
Differential Revision: https://phabricator.services.mozilla.com/D166536
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/c5df7f40392464ffc63f44a53ddcaab2091741e0
Differential Revision: https://phabricator.services.mozilla.com/D169036
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/9e64a965e26c8379261466e5273c3b383164b2c7
---
modules/video_coding/timing/timestamp_extrapolator.cc | 1 +
1 file changed, 1 insertion(+)
rtc_base/platform_thread.cc | 3 +++
1 file changed, 3 insertions(+)
diff --git a/modules/video_coding/timing/timestamp_extrapolator.cc b/modules/video_coding/timing/timestamp_extrapolator.cc
index a90df8bf7f..77e5508a76 100644
--- a/modules/video_coding/timing/timestamp_extrapolator.cc
+++ b/modules/video_coding/timing/timestamp_extrapolator.cc
@@ -125,6 +125,7 @@ void TimestampExtrapolator::Update(Timestamp now, uint32_t ts90khz) {
absl::optional<Timestamp> TimestampExtrapolator::ExtrapolateLocalTime(
uint32_t timestamp90khz) const {
int64_t unwrapped_ts90khz = unwrapper_.PeekUnwrap(timestamp90khz);
+ RTC_DCHECK_GE(unwrapped_ts90khz, 0);
if (!first_unwrapped_timestamp_) {
return absl::nullopt;
diff --git a/rtc_base/platform_thread.cc b/rtc_base/platform_thread.cc
index 71a9f1b224..bcbb784b97 100644
--- a/rtc_base/platform_thread.cc
+++ b/rtc_base/platform_thread.cc
@@ -50,6 +50,9 @@ bool SetPriority(ThreadPriority priority) {
// TODO(tommi): Switch to the same mechanism as Chromium uses for changing
// thread priorities.
return true;
+#elif defined(WEBRTC_MOZILLA_BUILD) && defined(WEBRTC_LINUX)
+ // Only realtime audio uses realtime scheduling in Firefox.
+ return true;
#else
const int policy = SCHED_FIFO;
const int min_prio = sched_get_priority_min(policy);

Просмотреть файл

@ -1,25 +1,74 @@
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Wed, 8 Feb 2023 08:01:00 +0000
Subject: Bug 1814692 - Don't attempt realtime scheduling rtc::PlatformThreads.
r=webrtc-reviewers,bwc
From: Jan Grulich <jgrulich@redhat.com>
Date: Fri, 10 Mar 2023 09:21:00 +0000
Subject: Bug 1819035 - get EGL display based on the used platform in the
browser r=webrtc-reviewers,ng
Differential Revision: https://phabricator.services.mozilla.com/D169036
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/9e64a965e26c8379261466e5273c3b383164b2c7
Because of a possible misconfiguration or a possible driver issue it
might happen that the browser will use a different driver on X11 and
end up using yet another one for wayland/gbm, which might lead to not
working screen sharing in the better case, but also to a crash in the
other driver (Nvidia). This adds a check for platform the browser runs
on, if it's XWayland or Wayland and based on that query EGL display for
that specific platform, rather than going for the Wayland one only.
Differential Revision: https://phabricator.services.mozilla.com/D171858
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/c8606497de1f461a6352456e0e511c2ae498d526
---
rtc_base/platform_thread.cc | 3 +++
1 file changed, 3 insertions(+)
.../linux/wayland/egl_dmabuf.cc | 30 +++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)
diff --git a/rtc_base/platform_thread.cc b/rtc_base/platform_thread.cc
index 71a9f1b224..bcbb784b97 100644
--- a/rtc_base/platform_thread.cc
+++ b/rtc_base/platform_thread.cc
@@ -50,6 +50,9 @@ bool SetPriority(ThreadPriority priority) {
// TODO(tommi): Switch to the same mechanism as Chromium uses for changing
// thread priorities.
return true;
+#elif defined(WEBRTC_MOZILLA_BUILD) && defined(WEBRTC_LINUX)
+ // Only realtime audio uses realtime scheduling in Firefox.
+ return true;
#else
const int policy = SCHED_FIFO;
const int min_prio = sched_get_priority_min(policy);
diff --git a/modules/desktop_capture/linux/wayland/egl_dmabuf.cc b/modules/desktop_capture/linux/wayland/egl_dmabuf.cc
index b529077c6d..6a019c64b4 100644
--- a/modules/desktop_capture/linux/wayland/egl_dmabuf.cc
+++ b/modules/desktop_capture/linux/wayland/egl_dmabuf.cc
@@ -13,6 +13,7 @@
#include <asm/ioctl.h>
#include <dlfcn.h>
#include <fcntl.h>
+#include <gdk/gdk.h>
#include <libdrm/drm_fourcc.h>
#include <linux/types.h>
#include <spa/param/video/format-utils.h>
@@ -217,6 +218,26 @@ static void CloseLibrary(void* library) {
}
}
+static bool IsWaylandDisplay() {
+ static auto sGdkWaylandDisplayGetType =
+ (GType (*)(void))dlsym(RTLD_DEFAULT, "gdk_wayland_display_get_type");
+ if (!sGdkWaylandDisplayGetType) {
+ return false;
+ }
+ return (G_TYPE_CHECK_INSTANCE_TYPE ((gdk_display_get_default()),
+ sGdkWaylandDisplayGetType()));
+}
+
+static bool IsX11Display() {
+ static auto sGdkX11DisplayGetType =
+ (GType (*)(void))dlsym(RTLD_DEFAULT, "gdk_x11_display_get_type");
+ if (!sGdkX11DisplayGetType) {
+ return false;
+ }
+ return (G_TYPE_CHECK_INSTANCE_TYPE ((gdk_display_get_default()),
+ sGdkX11DisplayGetType()));
+}
+
static void* g_lib_egl = nullptr;
RTC_NO_SANITIZE("cfi-icall")
@@ -362,8 +383,13 @@ EglDmaBuf::EglDmaBuf() {
return;
}
- egl_.display = EglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_KHR,
- (void*)EGL_DEFAULT_DISPLAY, nullptr);
+ if (IsWaylandDisplay()) {
+ egl_.display = EglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_KHR,
+ (void*)EGL_DEFAULT_DISPLAY, nullptr);
+ } else if (IsX11Display()) {
+ egl_.display = EglGetPlatformDisplay(EGL_PLATFORM_X11_KHR,
+ (void*)EGL_DEFAULT_DISPLAY, nullptr);
+ }
if (egl_.display == EGL_NO_DISPLAY) {
RTC_LOG(LS_ERROR) << "Failed to obtain default EGL display: "

Просмотреть файл

@ -1,74 +1,31 @@
From: Jan Grulich <jgrulich@redhat.com>
Date: Fri, 10 Mar 2023 09:21:00 +0000
Subject: Bug 1819035 - get EGL display based on the used platform in the
browser r=webrtc-reviewers,ng
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Mon, 27 Feb 2023 16:22:00 +0000
Subject: Bug 1817024 - (fix-fdcfefa708) In PhysicalSocket avoid a non-trivial
designated initializer. r=mjf,webrtc-reviewers
Because of a possible misconfiguration or a possible driver issue it
might happen that the browser will use a different driver on X11 and
end up using yet another one for wayland/gbm, which might lead to not
working screen sharing in the better case, but also to a crash in the
other driver (Nvidia). This adds a check for platform the browser runs
on, if it's XWayland or Wayland and based on that query EGL display for
that specific platform, rather than going for the Wayland one only.
This fixes a build failure in the base-toolchain job with GCC 7.5.0:
In file included from Unified_cpp_threading_gn0.cpp:38:0:
.../third_party/libwebrtc/rtc_base/physical_socket_server.cc: In member function 'int rtc::PhysicalSocket::DoReadFromSocket(void*, size_t, rtc::SocketAddress*, int64_t*)':
.../third_party/libwebrtc/rtc_base/physical_socket_server.cc:463:51: sorry, unimplemented: non-trivial designated initializers not supported
msghdr msg = {.msg_iov = &iov, .msg_iovlen = 1};
^
Differential Revision: https://phabricator.services.mozilla.com/D171858
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/c8606497de1f461a6352456e0e511c2ae498d526
Differential Revision: https://phabricator.services.mozilla.com/D171057
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/a3447f709befd84a282ca40f29b7a5ea76d5b68d
---
.../linux/wayland/egl_dmabuf.cc | 30 +++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)
rtc_base/physical_socket_server.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/desktop_capture/linux/wayland/egl_dmabuf.cc b/modules/desktop_capture/linux/wayland/egl_dmabuf.cc
index b529077c6d..6a019c64b4 100644
--- a/modules/desktop_capture/linux/wayland/egl_dmabuf.cc
+++ b/modules/desktop_capture/linux/wayland/egl_dmabuf.cc
@@ -13,6 +13,7 @@
#include <asm/ioctl.h>
#include <dlfcn.h>
#include <fcntl.h>
+#include <gdk/gdk.h>
#include <libdrm/drm_fourcc.h>
#include <linux/types.h>
#include <spa/param/video/format-utils.h>
@@ -217,6 +218,26 @@ static void CloseLibrary(void* library) {
}
}
+static bool IsWaylandDisplay() {
+ static auto sGdkWaylandDisplayGetType =
+ (GType (*)(void))dlsym(RTLD_DEFAULT, "gdk_wayland_display_get_type");
+ if (!sGdkWaylandDisplayGetType) {
+ return false;
+ }
+ return (G_TYPE_CHECK_INSTANCE_TYPE ((gdk_display_get_default()),
+ sGdkWaylandDisplayGetType()));
+}
+
+static bool IsX11Display() {
+ static auto sGdkX11DisplayGetType =
+ (GType (*)(void))dlsym(RTLD_DEFAULT, "gdk_x11_display_get_type");
+ if (!sGdkX11DisplayGetType) {
+ return false;
+ }
+ return (G_TYPE_CHECK_INSTANCE_TYPE ((gdk_display_get_default()),
+ sGdkX11DisplayGetType()));
+}
+
static void* g_lib_egl = nullptr;
RTC_NO_SANITIZE("cfi-icall")
@@ -362,8 +383,13 @@ EglDmaBuf::EglDmaBuf() {
return;
}
- egl_.display = EglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_KHR,
- (void*)EGL_DEFAULT_DISPLAY, nullptr);
+ if (IsWaylandDisplay()) {
+ egl_.display = EglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_KHR,
+ (void*)EGL_DEFAULT_DISPLAY, nullptr);
+ } else if (IsX11Display()) {
+ egl_.display = EglGetPlatformDisplay(EGL_PLATFORM_X11_KHR,
+ (void*)EGL_DEFAULT_DISPLAY, nullptr);
+ }
if (egl_.display == EGL_NO_DISPLAY) {
RTC_LOG(LS_ERROR) << "Failed to obtain default EGL display: "
diff --git a/rtc_base/physical_socket_server.cc b/rtc_base/physical_socket_server.cc
index 2dfdd9a5df..d0053dd82b 100644
--- a/rtc_base/physical_socket_server.cc
+++ b/rtc_base/physical_socket_server.cc
@@ -462,7 +462,7 @@ int PhysicalSocket::DoReadFromSocket(void* buffer,
int received = 0;
if (read_scm_timestamp_experiment_) {
iovec iov = {.iov_base = buffer, .iov_len = length};
- msghdr msg = {.msg_iov = &iov, .msg_iovlen = 1};
+ msghdr msg = {.msg_name = nullptr, .msg_namelen = 0, .msg_iov = &iov, .msg_iovlen = 1};
if (out_addr) {
out_addr->Clear();
msg.msg_name = addr;

Просмотреть файл

@ -1,31 +1,22 @@
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Mon, 27 Feb 2023 16:22:00 +0000
Subject: Bug 1817024 - (fix-fdcfefa708) In PhysicalSocket avoid a non-trivial
designated initializer. r=mjf,webrtc-reviewers
From: Byron Campen <docfaraday@gmail.com>
Date: Tue, 4 Apr 2023 16:34:00 -0500
Subject: Bug 1822194 - (fix-3b51cd328e) - Add missing designated initializer
that gcc is sad about.
This fixes a build failure in the base-toolchain job with GCC 7.5.0:
In file included from Unified_cpp_threading_gn0.cpp:38:0:
.../third_party/libwebrtc/rtc_base/physical_socket_server.cc: In member function 'int rtc::PhysicalSocket::DoReadFromSocket(void*, size_t, rtc::SocketAddress*, int64_t*)':
.../third_party/libwebrtc/rtc_base/physical_socket_server.cc:463:51: sorry, unimplemented: non-trivial designated initializers not supported
msghdr msg = {.msg_iov = &iov, .msg_iovlen = 1};
^
Differential Revision: https://phabricator.services.mozilla.com/D171057
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/a3447f709befd84a282ca40f29b7a5ea76d5b68d
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/108046c7cbb21c6cf19320c0804e9aee1a3eb4bf
---
rtc_base/physical_socket_server.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
modules/audio_processing/audio_processing_impl.cc | 1 +
1 file changed, 1 insertion(+)
diff --git a/rtc_base/physical_socket_server.cc b/rtc_base/physical_socket_server.cc
index 2dfdd9a5df..d0053dd82b 100644
--- a/rtc_base/physical_socket_server.cc
+++ b/rtc_base/physical_socket_server.cc
@@ -462,7 +462,7 @@ int PhysicalSocket::DoReadFromSocket(void* buffer,
int received = 0;
if (read_scm_timestamp_experiment_) {
iovec iov = {.iov_base = buffer, .iov_len = length};
- msghdr msg = {.msg_iov = &iov, .msg_iovlen = 1};
+ msghdr msg = {.msg_name = nullptr, .msg_namelen = 0, .msg_iov = &iov, .msg_iovlen = 1};
if (out_addr) {
out_addr->Clear();
msg.msg_name = addr;
diff --git a/modules/audio_processing/audio_processing_impl.cc b/modules/audio_processing/audio_processing_impl.cc
index c80cc76a3d..c304453388 100644
--- a/modules/audio_processing/audio_processing_impl.cc
+++ b/modules/audio_processing/audio_processing_impl.cc
@@ -450,6 +450,7 @@ AudioProcessingImpl::GetGainController2ExperimentParams() {
},
.adaptive_digital_controller =
{
+ .enabled = false,
.headroom_db = static_cast<float>(headroom_db.Get()),
.max_gain_db = static_cast<float>(max_gain_db.Get()),
.initial_gain_db =

Просмотреть файл

@ -1,22 +1,24 @@
From: Byron Campen <docfaraday@gmail.com>
Date: Tue, 4 Apr 2023 16:34:00 -0500
Subject: Bug 1822194 - (fix-3b51cd328e) - Add missing designated initializer
that gcc is sad about.
Date: Fri, 7 Apr 2023 20:28:00 +0000
Subject: Bug 1819048: Remove this bad assertion. r=webrtc-reviewers,jib
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/108046c7cbb21c6cf19320c0804e9aee1a3eb4bf
Differential Revision: https://phabricator.services.mozilla.com/D174978
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/5a52e1b0c808edfda82f0abea668699eb68098dc
---
modules/audio_processing/audio_processing_impl.cc | 1 +
1 file changed, 1 insertion(+)
video/task_queue_frame_decode_scheduler.cc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/modules/audio_processing/audio_processing_impl.cc b/modules/audio_processing/audio_processing_impl.cc
index c80cc76a3d..c304453388 100644
--- a/modules/audio_processing/audio_processing_impl.cc
+++ b/modules/audio_processing/audio_processing_impl.cc
@@ -450,6 +450,7 @@ AudioProcessingImpl::GetGainController2ExperimentParams() {
},
.adaptive_digital_controller =
{
+ .enabled = false,
.headroom_db = static_cast<float>(headroom_db.Get()),
.max_gain_db = static_cast<float>(max_gain_db.Get()),
.initial_gain_db =
diff --git a/video/task_queue_frame_decode_scheduler.cc b/video/task_queue_frame_decode_scheduler.cc
index cd109c2932..6dd7b47f17 100644
--- a/video/task_queue_frame_decode_scheduler.cc
+++ b/video/task_queue_frame_decode_scheduler.cc
@@ -37,7 +37,8 @@ void TaskQueueFrameDecodeScheduler::ScheduleFrame(
uint32_t rtp,
FrameDecodeTiming::FrameSchedule schedule,
FrameReleaseCallback cb) {
- RTC_DCHECK(!stopped_) << "Can not schedule frames after stopped.";
+ // Mozilla modification, until https://bugs.webrtc.org/14944 is fixed
+ //RTC_DCHECK(!stopped_) << "Can not schedule frames after stopped.";
RTC_DCHECK(!scheduled_rtp_.has_value())
<< "Can not schedule two frames for release at the same time.";
RTC_DCHECK(cb);

Просмотреть файл

@ -1,24 +1,60 @@
From: Byron Campen <docfaraday@gmail.com>
Date: Fri, 7 Apr 2023 20:28:00 +0000
Subject: Bug 1819048: Remove this bad assertion. r=webrtc-reviewers,jib
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Wed, 10 May 2023 07:06:00 +0000
Subject: Bug 1810949 - cherry-pick upstream libwebrtc commit 91d5fc2ed6.
r=webrtc-reviewers,mjf
Differential Revision: https://phabricator.services.mozilla.com/D174978
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/5a52e1b0c808edfda82f0abea668699eb68098dc
Upstream commit: https://webrtc.googlesource.com/src/+/91d5fc2ed6ef347d90182868320267d45cf9525b
Support more pixel formats in v4l2 camera backend
These were tested with gstreamer and v4l2loopback, example setup:
$ sudo v4l2loopback-ctl add -n BGRA 10
$ gst-launch-1.0 videotestsrc pattern=smpte-rp-219 ! \
video/x-raw,format=BGRA ! v4l2sink device=/dev/video10 > /dev/null &
Then conversion was confirmed with video_loopback:
$ ./video_loopback --capture_device_index=3 --logs 2>&1 | grep -i \
capture
Bug: webrtc:14830
Change-Id: I35c8e453cf7f9a2923935b0ad82477a3144e8c12
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/291532
Commit-Queue: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39979}
Differential Revision: https://phabricator.services.mozilla.com/D177232
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/92dc582fdcf3a2fdb3fcdbcd96080d081de8f8d5
---
video/task_queue_frame_decode_scheduler.cc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
.../video_capture/linux/device_info_v4l2.cc | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/video/task_queue_frame_decode_scheduler.cc b/video/task_queue_frame_decode_scheduler.cc
index cd109c2932..6dd7b47f17 100644
--- a/video/task_queue_frame_decode_scheduler.cc
+++ b/video/task_queue_frame_decode_scheduler.cc
@@ -37,7 +37,8 @@ void TaskQueueFrameDecodeScheduler::ScheduleFrame(
uint32_t rtp,
FrameDecodeTiming::FrameSchedule schedule,
FrameReleaseCallback cb) {
- RTC_DCHECK(!stopped_) << "Can not schedule frames after stopped.";
+ // Mozilla modification, until https://bugs.webrtc.org/14944 is fixed
+ //RTC_DCHECK(!stopped_) << "Can not schedule frames after stopped.";
RTC_DCHECK(!scheduled_rtp_.has_value())
<< "Can not schedule two frames for release at the same time.";
RTC_DCHECK(cb);
diff --git a/modules/video_capture/linux/device_info_v4l2.cc b/modules/video_capture/linux/device_info_v4l2.cc
index 04caaea592..abd2886f85 100644
--- a/modules/video_capture/linux/device_info_v4l2.cc
+++ b/modules/video_capture/linux/device_info_v4l2.cc
@@ -57,6 +57,24 @@
#define BUF_LEN ( 1024 * ( EVENT_SIZE + 16 ) )
#endif
+// These defines are here to support building on kernel 3.16 which some
+// downstream projects, e.g. Firefox, use.
+// TODO(apehrson): Remove them and their undefs when no longer needed.
+#ifndef V4L2_PIX_FMT_ABGR32
+#define ABGR32_OVERRIDE 1
+#define V4L2_PIX_FMT_ABGR32 v4l2_fourcc('A', 'R', '2', '4')
+#endif
+
+#ifndef V4L2_PIX_FMT_ARGB32
+#define ARGB32_OVERRIDE 1
+#define V4L2_PIX_FMT_ARGB32 v4l2_fourcc('B', 'A', '2', '4')
+#endif
+
+#ifndef V4L2_PIX_FMT_RGBA32
+#define RGBA32_OVERRIDE 1
+#define V4L2_PIX_FMT_RGBA32 v4l2_fourcc('A', 'B', '2', '4')
+#endif
+
namespace webrtc {
namespace videocapturemodule {
#ifdef WEBRTC_LINUX

Просмотреть файл

@ -1,60 +1,55 @@
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Wed, 10 May 2023 07:06:00 +0000
Subject: Bug 1810949 - cherry-pick upstream libwebrtc commit 91d5fc2ed6.
r=webrtc-reviewers,mjf
From: Nico Grunbaum <na-g@nostrum.com>
Date: Tue, 6 Jun 2023 16:37:00 -0700
Subject: Bug 1833237 - (fix-f0be3bee1f) remove reference to
portal:pipewire_base;r?pehrsons
Upstream commit: https://webrtc.googlesource.com/src/+/91d5fc2ed6ef347d90182868320267d45cf9525b
Support more pixel formats in v4l2 camera backend
These were tested with gstreamer and v4l2loopback, example setup:
$ sudo v4l2loopback-ctl add -n BGRA 10
$ gst-launch-1.0 videotestsrc pattern=smpte-rp-219 ! \
video/x-raw,format=BGRA ! v4l2sink device=/dev/video10 > /dev/null &
Then conversion was confirmed with video_loopback:
$ ./video_loopback --capture_device_index=3 --logs 2>&1 | grep -i \
capture
Bug: webrtc:14830
Change-Id: I35c8e453cf7f9a2923935b0ad82477a3144e8c12
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/291532
Commit-Queue: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39979}
Differential Revision: https://phabricator.services.mozilla.com/D177232
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/92dc582fdcf3a2fdb3fcdbcd96080d081de8f8d5
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/8ff886a4d366b4be35b329d1ef733a6df542067c
---
.../video_capture/linux/device_info_v4l2.cc | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
modules/video_capture/BUILD.gn | 4 ++++
modules/video_capture/linux/device_info_pipewire.cc | 3 ++-
modules/video_capture/linux/device_info_pipewire.h | 3 ++-
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/modules/video_capture/linux/device_info_v4l2.cc b/modules/video_capture/linux/device_info_v4l2.cc
index 04caaea592..abd2886f85 100644
--- a/modules/video_capture/linux/device_info_v4l2.cc
+++ b/modules/video_capture/linux/device_info_v4l2.cc
@@ -57,6 +57,24 @@
#define BUF_LEN ( 1024 * ( EVENT_SIZE + 16 ) )
#endif
diff --git a/modules/video_capture/BUILD.gn b/modules/video_capture/BUILD.gn
index 8f89918359..45a0272eee 100644
--- a/modules/video_capture/BUILD.gn
+++ b/modules/video_capture/BUILD.gn
@@ -104,6 +104,10 @@ if (!build_with_chromium || is_linux || is_chromeos) {
"../../media:rtc_media_base",
"../portal",
]
+ if (build_with_mozilla) {
+ configs -= [ "../portal:pipewire_base" ]
+ public_deps = [ "//third_party/pipewire" ]
+ }
}
}
if (is_win) {
diff --git a/modules/video_capture/linux/device_info_pipewire.cc b/modules/video_capture/linux/device_info_pipewire.cc
index 1dee78f5ee..2cb6161514 100644
--- a/modules/video_capture/linux/device_info_pipewire.cc
+++ b/modules/video_capture/linux/device_info_pipewire.cc
@@ -47,7 +47,8 @@ int32_t DeviceInfoPipeWire::GetDeviceName(uint32_t deviceNumber,
char* deviceUniqueIdUTF8,
uint32_t deviceUniqueIdUTF8Length,
char* productUniqueIdUTF8,
- uint32_t productUniqueIdUTF8Length) {
+ uint32_t productUniqueIdUTF8Length,
+ pid_t* pid) {
if (deviceNumber >= NumberOfDevices())
return -1;
+// These defines are here to support building on kernel 3.16 which some
+// downstream projects, e.g. Firefox, use.
+// TODO(apehrson): Remove them and their undefs when no longer needed.
+#ifndef V4L2_PIX_FMT_ABGR32
+#define ABGR32_OVERRIDE 1
+#define V4L2_PIX_FMT_ABGR32 v4l2_fourcc('A', 'R', '2', '4')
+#endif
+
+#ifndef V4L2_PIX_FMT_ARGB32
+#define ARGB32_OVERRIDE 1
+#define V4L2_PIX_FMT_ARGB32 v4l2_fourcc('B', 'A', '2', '4')
+#endif
+
+#ifndef V4L2_PIX_FMT_RGBA32
+#define RGBA32_OVERRIDE 1
+#define V4L2_PIX_FMT_RGBA32 v4l2_fourcc('A', 'B', '2', '4')
+#endif
+
namespace webrtc {
namespace videocapturemodule {
#ifdef WEBRTC_LINUX
diff --git a/modules/video_capture/linux/device_info_pipewire.h b/modules/video_capture/linux/device_info_pipewire.h
index a006c85d1b..724717be5e 100644
--- a/modules/video_capture/linux/device_info_pipewire.h
+++ b/modules/video_capture/linux/device_info_pipewire.h
@@ -29,7 +29,8 @@ class DeviceInfoPipeWire : public DeviceInfoImpl {
char* deviceUniqueIdUTF8,
uint32_t deviceUniqueIdUTF8Length,
char* productUniqueIdUTF8 = nullptr,
- uint32_t productUniqueIdUTF8Length = 0) override;
+ uint32_t productUniqueIdUTF8Length = 0,
+ pid_t* pid = 0) override;
/*
* Fills the membervariable _captureCapabilities with capabilites for the
* given device name.

Просмотреть файл

@ -1,55 +1,29 @@
From: Nico Grunbaum <na-g@nostrum.com>
Date: Tue, 6 Jun 2023 16:37:00 -0700
Subject: Bug 1833237 - (fix-f0be3bee1f) remove reference to
portal:pipewire_base;r?pehrsons
From: Jan-Ivar Bruaroey <jib@mozilla.com>
Date: Wed, 28 Jun 2023 20:45:00 -0400
Subject: Bug 1839451 - (fix-0f43da2248) Keep mozilla's
RTCPReceiver::RemoteRTCPSenderInfo function working.
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/8ff886a4d366b4be35b329d1ef733a6df542067c
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/154c9cdb386d0f50c5e1549270e1af6ab4969602
---
modules/video_capture/BUILD.gn | 4 ++++
modules/video_capture/linux/device_info_pipewire.cc | 3 ++-
modules/video_capture/linux/device_info_pipewire.h | 3 ++-
3 files changed, 8 insertions(+), 2 deletions(-)
modules/rtp_rtcp/source/rtcp_receiver.cc | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/modules/video_capture/BUILD.gn b/modules/video_capture/BUILD.gn
index 8f89918359..45a0272eee 100644
--- a/modules/video_capture/BUILD.gn
+++ b/modules/video_capture/BUILD.gn
@@ -104,6 +104,10 @@ if (!build_with_chromium || is_linux || is_chromeos) {
"../../media:rtc_media_base",
"../portal",
]
+ if (build_with_mozilla) {
+ configs -= [ "../portal:pipewire_base" ]
+ public_deps = [ "//third_party/pipewire" ]
+ }
}
}
if (is_win) {
diff --git a/modules/video_capture/linux/device_info_pipewire.cc b/modules/video_capture/linux/device_info_pipewire.cc
index 1dee78f5ee..2cb6161514 100644
--- a/modules/video_capture/linux/device_info_pipewire.cc
+++ b/modules/video_capture/linux/device_info_pipewire.cc
@@ -47,7 +47,8 @@ int32_t DeviceInfoPipeWire::GetDeviceName(uint32_t deviceNumber,
char* deviceUniqueIdUTF8,
uint32_t deviceUniqueIdUTF8Length,
char* productUniqueIdUTF8,
- uint32_t productUniqueIdUTF8Length) {
+ uint32_t productUniqueIdUTF8Length,
+ pid_t* pid) {
if (deviceNumber >= NumberOfDevices())
return -1;
diff --git a/modules/rtp_rtcp/source/rtcp_receiver.cc b/modules/rtp_rtcp/source/rtcp_receiver.cc
index 94de316421..bda6ad9a52 100644
--- a/modules/rtp_rtcp/source/rtcp_receiver.cc
+++ b/modules/rtp_rtcp/source/rtcp_receiver.cc
@@ -368,10 +368,10 @@ void RTCPReceiver::RemoteRTCPSenderInfo(uint32_t* packet_count,
int64_t* ntp_timestamp_ms,
int64_t* remote_ntp_timestamp_ms) const {
MutexLock lock(&rtcp_receiver_lock_);
- *packet_count = remote_sender_packet_count_;
- *octet_count = remote_sender_octet_count_;
- *ntp_timestamp_ms = last_received_sr_ntp_.ToMs();
- *remote_ntp_timestamp_ms = remote_sender_ntp_time_.ToMs();
+ *packet_count = remote_sender_.packets_sent;
+ *octet_count = remote_sender_.bytes_sent;
+ *ntp_timestamp_ms = remote_sender_.last_arrival_timestamp.ToMs();
+ *remote_ntp_timestamp_ms = remote_sender_.last_remote_timestamp.ToMs();
}
diff --git a/modules/video_capture/linux/device_info_pipewire.h b/modules/video_capture/linux/device_info_pipewire.h
index a006c85d1b..724717be5e 100644
--- a/modules/video_capture/linux/device_info_pipewire.h
+++ b/modules/video_capture/linux/device_info_pipewire.h
@@ -29,7 +29,8 @@ class DeviceInfoPipeWire : public DeviceInfoImpl {
char* deviceUniqueIdUTF8,
uint32_t deviceUniqueIdUTF8Length,
char* productUniqueIdUTF8 = nullptr,
- uint32_t productUniqueIdUTF8Length = 0) override;
+ uint32_t productUniqueIdUTF8Length = 0,
+ pid_t* pid = 0) override;
/*
* Fills the membervariable _captureCapabilities with capabilites for the
* given device name.
std::vector<ReportBlockData> RTCPReceiver::GetLatestReportBlockData() const {

Просмотреть файл

@ -1,29 +1,33 @@
From: Jan-Ivar Bruaroey <jib@mozilla.com>
Date: Wed, 28 Jun 2023 20:45:00 -0400
Subject: Bug 1839451 - (fix-0f43da2248) Keep mozilla's
RTCPReceiver::RemoteRTCPSenderInfo function working.
From: Nico Grunbaum <na-g@nostrum.com>
Date: Thu, 22 Jun 2023 16:23:00 +0000
Subject: Bug 1837918 - libwebrtc update broke the build on
OpenBSD;r=mjf,webrtc-reviewers
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/154c9cdb386d0f50c5e1549270e1af6ab4969602
Differential Revision: https://phabricator.services.mozilla.com/D181791
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/2a6a838b7021bb285f9485c2ceda6ba2543e0d6f
---
modules/rtp_rtcp/source/rtcp_receiver.cc | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
modules/video_capture/video_capture_options.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules/rtp_rtcp/source/rtcp_receiver.cc b/modules/rtp_rtcp/source/rtcp_receiver.cc
index 94de316421..bda6ad9a52 100644
--- a/modules/rtp_rtcp/source/rtcp_receiver.cc
+++ b/modules/rtp_rtcp/source/rtcp_receiver.cc
@@ -368,10 +368,10 @@ void RTCPReceiver::RemoteRTCPSenderInfo(uint32_t* packet_count,
int64_t* ntp_timestamp_ms,
int64_t* remote_ntp_timestamp_ms) const {
MutexLock lock(&rtcp_receiver_lock_);
- *packet_count = remote_sender_packet_count_;
- *octet_count = remote_sender_octet_count_;
- *ntp_timestamp_ms = last_received_sr_ntp_.ToMs();
- *remote_ntp_timestamp_ms = remote_sender_ntp_time_.ToMs();
+ *packet_count = remote_sender_.packets_sent;
+ *octet_count = remote_sender_.bytes_sent;
+ *ntp_timestamp_ms = remote_sender_.last_arrival_timestamp.ToMs();
+ *remote_ntp_timestamp_ms = remote_sender_.last_remote_timestamp.ToMs();
}
diff --git a/modules/video_capture/video_capture_options.h b/modules/video_capture/video_capture_options.h
index 6f72f7927e..37965305d9 100644
--- a/modules/video_capture/video_capture_options.h
+++ b/modules/video_capture/video_capture_options.h
@@ -55,7 +55,7 @@ class RTC_EXPORT VideoCaptureOptions {
std::vector<ReportBlockData> RTCPReceiver::GetLatestReportBlockData() const {
void Init(Callback* callback);
-#if defined(WEBRTC_LINUX)
+#if defined(WEBRTC_LINUX) || defined(WEBRTC_BSD)
bool allow_v4l2() const { return allow_v4l2_; }
void set_allow_v4l2(bool allow) { allow_v4l2_ = allow; }
#endif
@@ -68,7 +68,7 @@ class RTC_EXPORT VideoCaptureOptions {
#endif
private:
-#if defined(WEBRTC_LINUX)
+#if defined(WEBRTC_LINUX) || defined(WEBRTC_BSD)
bool allow_v4l2_ = false;
#endif
#if defined(WEBRTC_USE_PIPEWIRE)

Просмотреть файл

@ -1,33 +1,24 @@
From: Nico Grunbaum <na-g@nostrum.com>
Date: Thu, 22 Jun 2023 16:23:00 +0000
Subject: Bug 1837918 - libwebrtc update broke the build on
OpenBSD;r=mjf,webrtc-reviewers
From: Michael Froman <mfroman@mozilla.com>
Date: Wed, 5 Jul 2023 19:15:00 +0000
Subject: Bug 1841864 - upstream commit 4baea5b07f should properly check size
of encoder_config_.simulcast_layers. r=jib
Differential Revision: https://phabricator.services.mozilla.com/D181791
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/2a6a838b7021bb285f9485c2ceda6ba2543e0d6f
Differential Revision: https://phabricator.services.mozilla.com/D182813
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/a7179d8d75313b6c9c76a496e10d102da019ff4f
---
modules/video_capture/video_capture_options.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
video/video_stream_encoder.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/video_capture/video_capture_options.h b/modules/video_capture/video_capture_options.h
index 6f72f7927e..37965305d9 100644
--- a/modules/video_capture/video_capture_options.h
+++ b/modules/video_capture/video_capture_options.h
@@ -55,7 +55,7 @@ class RTC_EXPORT VideoCaptureOptions {
diff --git a/video/video_stream_encoder.cc b/video/video_stream_encoder.cc
index c367510b21..472f61ac1f 100644
--- a/video/video_stream_encoder.cc
+++ b/video/video_stream_encoder.cc
@@ -1387,7 +1387,7 @@ void VideoStreamEncoder::ReconfigureEncoder() {
void Init(Callback* callback);
-#if defined(WEBRTC_LINUX)
+#if defined(WEBRTC_LINUX) || defined(WEBRTC_BSD)
bool allow_v4l2() const { return allow_v4l2_; }
void set_allow_v4l2(bool allow) { allow_v4l2_ = allow; }
#endif
@@ -68,7 +68,7 @@ class RTC_EXPORT VideoCaptureOptions {
#endif
private:
-#if defined(WEBRTC_LINUX)
+#if defined(WEBRTC_LINUX) || defined(WEBRTC_BSD)
bool allow_v4l2_ = false;
#endif
#if defined(WEBRTC_USE_PIPEWIRE)
bool is_svc = false;
bool single_stream_or_non_first_inactive = true;
- for (size_t i = 1; i < encoder_config_.number_of_streams; ++i) {
+ for (size_t i = 1; i < encoder_config_.simulcast_layers.size(); ++i) {
if (encoder_config_.simulcast_layers[i].active) {
single_stream_or_non_first_inactive = false;
break;

Просмотреть файл

@ -1,24 +1,24 @@
From: Michael Froman <mfroman@mozilla.com>
Date: Wed, 5 Jul 2023 19:15:00 +0000
Subject: Bug 1841864 - upstream commit 4baea5b07f should properly check size
of encoder_config_.simulcast_layers. r=jib
From: Mike Hommey <mh+mozilla@glandium.org>
Date: Fri, 7 Jul 2023 00:58:00 +0000
Subject: Bug 1841577 - Don't set WEBRTC_ENABLE_AVX2 on platforms that don't
have AVX2. r=mjf,webrtc-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D182813
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/a7179d8d75313b6c9c76a496e10d102da019ff4f
Differential Revision: https://phabricator.services.mozilla.com/D182695
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/46fb51c90709be64c35946a8cf69195121441024
---
video/video_stream_encoder.cc | 2 +-
webrtc.gni | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/video/video_stream_encoder.cc b/video/video_stream_encoder.cc
index c367510b21..472f61ac1f 100644
--- a/video/video_stream_encoder.cc
+++ b/video/video_stream_encoder.cc
@@ -1387,7 +1387,7 @@ void VideoStreamEncoder::ReconfigureEncoder() {
diff --git a/webrtc.gni b/webrtc.gni
index 9b7a706f20..d2b88e9a4b 100644
--- a/webrtc.gni
+++ b/webrtc.gni
@@ -310,7 +310,7 @@ declare_args() {
bool is_svc = false;
bool single_stream_or_non_first_inactive = true;
- for (size_t i = 1; i < encoder_config_.number_of_streams; ++i) {
+ for (size_t i = 1; i < encoder_config_.simulcast_layers.size(); ++i) {
if (encoder_config_.simulcast_layers[i].active) {
single_stream_or_non_first_inactive = false;
break;
# Set this to true to enable the avx2 support in webrtc.
# TODO: Make sure that AVX2 works also for non-clang compilers.
- if (is_clang == true) {
+ if (is_clang == true && (target_cpu == "x86" || target_cpu == "x64")) {
rtc_enable_avx2 = true
} else {
rtc_enable_avx2 = false

Просмотреть файл

@ -1,24 +1,26 @@
From: Mike Hommey <mh+mozilla@glandium.org>
Date: Fri, 7 Jul 2023 00:58:00 +0000
Subject: Bug 1841577 - Don't set WEBRTC_ENABLE_AVX2 on platforms that don't
have AVX2. r=mjf,webrtc-reviewers
From: Byron Campen <docfaraday@gmail.com>
Date: Thu, 20 Jul 2023 14:24:00 +0000
Subject: Bug 1838080: Remove this duplicate init (that's also on the wrong
thread). r=pehrsons,webrtc-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D182695
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/46fb51c90709be64c35946a8cf69195121441024
This was causing assertions.
Differential Revision: https://phabricator.services.mozilla.com/D179731
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/6ac6592a04a839a6152d5ad5f0778f63dbbd6b1b
---
webrtc.gni | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
audio/channel_send.cc | 2 --
1 file changed, 2 deletions(-)
diff --git a/webrtc.gni b/webrtc.gni
index 9b7a706f20..d2b88e9a4b 100644
--- a/webrtc.gni
+++ b/webrtc.gni
@@ -310,7 +310,7 @@ declare_args() {
diff --git a/audio/channel_send.cc b/audio/channel_send.cc
index e99aa291a1..a7b5b1ffc0 100644
--- a/audio/channel_send.cc
+++ b/audio/channel_send.cc
@@ -458,8 +458,6 @@ ChannelSend::ChannelSend(
# Set this to true to enable the avx2 support in webrtc.
# TODO: Make sure that AVX2 works also for non-clang compilers.
- if (is_clang == true) {
+ if (is_clang == true && (target_cpu == "x86" || target_cpu == "x64")) {
rtc_enable_avx2 = true
} else {
rtc_enable_avx2 = false
int error = audio_coding_->RegisterTransportCallback(this);
RTC_DCHECK_EQ(0, error);
- if (frame_transformer)
- InitFrameTransformerDelegate(std::move(frame_transformer));
}
ChannelSend::~ChannelSend() {

Просмотреть файл

@ -1,26 +1,39 @@
From: Byron Campen <docfaraday@gmail.com>
Date: Thu, 20 Jul 2023 14:24:00 +0000
Subject: Bug 1838080: Remove this duplicate init (that's also on the wrong
thread). r=pehrsons,webrtc-reviewers
Subject: Bug 1838080: Work around a race in
ChannelSendFrameTransformerDelegate. r=pehrsons,webrtc-reviewers
This was causing assertions.
This variable can be null when a ChannelSendFrameTransformerDelegate is in use,
because that does an async dispatch to the encoder queue in the handling for
transformed frames. If this is unset while that dispatch is in flight, we
nullptr crash.
Differential Revision: https://phabricator.services.mozilla.com/D179731
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/6ac6592a04a839a6152d5ad5f0778f63dbbd6b1b
Differential Revision: https://phabricator.services.mozilla.com/D180735
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/56555ecee7f36ae73abff1cbbd06807c2b65fc19
---
audio/channel_send.cc | 2 --
1 file changed, 2 deletions(-)
audio/channel_send.cc | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/audio/channel_send.cc b/audio/channel_send.cc
index e99aa291a1..a7b5b1ffc0 100644
index a7b5b1ffc0..47b4273d28 100644
--- a/audio/channel_send.cc
+++ b/audio/channel_send.cc
@@ -458,8 +458,6 @@ ChannelSend::ChannelSend(
@@ -281,12 +281,16 @@ class RtpPacketSenderProxy : public RtpPacketSender {
void EnqueuePackets(
std::vector<std::unique_ptr<RtpPacketToSend>> packets) override {
MutexLock lock(&mutex_);
- rtp_packet_pacer_->EnqueuePackets(std::move(packets));
+ if (rtp_packet_pacer_) {
+ rtp_packet_pacer_->EnqueuePackets(std::move(packets));
+ }
}
int error = audio_coding_->RegisterTransportCallback(this);
RTC_DCHECK_EQ(0, error);
- if (frame_transformer)
- InitFrameTransformerDelegate(std::move(frame_transformer));
}
void RemovePacketsForSsrc(uint32_t ssrc) override {
MutexLock lock(&mutex_);
- rtp_packet_pacer_->RemovePacketsForSsrc(ssrc);
+ if (rtp_packet_pacer_) {
+ rtp_packet_pacer_->RemovePacketsForSsrc(ssrc);
+ }
}
ChannelSend::~ChannelSend() {
private:

Просмотреть файл

@ -1,39 +1,66 @@
From: Byron Campen <docfaraday@gmail.com>
Date: Thu, 20 Jul 2023 14:24:00 +0000
Subject: Bug 1838080: Work around a race in
ChannelSendFrameTransformerDelegate. r=pehrsons,webrtc-reviewers
Subject: Bug 1838080: Use the current TaskQueue, instead of the current
thread, to init this. r=pehrsons,webrtc-reviewers
This variable can be null when a ChannelSendFrameTransformerDelegate is in use,
because that does an async dispatch to the encoder queue in the handling for
transformed frames. If this is unset while that dispatch is in flight, we
nullptr crash.
There are situations where the current thread is not set, but the current
TaskQueue is (but not vice versa).
Differential Revision: https://phabricator.services.mozilla.com/D180735
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/56555ecee7f36ae73abff1cbbd06807c2b65fc19
Differential Revision: https://phabricator.services.mozilla.com/D180736
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/62e71a2f745c4b98d5ee7ce9e6386aa1b657be9b
---
audio/channel_send.cc | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
.../rtp_video_stream_receiver_frame_transformer_delegate.cc | 3 +--
.../rtp_video_stream_receiver_frame_transformer_delegate.h | 5 ++---
video/rtp_video_stream_receiver2.cc | 2 +-
3 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/audio/channel_send.cc b/audio/channel_send.cc
index a7b5b1ffc0..47b4273d28 100644
--- a/audio/channel_send.cc
+++ b/audio/channel_send.cc
@@ -281,12 +281,16 @@ class RtpPacketSenderProxy : public RtpPacketSender {
void EnqueuePackets(
std::vector<std::unique_ptr<RtpPacketToSend>> packets) override {
MutexLock lock(&mutex_);
- rtp_packet_pacer_->EnqueuePackets(std::move(packets));
+ if (rtp_packet_pacer_) {
+ rtp_packet_pacer_->EnqueuePackets(std::move(packets));
+ }
}
diff --git a/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.cc b/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.cc
index 4913445860..79a3238522 100644
--- a/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.cc
+++ b/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.cc
@@ -90,8 +90,7 @@ RtpVideoStreamReceiverFrameTransformerDelegate::
RtpVideoFrameReceiver* receiver,
Clock* clock,
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer,
- rtc::Thread* network_thread,
- uint32_t ssrc)
+ TaskQueueBase* network_thread, uint32_t ssrc)
: receiver_(receiver),
frame_transformer_(std::move(frame_transformer)),
network_thread_(network_thread),
diff --git a/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.h b/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.h
index 62a42fdddf..20f9a5caa9 100644
--- a/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.h
+++ b/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.h
@@ -41,8 +41,7 @@ class RtpVideoStreamReceiverFrameTransformerDelegate
RtpVideoFrameReceiver* receiver,
Clock* clock,
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer,
- rtc::Thread* network_thread,
- uint32_t ssrc);
+ TaskQueueBase* network_thread, uint32_t ssrc);
void RemovePacketsForSsrc(uint32_t ssrc) override {
MutexLock lock(&mutex_);
- rtp_packet_pacer_->RemovePacketsForSsrc(ssrc);
+ if (rtp_packet_pacer_) {
+ rtp_packet_pacer_->RemovePacketsForSsrc(ssrc);
+ }
void Init();
void Reset();
@@ -67,7 +66,7 @@ class RtpVideoStreamReceiverFrameTransformerDelegate
RtpVideoFrameReceiver* receiver_ RTC_GUARDED_BY(network_sequence_checker_);
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer_
RTC_GUARDED_BY(network_sequence_checker_);
- rtc::Thread* const network_thread_;
+ TaskQueueBase* const network_thread_;
const uint32_t ssrc_;
Clock* const clock_;
};
diff --git a/video/rtp_video_stream_receiver2.cc b/video/rtp_video_stream_receiver2.cc
index 94df09c440..00b94284c5 100644
--- a/video/rtp_video_stream_receiver2.cc
+++ b/video/rtp_video_stream_receiver2.cc
@@ -341,7 +341,7 @@ RtpVideoStreamReceiver2::RtpVideoStreamReceiver2(
if (frame_transformer) {
frame_transformer_delegate_ =
rtc::make_ref_counted<RtpVideoStreamReceiverFrameTransformerDelegate>(
- this, clock_, std::move(frame_transformer), rtc::Thread::Current(),
+ this, clock_, std::move(frame_transformer), TaskQueueBase::Current(),
config_.rtp.remote_ssrc);
frame_transformer_delegate_->Init();
}
private:

Просмотреть файл

@ -1,66 +1,166 @@
From: Byron Campen <docfaraday@gmail.com>
Date: Thu, 20 Jul 2023 14:24:00 +0000
Subject: Bug 1838080: Use the current TaskQueue, instead of the current
thread, to init this. r=pehrsons,webrtc-reviewers
From: Michael Froman <mjfroman@mac.com>
Date: Thu, 27 Jul 2023 12:42:44 -0500
Subject: Bug 1838080: Store the rid in TransformableVideoSenderFrame.
r=ng,webrtc-reviewers
There are situations where the current thread is not set, but the current
TaskQueue is (but not vice versa).
This is necessary to reliably detect what rid a given keyframe is for, for the
purposes of resolving promises from RTCRtpScriptTransformer.generateKeyFrame.
Differential Revision: https://phabricator.services.mozilla.com/D180736
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/62e71a2f745c4b98d5ee7ce9e6386aa1b657be9b
Differential Revision: https://phabricator.services.mozilla.com/D180737
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/2f1a0ba74bf71cfa0bc4e77714b8a5276a70cc36
---
.../rtp_video_stream_receiver_frame_transformer_delegate.cc | 3 +--
.../rtp_video_stream_receiver_frame_transformer_delegate.h | 5 ++---
video/rtp_video_stream_receiver2.cc | 2 +-
3 files changed, 4 insertions(+), 6 deletions(-)
api/frame_transformer_interface.h | 1 +
modules/rtp_rtcp/source/rtp_sender.h | 4 ++++
modules/rtp_rtcp/source/rtp_sender_video.cc | 1 +
...rtp_sender_video_frame_transformer_delegate.cc | 15 +++++++++++----
.../rtp_sender_video_frame_transformer_delegate.h | 2 ++
..._stream_receiver_frame_transformer_delegate.cc | 5 +++++
6 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.cc b/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.cc
index 4913445860..79a3238522 100644
--- a/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.cc
+++ b/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.cc
@@ -90,8 +90,7 @@ RtpVideoStreamReceiverFrameTransformerDelegate::
RtpVideoFrameReceiver* receiver,
Clock* clock,
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer,
- rtc::Thread* network_thread,
- uint32_t ssrc)
+ TaskQueueBase* network_thread, uint32_t ssrc)
: receiver_(receiver),
diff --git a/api/frame_transformer_interface.h b/api/frame_transformer_interface.h
index bd9ea2d67a..62a955c508 100644
--- a/api/frame_transformer_interface.h
+++ b/api/frame_transformer_interface.h
@@ -59,6 +59,7 @@ class TransformableVideoFrameInterface : public TransformableFrameInterface {
public:
virtual ~TransformableVideoFrameInterface() = default;
virtual bool IsKeyFrame() const = 0;
+ virtual const std::string& GetRid() const = 0;
virtual VideoFrameMetadata Metadata() const = 0;
diff --git a/modules/rtp_rtcp/source/rtp_sender.h b/modules/rtp_rtcp/source/rtp_sender.h
index a398f16d46..8136730e4c 100644
--- a/modules/rtp_rtcp/source/rtp_sender.h
+++ b/modules/rtp_rtcp/source/rtp_sender.h
@@ -140,6 +140,10 @@ class RTPSender {
uint32_t SSRC() const RTC_LOCKS_EXCLUDED(send_mutex_) { return ssrc_; }
+ const std::string& Rid() const RTC_LOCKS_EXCLUDED(send_mutex_) {
+ return rid_;
+ }
+
absl::optional<uint32_t> FlexfecSsrc() const RTC_LOCKS_EXCLUDED(send_mutex_) {
return flexfec_ssrc_;
}
diff --git a/modules/rtp_rtcp/source/rtp_sender_video.cc b/modules/rtp_rtcp/source/rtp_sender_video.cc
index b846f7f7ea..6cc9938847 100644
--- a/modules/rtp_rtcp/source/rtp_sender_video.cc
+++ b/modules/rtp_rtcp/source/rtp_sender_video.cc
@@ -154,6 +154,7 @@ RTPSenderVideo::RTPSenderVideo(const Config& config)
this,
config.frame_transformer,
rtp_sender_->SSRC(),
+ rtp_sender_->Rid(),
config.task_queue_factory)
: nullptr) {
if (frame_transformer_delegate_)
diff --git a/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.cc b/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.cc
index 2281a2ae27..1e9fececc6 100644
--- a/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.cc
+++ b/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.cc
@@ -30,7 +30,8 @@ class TransformableVideoSenderFrame : public TransformableVideoFrameInterface {
uint32_t rtp_timestamp,
TimeDelta expected_retransmission_time,
uint32_t ssrc,
- std::vector<uint32_t> csrcs)
+ std::vector<uint32_t> csrcs,
+ const std::string& rid)
: encoded_data_(encoded_image.GetEncodedData()),
pre_transform_payload_size_(encoded_image.size()),
header_(video_header),
@@ -42,7 +43,8 @@ class TransformableVideoSenderFrame : public TransformableVideoFrameInterface {
capture_time_identifier_(encoded_image.CaptureTimeIdentifier()),
expected_retransmission_time_(expected_retransmission_time),
ssrc_(ssrc),
- csrcs_(csrcs) {
+ csrcs_(csrcs),
+ rid_(rid) {
RTC_DCHECK_GE(payload_type_, 0);
RTC_DCHECK_LE(payload_type_, 127);
}
@@ -98,6 +100,8 @@ class TransformableVideoSenderFrame : public TransformableVideoFrameInterface {
Direction GetDirection() const override { return Direction::kSender; }
+ const std::string& GetRid() const override { return rid_; }
+
private:
rtc::scoped_refptr<EncodedImageBufferInterface> encoded_data_;
const size_t pre_transform_payload_size_;
@@ -112,6 +116,7 @@ class TransformableVideoSenderFrame : public TransformableVideoFrameInterface {
uint32_t ssrc_;
std::vector<uint32_t> csrcs_;
+ const std::string rid_;
};
} // namespace
@@ -119,10 +124,12 @@ RTPSenderVideoFrameTransformerDelegate::RTPSenderVideoFrameTransformerDelegate(
RTPVideoFrameSenderInterface* sender,
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer,
uint32_t ssrc,
+ const std::string& rid,
TaskQueueFactory* task_queue_factory)
: sender_(sender),
frame_transformer_(std::move(frame_transformer)),
network_thread_(network_thread),
diff --git a/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.h b/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.h
index 62a42fdddf..20f9a5caa9 100644
--- a/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.h
+++ b/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.h
@@ -41,8 +41,7 @@ class RtpVideoStreamReceiverFrameTransformerDelegate
RtpVideoFrameReceiver* receiver,
Clock* clock,
ssrc_(ssrc),
+ rid_(rid),
transformation_queue_(task_queue_factory->CreateTaskQueue(
"video_frame_transformer",
TaskQueueFactory::Priority::NORMAL)) {}
@@ -142,7 +149,7 @@ bool RTPSenderVideoFrameTransformerDelegate::TransformFrame(
frame_transformer_->Transform(std::make_unique<TransformableVideoSenderFrame>(
encoded_image, video_header, payload_type, codec_type, rtp_timestamp,
expected_retransmission_time, ssrc_,
- /*csrcs=*/std::vector<uint32_t>()));
+ /*csrcs=*/std::vector<uint32_t>(), rid_));
return true;
}
@@ -236,7 +243,7 @@ std::unique_ptr<TransformableVideoFrameInterface> CloneSenderVideoFrame(
encoded_image, new_header, original->GetPayloadType(), new_header.codec,
original->GetTimestamp(),
/*expected_retransmission_time=*/TimeDelta::PlusInfinity(),
- original->GetSsrc(), metadata.GetCsrcs());
+ original->GetSsrc(), metadata.GetCsrcs(), original->GetRid());
}
} // namespace webrtc
diff --git a/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.h b/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.h
index a333db235a..3379ead364 100644
--- a/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.h
+++ b/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.h
@@ -58,6 +58,7 @@ class RTPSenderVideoFrameTransformerDelegate : public TransformedFrameCallback {
RTPVideoFrameSenderInterface* sender,
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer,
- rtc::Thread* network_thread,
- uint32_t ssrc);
+ TaskQueueBase* network_thread, uint32_t ssrc);
uint32_t ssrc,
+ const std::string& rid,
TaskQueueFactory* send_transport_queue);
void Init();
void Reset();
@@ -67,7 +66,7 @@ class RtpVideoStreamReceiverFrameTransformerDelegate
RtpVideoFrameReceiver* receiver_ RTC_GUARDED_BY(network_sequence_checker_);
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer_
RTC_GUARDED_BY(network_sequence_checker_);
- rtc::Thread* const network_thread_;
+ TaskQueueBase* const network_thread_;
@@ -104,6 +105,7 @@ class RTPSenderVideoFrameTransformerDelegate : public TransformedFrameCallback {
RTPVideoFrameSenderInterface* sender_ RTC_GUARDED_BY(sender_lock_);
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer_;
const uint32_t ssrc_;
Clock* const clock_;
};
diff --git a/video/rtp_video_stream_receiver2.cc b/video/rtp_video_stream_receiver2.cc
index 94df09c440..00b94284c5 100644
--- a/video/rtp_video_stream_receiver2.cc
+++ b/video/rtp_video_stream_receiver2.cc
@@ -341,7 +341,7 @@ RtpVideoStreamReceiver2::RtpVideoStreamReceiver2(
if (frame_transformer) {
frame_transformer_delegate_ =
rtc::make_ref_counted<RtpVideoStreamReceiverFrameTransformerDelegate>(
- this, clock_, std::move(frame_transformer), rtc::Thread::Current(),
+ this, clock_, std::move(frame_transformer), TaskQueueBase::Current(),
config_.rtp.remote_ssrc);
frame_transformer_delegate_->Init();
+ const std::string rid_;
// Used when the encoded frames arrives without a current task queue. This can
// happen if a hardware encoder was used.
std::unique_ptr<TaskQueueBase, TaskQueueDeleter> transformation_queue_;
diff --git a/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.cc b/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.cc
index 79a3238522..99fc711579 100644
--- a/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.cc
+++ b/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.cc
@@ -56,6 +56,11 @@ class TransformableVideoReceiverFrame
return frame_->FrameType() == VideoFrameType::kVideoFrameKey;
}
+ const std::string& GetRid() const override {
+ static const std::string empty;
+ return empty;
+ }
+
VideoFrameMetadata Metadata() const override { return metadata_; }
void SetMetadata(const VideoFrameMetadata& metadata) override {

Просмотреть файл

@ -1,166 +1,38 @@
From: Michael Froman <mjfroman@mac.com>
Date: Thu, 27 Jul 2023 12:42:44 -0500
Subject: Bug 1838080: Store the rid in TransformableVideoSenderFrame.
r=ng,webrtc-reviewers
From: Byron Campen <docfaraday@gmail.com>
Date: Thu, 20 Jul 2023 14:24:00 +0000
Subject: Bug 1838080: Ensure that last ref to transformation_queue_ is not
released on itself. r=pehrsons,webrtc-reviewers
This is necessary to reliably detect what rid a given keyframe is for, for the
purposes of resolving promises from RTCRtpScriptTransformer.generateKeyFrame.
Differential Revision: https://phabricator.services.mozilla.com/D180737
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/2f1a0ba74bf71cfa0bc4e77714b8a5276a70cc36
Differential Revision: https://phabricator.services.mozilla.com/D181699
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/91d9e8b6a5c430a73561ffd2330865f04fcb1a6d
---
api/frame_transformer_interface.h | 1 +
modules/rtp_rtcp/source/rtp_sender.h | 4 ++++
modules/rtp_rtcp/source/rtp_sender_video.cc | 1 +
...rtp_sender_video_frame_transformer_delegate.cc | 15 +++++++++++----
.../rtp_sender_video_frame_transformer_delegate.h | 2 ++
..._stream_receiver_frame_transformer_delegate.cc | 5 +++++
6 files changed, 24 insertions(+), 4 deletions(-)
.../rtp_sender_video_frame_transformer_delegate.cc | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/api/frame_transformer_interface.h b/api/frame_transformer_interface.h
index bd9ea2d67a..62a955c508 100644
--- a/api/frame_transformer_interface.h
+++ b/api/frame_transformer_interface.h
@@ -59,6 +59,7 @@ class TransformableVideoFrameInterface : public TransformableFrameInterface {
public:
virtual ~TransformableVideoFrameInterface() = default;
virtual bool IsKeyFrame() const = 0;
+ virtual const std::string& GetRid() const = 0;
virtual VideoFrameMetadata Metadata() const = 0;
diff --git a/modules/rtp_rtcp/source/rtp_sender.h b/modules/rtp_rtcp/source/rtp_sender.h
index a398f16d46..8136730e4c 100644
--- a/modules/rtp_rtcp/source/rtp_sender.h
+++ b/modules/rtp_rtcp/source/rtp_sender.h
@@ -140,6 +140,10 @@ class RTPSender {
uint32_t SSRC() const RTC_LOCKS_EXCLUDED(send_mutex_) { return ssrc_; }
+ const std::string& Rid() const RTC_LOCKS_EXCLUDED(send_mutex_) {
+ return rid_;
+ }
+
absl::optional<uint32_t> FlexfecSsrc() const RTC_LOCKS_EXCLUDED(send_mutex_) {
return flexfec_ssrc_;
}
diff --git a/modules/rtp_rtcp/source/rtp_sender_video.cc b/modules/rtp_rtcp/source/rtp_sender_video.cc
index b846f7f7ea..6cc9938847 100644
--- a/modules/rtp_rtcp/source/rtp_sender_video.cc
+++ b/modules/rtp_rtcp/source/rtp_sender_video.cc
@@ -154,6 +154,7 @@ RTPSenderVideo::RTPSenderVideo(const Config& config)
this,
config.frame_transformer,
rtp_sender_->SSRC(),
+ rtp_sender_->Rid(),
config.task_queue_factory)
: nullptr) {
if (frame_transformer_delegate_)
diff --git a/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.cc b/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.cc
index 2281a2ae27..1e9fececc6 100644
index 1e9fececc6..9c411bbe54 100644
--- a/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.cc
+++ b/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.cc
@@ -30,7 +30,8 @@ class TransformableVideoSenderFrame : public TransformableVideoFrameInterface {
uint32_t rtp_timestamp,
TimeDelta expected_retransmission_time,
uint32_t ssrc,
- std::vector<uint32_t> csrcs)
+ std::vector<uint32_t> csrcs,
+ const std::string& rid)
: encoded_data_(encoded_image.GetEncodedData()),
pre_transform_payload_size_(encoded_image.size()),
header_(video_header),
@@ -42,7 +43,8 @@ class TransformableVideoSenderFrame : public TransformableVideoFrameInterface {
capture_time_identifier_(encoded_image.CaptureTimeIdentifier()),
expected_retransmission_time_(expected_retransmission_time),
ssrc_(ssrc),
- csrcs_(csrcs) {
+ csrcs_(csrcs),
+ rid_(rid) {
RTC_DCHECK_GE(payload_type_, 0);
RTC_DCHECK_LE(payload_type_, 127);
@@ -17,6 +17,7 @@
#include "api/task_queue/task_queue_factory.h"
#include "modules/rtp_rtcp/source/rtp_descriptor_authentication.h"
#include "rtc_base/checks.h"
+#include "rtc_base/event.h"
namespace webrtc {
namespace {
@@ -224,6 +225,14 @@ void RTPSenderVideoFrameTransformerDelegate::Reset() {
MutexLock lock(&sender_lock_);
sender_ = nullptr;
}
@@ -98,6 +100,8 @@ class TransformableVideoSenderFrame : public TransformableVideoFrameInterface {
Direction GetDirection() const override { return Direction::kSender; }
+ const std::string& GetRid() const override { return rid_; }
+
private:
rtc::scoped_refptr<EncodedImageBufferInterface> encoded_data_;
const size_t pre_transform_payload_size_;
@@ -112,6 +116,7 @@ class TransformableVideoSenderFrame : public TransformableVideoFrameInterface {
uint32_t ssrc_;
std::vector<uint32_t> csrcs_;
+ const std::string rid_;
};
} // namespace
@@ -119,10 +124,12 @@ RTPSenderVideoFrameTransformerDelegate::RTPSenderVideoFrameTransformerDelegate(
RTPVideoFrameSenderInterface* sender,
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer,
uint32_t ssrc,
+ const std::string& rid,
TaskQueueFactory* task_queue_factory)
: sender_(sender),
frame_transformer_(std::move(frame_transformer)),
ssrc_(ssrc),
+ rid_(rid),
transformation_queue_(task_queue_factory->CreateTaskQueue(
"video_frame_transformer",
TaskQueueFactory::Priority::NORMAL)) {}
@@ -142,7 +149,7 @@ bool RTPSenderVideoFrameTransformerDelegate::TransformFrame(
frame_transformer_->Transform(std::make_unique<TransformableVideoSenderFrame>(
encoded_image, video_header, payload_type, codec_type, rtp_timestamp,
expected_retransmission_time, ssrc_,
- /*csrcs=*/std::vector<uint32_t>()));
+ /*csrcs=*/std::vector<uint32_t>(), rid_));
return true;
+ // Wait until all pending tasks are executed, to ensure that the last ref
+ // standing is not on the transformation queue.
+ rtc::Event flush;
+ transformation_queue_->PostTask([this, &flush]() {
+ RTC_DCHECK_RUN_ON(transformation_queue_.get());
+ flush.Set();
+ });
+ flush.Wait(rtc::Event::kForever);
}
@@ -236,7 +243,7 @@ std::unique_ptr<TransformableVideoFrameInterface> CloneSenderVideoFrame(
encoded_image, new_header, original->GetPayloadType(), new_header.codec,
original->GetTimestamp(),
/*expected_retransmission_time=*/TimeDelta::PlusInfinity(),
- original->GetSsrc(), metadata.GetCsrcs());
+ original->GetSsrc(), metadata.GetCsrcs(), original->GetRid());
}
} // namespace webrtc
diff --git a/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.h b/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.h
index a333db235a..3379ead364 100644
--- a/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.h
+++ b/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.h
@@ -58,6 +58,7 @@ class RTPSenderVideoFrameTransformerDelegate : public TransformedFrameCallback {
RTPVideoFrameSenderInterface* sender,
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer,
uint32_t ssrc,
+ const std::string& rid,
TaskQueueFactory* send_transport_queue);
void Init();
@@ -104,6 +105,7 @@ class RTPSenderVideoFrameTransformerDelegate : public TransformedFrameCallback {
RTPVideoFrameSenderInterface* sender_ RTC_GUARDED_BY(sender_lock_);
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer_;
const uint32_t ssrc_;
+ const std::string rid_;
// Used when the encoded frames arrives without a current task queue. This can
// happen if a hardware encoder was used.
std::unique_ptr<TaskQueueBase, TaskQueueDeleter> transformation_queue_;
diff --git a/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.cc b/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.cc
index 79a3238522..99fc711579 100644
--- a/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.cc
+++ b/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.cc
@@ -56,6 +56,11 @@ class TransformableVideoReceiverFrame
return frame_->FrameType() == VideoFrameType::kVideoFrameKey;
}
+ const std::string& GetRid() const override {
+ static const std::string empty;
+ return empty;
+ }
+
VideoFrameMetadata Metadata() const override { return metadata_; }
void SetMetadata(const VideoFrameMetadata& metadata) override {
std::unique_ptr<TransformableVideoFrameInterface> CloneSenderVideoFrame(

Просмотреть файл

@ -1,38 +1,28 @@
From: Byron Campen <docfaraday@gmail.com>
Date: Thu, 20 Jul 2023 14:24:00 +0000
Subject: Bug 1838080: Ensure that last ref to transformation_queue_ is not
released on itself. r=pehrsons,webrtc-reviewers
From: Michael Froman <mfroman@mozilla.com>
Date: Sat, 12 Aug 2023 18:57:00 +0000
Subject: Bug 1848045 - to upstream - fix misuse of rtc::strcpyn in
ApmDataDumper::SetOutputDirectory. r=ng,webrtc-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D181699
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/91d9e8b6a5c430a73561ffd2330865f04fcb1a6d
rtc::strcpyn second param should be the size of the destination buffer,
not the size of the source string. This has been masked because FormFileName
helpfully adds a trailing path separator if one is missing.
Differential Revision: https://phabricator.services.mozilla.com/D185862
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/5d935bb2573445a198af03cd3d5186243880ecdf
---
.../rtp_sender_video_frame_transformer_delegate.cc | 9 +++++++++
1 file changed, 9 insertions(+)
modules/audio_processing/logging/apm_data_dumper.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.cc b/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.cc
index 1e9fececc6..9c411bbe54 100644
--- a/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.cc
+++ b/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.cc
@@ -17,6 +17,7 @@
#include "api/task_queue/task_queue_factory.h"
#include "modules/rtp_rtcp/source/rtp_descriptor_authentication.h"
#include "rtc_base/checks.h"
+#include "rtc_base/event.h"
namespace webrtc {
namespace {
@@ -224,6 +225,14 @@ void RTPSenderVideoFrameTransformerDelegate::Reset() {
MutexLock lock(&sender_lock_);
sender_ = nullptr;
diff --git a/modules/audio_processing/logging/apm_data_dumper.h b/modules/audio_processing/logging/apm_data_dumper.h
index 4ab6baad83..76f8b34c0b 100644
--- a/modules/audio_processing/logging/apm_data_dumper.h
+++ b/modules/audio_processing/logging/apm_data_dumper.h
@@ -91,7 +91,7 @@ class ApmDataDumper {
static void SetOutputDirectory(absl::string_view output_dir) {
#if WEBRTC_APM_DEBUG_DUMP == 1
RTC_CHECK_LT(output_dir.size(), kOutputDirMaxLength);
- rtc::strcpyn(output_dir_, output_dir.size(), output_dir);
+ rtc::strcpyn(output_dir_, kOutputDirMaxLength, output_dir);
#endif
}
+ // Wait until all pending tasks are executed, to ensure that the last ref
+ // standing is not on the transformation queue.
+ rtc::Event flush;
+ transformation_queue_->PostTask([this, &flush]() {
+ RTC_DCHECK_RUN_ON(transformation_queue_.get());
+ flush.Set();
+ });
+ flush.Wait(rtc::Event::kForever);
}
std::unique_ptr<TransformableVideoFrameInterface> CloneSenderVideoFrame(

Просмотреть файл

@ -1,28 +1,38 @@
From: Michael Froman <mfroman@mozilla.com>
Date: Sat, 12 Aug 2023 18:57:00 +0000
Subject: Bug 1848045 - to upstream - fix misuse of rtc::strcpyn in
ApmDataDumper::SetOutputDirectory. r=ng,webrtc-reviewers
From: stransky <stransky@redhat.com>
Date: Tue, 29 Aug 2023 12:43:00 +0000
Subject: Bug 1821629 [DMABuf] Don't use DMABuf if it's disabled by Firefox gfx
config r=ng,webrtc-reviewers
rtc::strcpyn second param should be the size of the destination buffer,
not the size of the source string. This has been masked because FormFileName
helpfully adds a trailing path separator if one is missing.
Differential Revision: https://phabricator.services.mozilla.com/D185862
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/5d935bb2573445a198af03cd3d5186243880ecdf
Differential Revision: https://phabricator.services.mozilla.com/D172224
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/158a888cad8869a2f0026fa7cfaaa13ecbfcf2ed
---
modules/audio_processing/logging/apm_data_dumper.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
.../linux/wayland/shared_screencast_stream.cc | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/modules/audio_processing/logging/apm_data_dumper.h b/modules/audio_processing/logging/apm_data_dumper.h
index 4ab6baad83..76f8b34c0b 100644
--- a/modules/audio_processing/logging/apm_data_dumper.h
+++ b/modules/audio_processing/logging/apm_data_dumper.h
@@ -91,7 +91,7 @@ class ApmDataDumper {
static void SetOutputDirectory(absl::string_view output_dir) {
#if WEBRTC_APM_DEBUG_DUMP == 1
RTC_CHECK_LT(output_dir.size(), kOutputDirMaxLength);
- rtc::strcpyn(output_dir_, output_dir.size(), output_dir);
+ rtc::strcpyn(output_dir_, kOutputDirMaxLength, output_dir);
#endif
}
diff --git a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
index 0c26e7a7d5..22aa355e44 100644
--- a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
+++ b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
@@ -28,6 +28,13 @@
#include "rtc_base/synchronization/mutex.h"
#include "rtc_base/time_utils.h"
+// Wrapper for gfxVars::UseDMABuf() as we can't include gfxVars here.
+// We don't want to use dmabuf of known broken systems.
+// See FEATURE_DMABUF for details.
+namespace mozilla::gfx {
+bool IsDMABufEnabled();
+}
+
namespace webrtc {
const int kBytesPerPixel = 4;
@@ -294,7 +301,7 @@ void SharedScreenCastStreamPrivate::OnStreamParamChanged(
that->modifier_ =
has_modifier ? that->spa_video_format_.modifier : DRM_FORMAT_MOD_INVALID;
std::vector<const spa_pod*> params;
- const int buffer_types = has_modifier
+ const int buffer_types = has_modifier && mozilla::gfx::IsDMABufEnabled()
? (1 << SPA_DATA_DmaBuf) | (1 << SPA_DATA_MemFd)
: (1 << SPA_DATA_MemFd);

Просмотреть файл

@ -1,38 +1,47 @@
From: stransky <stransky@redhat.com>
Date: Tue, 29 Aug 2023 12:43:00 +0000
Subject: Bug 1821629 [DMABuf] Don't use DMABuf if it's disabled by Firefox gfx
config r=ng,webrtc-reviewers
Subject: Bug 1821629 [Pipewire/DMABuf] Don't create dmabuf backend if it's
disabled r=ng,webrtc-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D172224
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/158a888cad8869a2f0026fa7cfaaa13ecbfcf2ed
Depends on D172224
Differential Revision: https://phabricator.services.mozilla.com/D172229
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/237d19fe96dd7d25b6a817415ee4e6854678d648
---
.../linux/wayland/shared_screencast_stream.cc | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
.../linux/wayland/shared_screencast_stream.cc | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
index 0c26e7a7d5..22aa355e44 100644
index 22aa355e44..61c6957d27 100644
--- a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
+++ b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
@@ -28,6 +28,13 @@
#include "rtc_base/synchronization/mutex.h"
#include "rtc_base/time_utils.h"
@@ -419,7 +419,9 @@ bool SharedScreenCastStreamPrivate::StartScreenCastStream(
RTC_LOG(LS_ERROR) << "Unable to open PipeWire library";
return false;
}
- egl_dmabuf_ = std::make_unique<EglDmaBuf>();
+ if (mozilla::gfx::IsDMABufEnabled()) {
+ egl_dmabuf_ = std::make_unique<EglDmaBuf>();
+ }
+// Wrapper for gfxVars::UseDMABuf() as we can't include gfxVars here.
+// We don't want to use dmabuf of known broken systems.
+// See FEATURE_DMABUF for details.
+namespace mozilla::gfx {
+bool IsDMABufEnabled();
+}
+
namespace webrtc {
pw_stream_node_id_ = stream_node_id;
const int kBytesPerPixel = 4;
@@ -294,7 +301,7 @@ void SharedScreenCastStreamPrivate::OnStreamParamChanged(
that->modifier_ =
has_modifier ? that->spa_video_format_.modifier : DRM_FORMAT_MOD_INVALID;
std::vector<const spa_pod*> params;
- const int buffer_types = has_modifier
+ const int buffer_types = has_modifier && mozilla::gfx::IsDMABufEnabled()
? (1 << SPA_DATA_DmaBuf) | (1 << SPA_DATA_MemFd)
: (1 << SPA_DATA_MemFd);
@@ -508,7 +510,8 @@ bool SharedScreenCastStreamPrivate::StartScreenCastStream(
for (uint32_t format : {SPA_VIDEO_FORMAT_BGRA, SPA_VIDEO_FORMAT_RGBA,
SPA_VIDEO_FORMAT_BGRx, SPA_VIDEO_FORMAT_RGBx}) {
// Modifiers can be used with PipeWire >= 0.3.33
- if (has_required_pw_client_version && has_required_pw_server_version) {
+ if (egl_dmabuf_ &&
+ has_required_pw_client_version && has_required_pw_server_version) {
modifiers_ = egl_dmabuf_->QueryDmaBufModifiers(format);
if (!modifiers_.empty()) {
@@ -927,7 +930,7 @@ bool SharedScreenCastStreamPrivate::ProcessDMABuffer(
const uint n_planes = spa_buffer->n_datas;
- if (!n_planes) {
+ if (!n_planes || !egl_dmabuf_) {
return false;
}

Просмотреть файл

@ -1,47 +1,41 @@
From: stransky <stransky@redhat.com>
Date: Tue, 29 Aug 2023 12:43:00 +0000
Subject: Bug 1821629 [Pipewire/DMABuf] Don't create dmabuf backend if it's
disabled r=ng,webrtc-reviewers
From: Robert Mader <robert.mader@posteo.de>
Date: Wed, 6 Sep 2023 16:37:00 +0000
Subject: Bug 1843786 - webrtc: Filter out non-camera nodes,
r=webrtc-reviewers,pehrsons,@webrtc-reviewers
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Depends on D172224
This can be helpful in various situations, such as debugging with an
unrestricted Pipewire socket or for downstream projects like
B2G/Capyloon. Additionally it will help once we move from the camera
portal to the more generic device portal.
Differential Revision: https://phabricator.services.mozilla.com/D172229
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/237d19fe96dd7d25b6a817415ee4e6854678d648
This is intended to get upstreamed but would be nice to carry downstream
already.
Original patch by Fabrice Desré <fabrice@desre.org>
Upstream commit: a717c7ada811411e31bd7308168b4dbee5b956fa
Differential Revision: https://phabricator.services.mozilla.com/D183650
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/4c2505f533280d9012e28633e410a66b0db95412
---
.../linux/wayland/shared_screencast_stream.cc | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
modules/video_capture/linux/pipewire_session.cc | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
index 22aa355e44..61c6957d27 100644
--- a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
+++ b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
@@ -419,7 +419,9 @@ bool SharedScreenCastStreamPrivate::StartScreenCastStream(
RTC_LOG(LS_ERROR) << "Unable to open PipeWire library";
return false;
}
- egl_dmabuf_ = std::make_unique<EglDmaBuf>();
+ if (mozilla::gfx::IsDMABufEnabled()) {
+ egl_dmabuf_ = std::make_unique<EglDmaBuf>();
+ }
pw_stream_node_id_ = stream_node_id;
@@ -508,7 +510,8 @@ bool SharedScreenCastStreamPrivate::StartScreenCastStream(
for (uint32_t format : {SPA_VIDEO_FORMAT_BGRA, SPA_VIDEO_FORMAT_RGBA,
SPA_VIDEO_FORMAT_BGRx, SPA_VIDEO_FORMAT_RGBx}) {
// Modifiers can be used with PipeWire >= 0.3.33
- if (has_required_pw_client_version && has_required_pw_server_version) {
+ if (egl_dmabuf_ &&
+ has_required_pw_client_version && has_required_pw_server_version) {
modifiers_ = egl_dmabuf_->QueryDmaBufModifiers(format);
if (!modifiers_.empty()) {
@@ -927,7 +930,7 @@ bool SharedScreenCastStreamPrivate::ProcessDMABuffer(
const uint n_planes = spa_buffer->n_datas;
- if (!n_planes) {
+ if (!n_planes || !egl_dmabuf_) {
return false;
}
diff --git a/modules/video_capture/linux/pipewire_session.cc b/modules/video_capture/linux/pipewire_session.cc
index 3f52b3dd61..4d1b200aca 100644
--- a/modules/video_capture/linux/pipewire_session.cc
+++ b/modules/video_capture/linux/pipewire_session.cc
@@ -360,6 +360,10 @@ void PipeWireSession::OnRegistryGlobal(void* data,
if (!spa_dict_lookup(props, PW_KEY_NODE_DESCRIPTION))
return;
+ auto node_role = spa_dict_lookup(props, PW_KEY_MEDIA_ROLE);
+ if (!node_role || strcmp(node_role, "Camera"))
+ return;
+
that->nodes_.emplace_back(that, id, props);
that->PipeWireSync();
}

Просмотреть файл

@ -1,41 +1,71 @@
From: Robert Mader <robert.mader@posteo.de>
Date: Wed, 6 Sep 2023 16:37:00 +0000
Subject: Bug 1843786 - webrtc: Filter out non-camera nodes,
Subject: Bug 1843786 - webrtc: Implement Pipewire camera rotation support,
r=webrtc-reviewers,pehrsons,@webrtc-reviewers
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This can be helpful in various situations, such as debugging with an
unrestricted Pipewire socket or for downstream projects like
B2G/Capyloon. Additionally it will help once we move from the camera
portal to the more generic device portal.
Support the Pipewire videotransform meta via the already existing shared
infrastructure. This is needed for mobile devices which often have a 90
degree rotated camera - which is likely the reason there is already
support in the shared code paths.
This is intended to get upstreamed but would be nice to carry downstream
already.
Upstream commit: dc4c019c62abefc09e4903abea44bc36f3427452
Original patch by Fabrice Desré <fabrice@desre.org>
Upstream commit: a717c7ada811411e31bd7308168b4dbee5b956fa
Differential Revision: https://phabricator.services.mozilla.com/D183650
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/4c2505f533280d9012e28633e410a66b0db95412
Differential Revision: https://phabricator.services.mozilla.com/D183652
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/1db7a958b945838c64dcfcb638f79b99f729b364
---
modules/video_capture/linux/pipewire_session.cc | 4 ++++
1 file changed, 4 insertions(+)
.../linux/video_capture_pipewire.cc | 28 +++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/modules/video_capture/linux/pipewire_session.cc b/modules/video_capture/linux/pipewire_session.cc
index 3f52b3dd61..4d1b200aca 100644
--- a/modules/video_capture/linux/pipewire_session.cc
+++ b/modules/video_capture/linux/pipewire_session.cc
@@ -360,6 +360,10 @@ void PipeWireSession::OnRegistryGlobal(void* data,
if (!spa_dict_lookup(props, PW_KEY_NODE_DESCRIPTION))
return;
+ auto node_role = spa_dict_lookup(props, PW_KEY_MEDIA_ROLE);
+ if (!node_role || strcmp(node_role, "Camera"))
+ return;
+
that->nodes_.emplace_back(that, id, props);
that->PipeWireSync();
diff --git a/modules/video_capture/linux/video_capture_pipewire.cc b/modules/video_capture/linux/video_capture_pipewire.cc
index 46cfe9bc15..7b79f15a6c 100644
--- a/modules/video_capture/linux/video_capture_pipewire.cc
+++ b/modules/video_capture/linux/video_capture_pipewire.cc
@@ -301,6 +301,10 @@ void VideoCaptureModulePipeWire::OnFormatChanged(const struct spa_pod* format) {
&builder, SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta, SPA_PARAM_META_type,
SPA_POD_Id(SPA_META_Header), SPA_PARAM_META_size,
SPA_POD_Int(sizeof(struct spa_meta_header)))));
+ params.push_back(reinterpret_cast<spa_pod*>(spa_pod_builder_add_object(
+ &builder, SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta, SPA_PARAM_META_type,
+ SPA_POD_Id(SPA_META_VideoTransform), SPA_PARAM_META_size,
+ SPA_POD_Int(sizeof(struct spa_meta_videotransform)))));
pw_stream_update_params(stream_, params.data(), params.size());
}
@@ -341,6 +345,19 @@ void VideoCaptureModulePipeWire::OnStreamProcess(void* data) {
that->ProcessBuffers();
}
+static VideoRotation VideorotationFromPipeWireTransform(uint32_t transform) {
+ switch (transform) {
+ case SPA_META_TRANSFORMATION_90:
+ return kVideoRotation_90;
+ case SPA_META_TRANSFORMATION_180:
+ return kVideoRotation_180;
+ case SPA_META_TRANSFORMATION_270:
+ return kVideoRotation_270;
+ default:
+ return kVideoRotation_0;
+ }
+}
+
void VideoCaptureModulePipeWire::ProcessBuffers() {
RTC_CHECK_RUNS_SERIALIZED(&capture_checker_);
@@ -349,6 +366,17 @@ void VideoCaptureModulePipeWire::ProcessBuffers() {
h = static_cast<struct spa_meta_header*>(
spa_buffer_find_meta_data(buffer->buffer, SPA_META_Header, sizeof(*h)));
+ struct spa_meta_videotransform* videotransform;
+ videotransform =
+ static_cast<struct spa_meta_videotransform*>(spa_buffer_find_meta_data(
+ buffer->buffer, SPA_META_VideoTransform, sizeof(*videotransform)));
+ if (videotransform) {
+ VideoRotation rotation =
+ VideorotationFromPipeWireTransform(videotransform->transform);
+ SetCaptureRotation(rotation);
+ SetApplyRotation(rotation != kVideoRotation_0);
+ }
+
if (h->flags & SPA_META_HEADER_FLAG_CORRUPTED) {
RTC_LOG(LS_INFO) << "Dropping corruped frame.";
} else {

Просмотреть файл

@ -1,71 +1,56 @@
From: Robert Mader <robert.mader@posteo.de>
Date: Wed, 6 Sep 2023 16:37:00 +0000
Subject: Bug 1843786 - webrtc: Implement Pipewire camera rotation support,
r=webrtc-reviewers,pehrsons,@webrtc-reviewers
From: Michael Froman <mfroman@mozilla.com>
Date: Thu, 28 Sep 2023 14:12:00 +0000
Subject: Bug 1832465 - remove libXtst usage from libwebrtc.
r=ng,webrtc-reviewers
Support the Pipewire videotransform meta via the already existing shared
infrastructure. This is needed for mobile devices which often have a 90
degree rotated camera - which is likely the reason there is already
support in the shared code paths.
Upstream commit: dc4c019c62abefc09e4903abea44bc36f3427452
Differential Revision: https://phabricator.services.mozilla.com/D183652
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/1db7a958b945838c64dcfcb638f79b99f729b364
Differential Revision: https://phabricator.services.mozilla.com/D189386
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/0ec1b33b95dbb2d39355f28b2812fe25b4ad9f20
---
.../linux/video_capture_pipewire.cc | 28 +++++++++++++++++++
1 file changed, 28 insertions(+)
modules/desktop_capture/BUILD.gn | 3 +++
modules/desktop_capture/linux/x11/shared_x_display.cc | 4 ++++
2 files changed, 7 insertions(+)
diff --git a/modules/video_capture/linux/video_capture_pipewire.cc b/modules/video_capture/linux/video_capture_pipewire.cc
index 46cfe9bc15..7b79f15a6c 100644
--- a/modules/video_capture/linux/video_capture_pipewire.cc
+++ b/modules/video_capture/linux/video_capture_pipewire.cc
@@ -301,6 +301,10 @@ void VideoCaptureModulePipeWire::OnFormatChanged(const struct spa_pod* format) {
&builder, SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta, SPA_PARAM_META_type,
SPA_POD_Id(SPA_META_Header), SPA_PARAM_META_size,
SPA_POD_Int(sizeof(struct spa_meta_header)))));
+ params.push_back(reinterpret_cast<spa_pod*>(spa_pod_builder_add_object(
+ &builder, SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta, SPA_PARAM_META_type,
+ SPA_POD_Id(SPA_META_VideoTransform), SPA_PARAM_META_size,
+ SPA_POD_Int(sizeof(struct spa_meta_videotransform)))));
pw_stream_update_params(stream_, params.data(), params.size());
}
@@ -341,6 +345,19 @@ void VideoCaptureModulePipeWire::OnStreamProcess(void* data) {
that->ProcessBuffers();
}
+static VideoRotation VideorotationFromPipeWireTransform(uint32_t transform) {
+ switch (transform) {
+ case SPA_META_TRANSFORMATION_90:
+ return kVideoRotation_90;
+ case SPA_META_TRANSFORMATION_180:
+ return kVideoRotation_180;
+ case SPA_META_TRANSFORMATION_270:
+ return kVideoRotation_270;
+ default:
+ return kVideoRotation_0;
+ }
+}
+
void VideoCaptureModulePipeWire::ProcessBuffers() {
RTC_CHECK_RUNS_SERIALIZED(&capture_checker_);
@@ -349,6 +366,17 @@ void VideoCaptureModulePipeWire::ProcessBuffers() {
h = static_cast<struct spa_meta_header*>(
spa_buffer_find_meta_data(buffer->buffer, SPA_META_Header, sizeof(*h)));
+ struct spa_meta_videotransform* videotransform;
+ videotransform =
+ static_cast<struct spa_meta_videotransform*>(spa_buffer_find_meta_data(
+ buffer->buffer, SPA_META_VideoTransform, sizeof(*videotransform)));
+ if (videotransform) {
+ VideoRotation rotation =
+ VideorotationFromPipeWireTransform(videotransform->transform);
+ SetCaptureRotation(rotation);
+ SetApplyRotation(rotation != kVideoRotation_0);
diff --git a/modules/desktop_capture/BUILD.gn b/modules/desktop_capture/BUILD.gn
index dcc1b3c6ac..0634e0e9c4 100644
--- a/modules/desktop_capture/BUILD.gn
+++ b/modules/desktop_capture/BUILD.gn
@@ -384,6 +384,9 @@ rtc_library("desktop_capture") {
"Xrandr",
"Xtst",
]
+ if (build_with_mozilla) {
+ libs -= [ "Xtst" ]
+ }
+
if (h->flags & SPA_META_HEADER_FLAG_CORRUPTED) {
RTC_LOG(LS_INFO) << "Dropping corruped frame.";
} else {
}
if (!is_win && !is_mac && !rtc_use_x11_extensions && !rtc_use_pipewire &&
diff --git a/modules/desktop_capture/linux/x11/shared_x_display.cc b/modules/desktop_capture/linux/x11/shared_x_display.cc
index d690b0e2ba..3f3617b074 100644
--- a/modules/desktop_capture/linux/x11/shared_x_display.cc
+++ b/modules/desktop_capture/linux/x11/shared_x_display.cc
@@ -11,7 +11,9 @@
#include "modules/desktop_capture/linux/x11/shared_x_display.h"
#include <X11/Xlib.h>
+#if !defined(WEBRTC_MOZILLA_BUILD)
#include <X11/extensions/XTest.h>
+#endif
#include <algorithm>
@@ -95,6 +97,7 @@ void SharedXDisplay::ProcessPendingXEvents() {
}
void SharedXDisplay::IgnoreXServerGrabs() {
+#if !defined(WEBRTC_MOZILLA_BUILD)
int test_event_base = 0;
int test_error_base = 0;
int major = 0;
@@ -103,6 +106,7 @@ void SharedXDisplay::IgnoreXServerGrabs() {
&minor)) {
XTestGrabControl(display(), true);
}
+#endif
}
} // namespace webrtc

Просмотреть файл

@ -1,56 +1,91 @@
From: Michael Froman <mfroman@mozilla.com>
Date: Thu, 28 Sep 2023 14:12:00 +0000
Subject: Bug 1832465 - remove libXtst usage from libwebrtc.
r=ng,webrtc-reviewers
From: Dan Baker <dbaker@mozilla.com>
Date: Mon, 2 Oct 2023 17:17:00 +0000
Subject: Bug 1851693 - (fix-279a05475d) Revert addition of race checker which
is causing tsan failurs until better fix is landed upstream.r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D189386
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/0ec1b33b95dbb2d39355f28b2812fe25b4ad9f20
This merely reverses a race checker that is too strict for our use, maintaining the code we had before, so we can fix upstream in the meantime tracked with Bug 1856392.
Differential Revision: https://phabricator.services.mozilla.com/D189396
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/e626ce7279e6575e68d0e43de3dfd3ed59b00a75
---
modules/desktop_capture/BUILD.gn | 3 +++
modules/desktop_capture/linux/x11/shared_x_display.cc | 4 ++++
2 files changed, 7 insertions(+)
modules/video_capture/linux/video_capture_v4l2.cc | 7 -------
modules/video_capture/linux/video_capture_v4l2.h | 7 +++----
2 files changed, 3 insertions(+), 11 deletions(-)
diff --git a/modules/desktop_capture/BUILD.gn b/modules/desktop_capture/BUILD.gn
index dcc1b3c6ac..0634e0e9c4 100644
--- a/modules/desktop_capture/BUILD.gn
+++ b/modules/desktop_capture/BUILD.gn
@@ -384,6 +384,9 @@ rtc_library("desktop_capture") {
"Xrandr",
"Xtst",
]
+ if (build_with_mozilla) {
+ libs -= [ "Xtst" ]
+ }
diff --git a/modules/video_capture/linux/video_capture_v4l2.cc b/modules/video_capture/linux/video_capture_v4l2.cc
index d6813b13fd..c887683dc8 100644
--- a/modules/video_capture/linux/video_capture_v4l2.cc
+++ b/modules/video_capture/linux/video_capture_v4l2.cc
@@ -110,7 +110,6 @@ int32_t VideoCaptureModuleV4L2::Init(const char* deviceUniqueIdUTF8) {
VideoCaptureModuleV4L2::~VideoCaptureModuleV4L2() {
RTC_DCHECK_RUN_ON(&api_checker_);
- RTC_CHECK_RUNS_SERIALIZED(&capture_checker_);
StopCapture();
if (_deviceFd != -1)
@@ -120,7 +119,6 @@ VideoCaptureModuleV4L2::~VideoCaptureModuleV4L2() {
int32_t VideoCaptureModuleV4L2::StartCapture(
const VideoCaptureCapability& capability) {
RTC_DCHECK_RUN_ON(&api_checker_);
- RTC_CHECK_RUNS_SERIALIZED(&capture_checker_);
if (_captureStarted) {
if (capability == _requestedCapability) {
@@ -318,7 +316,6 @@ int32_t VideoCaptureModuleV4L2::StopCapture() {
_captureThread.Finalize();
}
if (!is_win && !is_mac && !rtc_use_x11_extensions && !rtc_use_pipewire &&
diff --git a/modules/desktop_capture/linux/x11/shared_x_display.cc b/modules/desktop_capture/linux/x11/shared_x_display.cc
index d690b0e2ba..3f3617b074 100644
--- a/modules/desktop_capture/linux/x11/shared_x_display.cc
+++ b/modules/desktop_capture/linux/x11/shared_x_display.cc
@@ -11,7 +11,9 @@
#include "modules/desktop_capture/linux/x11/shared_x_display.h"
- RTC_CHECK_RUNS_SERIALIZED(&capture_checker_);
MutexLock lock(&capture_lock_);
if (_captureStarted) {
_captureStarted = false;
@@ -336,7 +333,6 @@ int32_t VideoCaptureModuleV4L2::StopCapture() {
// critical section protected by the caller
#include <X11/Xlib.h>
+#if !defined(WEBRTC_MOZILLA_BUILD)
#include <X11/extensions/XTest.h>
+#endif
bool VideoCaptureModuleV4L2::AllocateVideoBuffers() {
- RTC_CHECK_RUNS_SERIALIZED(&capture_checker_);
struct v4l2_requestbuffers rbuffer;
memset(&rbuffer, 0, sizeof(v4l2_requestbuffers));
#include <algorithm>
@@ -95,6 +97,7 @@ void SharedXDisplay::ProcessPendingXEvents() {
@@ -387,7 +383,6 @@ bool VideoCaptureModuleV4L2::AllocateVideoBuffers() {
}
void SharedXDisplay::IgnoreXServerGrabs() {
+#if !defined(WEBRTC_MOZILLA_BUILD)
int test_event_base = 0;
int test_error_base = 0;
int major = 0;
@@ -103,6 +106,7 @@ void SharedXDisplay::IgnoreXServerGrabs() {
&minor)) {
XTestGrabControl(display(), true);
}
+#endif
bool VideoCaptureModuleV4L2::DeAllocateVideoBuffers() {
- RTC_CHECK_RUNS_SERIALIZED(&capture_checker_);
// unmap buffers
for (int i = 0; i < _buffersAllocatedByDevice; i++)
munmap(_pool[i].start, _pool[i].length);
@@ -405,12 +400,10 @@ bool VideoCaptureModuleV4L2::DeAllocateVideoBuffers() {
}
} // namespace webrtc
bool VideoCaptureModuleV4L2::CaptureStarted() {
- RTC_CHECK_RUNS_SERIALIZED(&capture_checker_);
return _captureStarted;
}
bool VideoCaptureModuleV4L2::CaptureProcess() {
- RTC_CHECK_RUNS_SERIALIZED(&capture_checker_);
int retVal = 0;
struct pollfd rSet;
diff --git a/modules/video_capture/linux/video_capture_v4l2.h b/modules/video_capture/linux/video_capture_v4l2.h
index 0191e41876..61358d0325 100644
--- a/modules/video_capture/linux/video_capture_v4l2.h
+++ b/modules/video_capture/linux/video_capture_v4l2.h
@@ -45,12 +45,11 @@ class VideoCaptureModuleV4L2 : public VideoCaptureImpl {
Mutex capture_lock_ RTC_ACQUIRED_BEFORE(api_lock_);
bool quit_ RTC_GUARDED_BY(capture_lock_);
int32_t _deviceId RTC_GUARDED_BY(api_checker_);
- int32_t _deviceFd RTC_GUARDED_BY(capture_checker_);
+ int32_t _deviceFd;
int32_t _buffersAllocatedByDevice RTC_GUARDED_BY(capture_lock_);
- VideoCaptureCapability configured_capability_
- RTC_GUARDED_BY(capture_checker_);
- bool _captureStarted RTC_GUARDED_BY(capture_checker_);
+ VideoCaptureCapability configured_capability_;
+ bool _captureStarted;
struct Buffer {
void* start;
size_t length;

Просмотреть файл

@ -1,91 +1,30 @@
From: Dan Baker <dbaker@mozilla.com>
Date: Mon, 2 Oct 2023 17:17:00 +0000
Subject: Bug 1851693 - (fix-279a05475d) Revert addition of race checker which
is causing tsan failurs until better fix is landed upstream.r=pehrsons
From: Michael Froman <mfroman@mozilla.com>
Date: Thu, 5 Oct 2023 14:21:00 +0000
Subject: Bug 1857037 - pt1 - add shim gni files to limit BUILD.gn changes.
r=ng,webrtc-reviewers
This merely reverses a race checker that is too strict for our use, maintaining the code we had before, so we can fix upstream in the meantime tracked with Bug 1856392.
Differential Revision: https://phabricator.services.mozilla.com/D189396
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/e626ce7279e6575e68d0e43de3dfd3ed59b00a75
Differential Revision: https://phabricator.services.mozilla.com/D190104
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/a84d39db037cbe34aa19588b0d18335eb5e2d79b
---
modules/video_capture/linux/video_capture_v4l2.cc | 7 -------
modules/video_capture/linux/video_capture_v4l2.h | 7 +++----
2 files changed, 3 insertions(+), 11 deletions(-)
testing/libfuzzer/fuzzer_test.gni | 2 ++
testing/test.gni | 2 ++
2 files changed, 4 insertions(+)
create mode 100644 testing/libfuzzer/fuzzer_test.gni
create mode 100644 testing/test.gni
diff --git a/modules/video_capture/linux/video_capture_v4l2.cc b/modules/video_capture/linux/video_capture_v4l2.cc
index d6813b13fd..c887683dc8 100644
--- a/modules/video_capture/linux/video_capture_v4l2.cc
+++ b/modules/video_capture/linux/video_capture_v4l2.cc
@@ -110,7 +110,6 @@ int32_t VideoCaptureModuleV4L2::Init(const char* deviceUniqueIdUTF8) {
VideoCaptureModuleV4L2::~VideoCaptureModuleV4L2() {
RTC_DCHECK_RUN_ON(&api_checker_);
- RTC_CHECK_RUNS_SERIALIZED(&capture_checker_);
StopCapture();
if (_deviceFd != -1)
@@ -120,7 +119,6 @@ VideoCaptureModuleV4L2::~VideoCaptureModuleV4L2() {
int32_t VideoCaptureModuleV4L2::StartCapture(
const VideoCaptureCapability& capability) {
RTC_DCHECK_RUN_ON(&api_checker_);
- RTC_CHECK_RUNS_SERIALIZED(&capture_checker_);
if (_captureStarted) {
if (capability == _requestedCapability) {
@@ -318,7 +316,6 @@ int32_t VideoCaptureModuleV4L2::StopCapture() {
_captureThread.Finalize();
}
- RTC_CHECK_RUNS_SERIALIZED(&capture_checker_);
MutexLock lock(&capture_lock_);
if (_captureStarted) {
_captureStarted = false;
@@ -336,7 +333,6 @@ int32_t VideoCaptureModuleV4L2::StopCapture() {
// critical section protected by the caller
bool VideoCaptureModuleV4L2::AllocateVideoBuffers() {
- RTC_CHECK_RUNS_SERIALIZED(&capture_checker_);
struct v4l2_requestbuffers rbuffer;
memset(&rbuffer, 0, sizeof(v4l2_requestbuffers));
@@ -387,7 +383,6 @@ bool VideoCaptureModuleV4L2::AllocateVideoBuffers() {
}
bool VideoCaptureModuleV4L2::DeAllocateVideoBuffers() {
- RTC_CHECK_RUNS_SERIALIZED(&capture_checker_);
// unmap buffers
for (int i = 0; i < _buffersAllocatedByDevice; i++)
munmap(_pool[i].start, _pool[i].length);
@@ -405,12 +400,10 @@ bool VideoCaptureModuleV4L2::DeAllocateVideoBuffers() {
}
bool VideoCaptureModuleV4L2::CaptureStarted() {
- RTC_CHECK_RUNS_SERIALIZED(&capture_checker_);
return _captureStarted;
}
bool VideoCaptureModuleV4L2::CaptureProcess() {
- RTC_CHECK_RUNS_SERIALIZED(&capture_checker_);
int retVal = 0;
struct pollfd rSet;
diff --git a/modules/video_capture/linux/video_capture_v4l2.h b/modules/video_capture/linux/video_capture_v4l2.h
index 0191e41876..61358d0325 100644
--- a/modules/video_capture/linux/video_capture_v4l2.h
+++ b/modules/video_capture/linux/video_capture_v4l2.h
@@ -45,12 +45,11 @@ class VideoCaptureModuleV4L2 : public VideoCaptureImpl {
Mutex capture_lock_ RTC_ACQUIRED_BEFORE(api_lock_);
bool quit_ RTC_GUARDED_BY(capture_lock_);
int32_t _deviceId RTC_GUARDED_BY(api_checker_);
- int32_t _deviceFd RTC_GUARDED_BY(capture_checker_);
+ int32_t _deviceFd;
int32_t _buffersAllocatedByDevice RTC_GUARDED_BY(capture_lock_);
- VideoCaptureCapability configured_capability_
- RTC_GUARDED_BY(capture_checker_);
- bool _captureStarted RTC_GUARDED_BY(capture_checker_);
+ VideoCaptureCapability configured_capability_;
+ bool _captureStarted;
struct Buffer {
void* start;
size_t length;
diff --git a/testing/libfuzzer/fuzzer_test.gni b/testing/libfuzzer/fuzzer_test.gni
new file mode 100644
index 0000000000..8fdf3cdad2
--- /dev/null
+++ b/testing/libfuzzer/fuzzer_test.gni
@@ -0,0 +1,2 @@
+# "empty" file in place of importing new testing/libfuzzer
+# to allow BUILD.gn imports to succeed.
diff --git a/testing/test.gni b/testing/test.gni
new file mode 100644
index 0000000000..f46fa82778
--- /dev/null
+++ b/testing/test.gni
@@ -0,0 +1,2 @@
+# "empty" file in place of importing new testing/test.gni
+# to allow BUILD.gn imports to succeed.

Просмотреть файл

@ -1,30 +1,40 @@
From: Michael Froman <mfroman@mozilla.com>
Date: Thu, 5 Oct 2023 14:21:00 +0000
Subject: Bug 1857037 - pt1 - add shim gni files to limit BUILD.gn changes.
r=ng,webrtc-reviewers
Date: Tue, 14 Feb 2023 03:27:00 +0000
Subject: Bug 1816173 - pt12 - add shim config for
third_party/libwebrtc/testing/{gmock|gtest} r=ng
Differential Revision: https://phabricator.services.mozilla.com/D190104
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/a84d39db037cbe34aa19588b0d18335eb5e2d79b
We don't vendor third_party/libwebrtc/third_party/gmock
third_party/libwebrtc/third_party/gtest, so:
- add BUILD.gn to avoid scattered BUILD.gn changes
Differential Revision: https://phabricator.services.mozilla.com/D169674
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/4ea9d2db79c42a144235e45c47c71adf1dd01fdc
---
testing/libfuzzer/fuzzer_test.gni | 2 ++
testing/test.gni | 2 ++
2 files changed, 4 insertions(+)
create mode 100644 testing/libfuzzer/fuzzer_test.gni
create mode 100644 testing/test.gni
testing/gmock/BUILD.gn | 5 +++++
testing/gtest/BUILD.gn | 5 +++++
2 files changed, 10 insertions(+)
create mode 100644 testing/gmock/BUILD.gn
create mode 100644 testing/gtest/BUILD.gn
diff --git a/testing/libfuzzer/fuzzer_test.gni b/testing/libfuzzer/fuzzer_test.gni
diff --git a/testing/gmock/BUILD.gn b/testing/gmock/BUILD.gn
new file mode 100644
index 0000000000..8fdf3cdad2
index 0000000000..a2a1efdea9
--- /dev/null
+++ b/testing/libfuzzer/fuzzer_test.gni
@@ -0,0 +1,2 @@
+# "empty" file in place of importing new testing/libfuzzer
+# to allow BUILD.gn imports to succeed.
diff --git a/testing/test.gni b/testing/test.gni
+++ b/testing/gmock/BUILD.gn
@@ -0,0 +1,5 @@
+import("//third_party/libaom/options.gni")
+import("../../webrtc.gni")
+
+rtc_library("gmock") {
+}
diff --git a/testing/gtest/BUILD.gn b/testing/gtest/BUILD.gn
new file mode 100644
index 0000000000..f46fa82778
index 0000000000..c9c2703c37
--- /dev/null
+++ b/testing/test.gni
@@ -0,0 +1,2 @@
+# "empty" file in place of importing new testing/test.gni
+# to allow BUILD.gn imports to succeed.
+++ b/testing/gtest/BUILD.gn
@@ -0,0 +1,5 @@
+import("//third_party/libaom/options.gni")
+import("../../webrtc.gni")
+
+rtc_library("gtest") {
+}

Просмотреть файл

@ -1,40 +1,28 @@
From: Michael Froman <mfroman@mozilla.com>
Date: Tue, 14 Feb 2023 03:27:00 +0000
Subject: Bug 1816173 - pt12 - add shim config for
third_party/libwebrtc/testing/{gmock|gtest} r=ng
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Wed, 18 Oct 2023 17:25:00 +0000
Subject: Bug 1857862 - (fix-32a8169a65) Don't call non-constexpr
RTC_CHECK_NOTREACHED from constexpr VideoFrameTypeToString under gcc-8.
r=webrtc-reviewers,mjf
We don't vendor third_party/libwebrtc/third_party/gmock
third_party/libwebrtc/third_party/gtest, so:
- add BUILD.gn to avoid scattered BUILD.gn changes
Differential Revision: https://phabricator.services.mozilla.com/D169674
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/4ea9d2db79c42a144235e45c47c71adf1dd01fdc
Differential Revision: https://phabricator.services.mozilla.com/D191308
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/8a4449ba24fa3192b44863ed8ba96f6f94a6e88d
---
testing/gmock/BUILD.gn | 5 +++++
testing/gtest/BUILD.gn | 5 +++++
2 files changed, 10 insertions(+)
create mode 100644 testing/gmock/BUILD.gn
create mode 100644 testing/gtest/BUILD.gn
api/video/video_frame_type.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/testing/gmock/BUILD.gn b/testing/gmock/BUILD.gn
new file mode 100644
index 0000000000..a2a1efdea9
--- /dev/null
+++ b/testing/gmock/BUILD.gn
@@ -0,0 +1,5 @@
+import("//third_party/libaom/options.gni")
+import("../../webrtc.gni")
+
+rtc_library("gmock") {
+}
diff --git a/testing/gtest/BUILD.gn b/testing/gtest/BUILD.gn
new file mode 100644
index 0000000000..c9c2703c37
--- /dev/null
+++ b/testing/gtest/BUILD.gn
@@ -0,0 +1,5 @@
+import("//third_party/libaom/options.gni")
+import("../../webrtc.gni")
+
+rtc_library("gtest") {
+}
diff --git a/api/video/video_frame_type.h b/api/video/video_frame_type.h
index 9079829ff8..3665a80cd8 100644
--- a/api/video/video_frame_type.h
+++ b/api/video/video_frame_type.h
@@ -34,7 +34,11 @@ inline constexpr absl::string_view VideoFrameTypeToString(
case VideoFrameType::kVideoFrameDelta:
return "delta";
}
+// Mozilla:
+// gcc-8 complains about a constexpr function calling a non-constexpr ditto.
+#if defined(__clang__) || (defined(__GNUC__) && __GNUC__ >= 9)
RTC_CHECK_NOTREACHED();
+#endif
return "";
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше