commit 01c0500d3a933ee96b06d05649f6ed4f0819c97f
parent 421f45990dc339b3c92565d2ec408a604d5884ce
Author: Dan Baker <dbaker@mozilla.com>
Date: Wed, 19 Nov 2025 18:16:18 -0700
Bug 2000941 - Vendor libwebrtc from 5b634ccedc
Essentially a no-op since we're going to see this change
reverted when we vendor in db0e64c5e8.
Upstream commit: https://webrtc.googlesource.com/src/+/5b634ccedca5ab7969edc68fca15d327aa0440d3
Remove use of global clocks in TestClient
The functions that are relevant here can be abstracted away with
WaitUntil, which is available since this is a test-only target. This
may be updated once the ClockVariant is simplified to relevant clocks
for testing.
Bug: webrtc:42223992
Change-Id: I68a0514be56931e44777f4cd086f5ea794da377a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/407405
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Auto-Submit: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#45529}
Diffstat:
5 files changed, 355 insertions(+), 382 deletions(-)
diff --git a/third_party/libwebrtc/README.mozilla.last-vendor b/third_party/libwebrtc/README.mozilla.last-vendor
@@ -1,4 +1,4 @@
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
-libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-11-20T00:55:28.135414+00:00.
+libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-11-20T01:16:05.397090+00:00.
# base of lastest vendoring
-3f6f3decfc
+5b634ccedc
diff --git a/third_party/libwebrtc/moz-patch-stack/db0e64c5e8.no-op-cherry-pick-msg b/third_party/libwebrtc/moz-patch-stack/db0e64c5e8.no-op-cherry-pick-msg
@@ -0,0 +1 @@
+We already cherry-picked this when we vendored 5b634ccedc.
diff --git a/third_party/libwebrtc/moz-patch-stack/p0001.patch b/third_party/libwebrtc/moz-patch-stack/p0001.patch
@@ -1,61 +1,303 @@
-From: =?UTF-8?q?Henrik=20Bostr=C3=B6m?= <hbos@webrtc.org>
-Date: Wed, 10 Sep 2025 12:47:04 +0200
-Subject: (cherry-pick-branch-heads/7390) [M141] Do not hide inbound-rtp if
- media is received.
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
+From: Daniel Baker <dbaker@mozilla.com>
+Date: Wed, 19 Nov 2025 17:59:49 -0700
+Subject: (tmp-cherry-pick) Revert "Remove use of global clocks in TestClient"
+ (db0e64c5e8)
-This condition neglected the fact that if Insertable Streams API is used
-we can have frames or samples despite packets never being received.
+This reverts commit 5b634ccedca5ab7969edc68fca15d327aa0440d3.
-This CL fixes this unintended regression.
+Reason for revert: Breaks downstream
-# Ignore unrelated compile issues on ios webrtc bots
-NOTRY=True
+Bug: webrtc:42223992
+Original change's description:
+> Remove use of global clocks in TestClient
+>
+> The functions that are relevant here can be abstracted away with
+> WaitUntil, which is available since this is a test-only target. This
+> may be updated once the ClockVariant is simplified to relevant clocks
+> for testing.
+>
+> Bug: webrtc:42223992
+> Change-Id: I68a0514be56931e44777f4cd086f5ea794da377a
+> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/407405
+> Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
+> Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
+> Auto-Submit: Evan Shrubsole <eshr@webrtc.org>
+> Cr-Commit-Position: refs/heads/main@{#45529}
-(cherry picked from commit c15949eda5a00122e2f3b5a643e15781049b9927)
-
-Bug: chromium:444048024, chromium:444384230
-Change-Id: Ie6e17a3bc96701476787f5898446f3f706715d15
-Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/408884
-Commit-Queue: Guido Urdaneta <guidou@webrtc.org>
-Reviewed-by: Guido Urdaneta <guidou@webrtc.org>
-Auto-Submit: Henrik Boström <hbos@webrtc.org>
-Commit-Queue: Henrik Boström <hbos@webrtc.org>
-Cr-Original-Commit-Position: refs/heads/main@{#45616}
-Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/409020
-Cr-Commit-Position: refs/branch-heads/7390@{#2}
-Cr-Branched-From: 2f553bf8d573c90176d51559b76dfc836996c8f5-refs/heads/main@{#45520}
+Bug: webrtc:42223992
+No-Presubmit: true
+No-Tree-Checks: true
+No-Try: true
+Change-Id: I6bc22c6d604536a3eb163dbef77b025ff2cd124a
+Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/407442
+Auto-Submit: Evan Shrubsole <eshr@webrtc.org>
+Reviewed-by: Harald Alvestrand <hta@webrtc.org>
+Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
+Commit-Queue: Harald Alvestrand <hta@webrtc.org>
+Cr-Commit-Position: refs/heads/main@{#45531}
---
- pc/rtc_stats_collector.cc | 10 ++++++++--
- 1 file changed, 8 insertions(+), 2 deletions(-)
+ p2p/test/stun_server_unittest.cc | 2 +-
+ rtc_base/BUILD.gn | 1 -
+ rtc_base/socket_unittest.cc | 6 ++--
+ rtc_base/test_client.cc | 58 +++++++++++++++++++++-----------
+ rtc_base/test_client.h | 18 +++++-----
+ 5 files changed, 51 insertions(+), 34 deletions(-)
-diff --git a/pc/rtc_stats_collector.cc b/pc/rtc_stats_collector.cc
-index 8686143e68..8d6cc22426 100644
---- a/pc/rtc_stats_collector.cc
-+++ b/pc/rtc_stats_collector.cc
-@@ -1754,7 +1754,10 @@ void RTCStatsCollector::ProduceAudioRTPStreamStats_n(
- if (!voice_receiver_info.connected()) {
- continue; // The SSRC is not known yet.
- }
-- if (spec_lifetime && voice_receiver_info.packets_received == 0) {
-+ // Check both packets received and samples received to handle the Insertable
-+ // Streams use case of receiving media without receiving packets.
-+ if (spec_lifetime && voice_receiver_info.packets_received == 0 &&
-+ voice_receiver_info.total_samples_received == 0) {
- // The SSRC is known despite not receiving any packets. This happens if
- // SSRC is signalled in the SDP which we should not rely on for getStats.
- continue;
-@@ -1868,7 +1871,10 @@ void RTCStatsCollector::ProduceVideoRTPStreamStats_n(
- if (!video_receiver_info.connected()) {
- continue; // The SSRC is not known yet.
- }
-- if (spec_lifetime && video_receiver_info.packets_received == 0) {
-+ // Check both packets received and frames received to handle the Insertable
-+ // Streams use case of receiving media without receiving packets.
-+ if (spec_lifetime && video_receiver_info.packets_received == 0 &&
-+ video_receiver_info.frames_received == 0) {
- // The SSRC is known despite not receiving any packets. This happens if
- // SSRC is signalled in the SDP which we should not rely on for getStats.
- continue;
+diff --git a/p2p/test/stun_server_unittest.cc b/p2p/test/stun_server_unittest.cc
+index 085fbc2a85..8baa8b7b37 100644
+--- a/p2p/test/stun_server_unittest.cc
++++ b/p2p/test/stun_server_unittest.cc
+@@ -54,7 +54,7 @@ class StunServerTest : public ::testing::Test {
+ StunMessage* Receive() {
+ StunMessage* msg = nullptr;
+ std::unique_ptr<TestClient::Packet> packet =
+- client_->NextPacket(TestClient::kTimeout);
++ client_->NextPacket(TestClient::kTimeoutMs);
+ if (packet) {
+ ByteBufferReader buf(packet->buf);
+ msg = new StunMessage();
+diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
+index 4ee00c8848..27cf292d16 100644
+--- a/rtc_base/BUILD.gn
++++ b/rtc_base/BUILD.gn
+@@ -1722,7 +1722,6 @@ rtc_library("testclient") {
+ ":timeutils",
+ "../api/units:time_delta",
+ "../api/units:timestamp",
+- "../test:wait_until",
+ "network:received_packet",
+ "synchronization:mutex",
+ "third_party/sigslot",
+diff --git a/rtc_base/socket_unittest.cc b/rtc_base/socket_unittest.cc
+index d258f3d7c7..90dd485544 100644
+--- a/rtc_base/socket_unittest.cc
++++ b/rtc_base/socket_unittest.cc
+@@ -1266,15 +1266,13 @@ void SocketTest::UdpSocketRecvTimestampUseRtcEpoch(const IPAddress& loopback) {
+
+ SocketAddress addr2;
+ client2->SendTo("foo", 3, address);
+- std::unique_ptr<TestClient::Packet> packet_1 =
+- client1->NextPacket(TimeDelta::Seconds(10));
++ std::unique_ptr<TestClient::Packet> packet_1 = client1->NextPacket(10000);
+ ASSERT_TRUE(packet_1 != nullptr);
+ EXPECT_NEAR(packet_1->packet_time->us(), TimeMicros(), 1000'000);
+
+ Thread::SleepMs(100);
+ client2->SendTo("bar", 3, address);
+- std::unique_ptr<TestClient::Packet> packet_2 =
+- client1->NextPacket(TimeDelta::Seconds(10));
++ std::unique_ptr<TestClient::Packet> packet_2 = client1->NextPacket(10000);
+ ASSERT_TRUE(packet_2 != nullptr);
+ EXPECT_GT(packet_2->packet_time->us(), packet_1->packet_time->us());
+ EXPECT_NEAR(packet_2->packet_time->us(), TimeMicros(), 1000'000);
+diff --git a/rtc_base/test_client.cc b/rtc_base/test_client.cc
+index ff28deaa6a..a7577d54bd 100644
+--- a/rtc_base/test_client.cc
++++ b/rtc_base/test_client.cc
+@@ -10,20 +10,22 @@
+
+ #include "rtc_base/test_client.h"
+
++#include <cstdint>
+ #include <cstring>
+ #include <memory>
+ #include <optional>
+ #include <utility>
+-#include <variant>
+
+ #include "api/units/time_delta.h"
+ #include "api/units/timestamp.h"
+ #include "rtc_base/async_packet_socket.h"
++#include "rtc_base/fake_clock.h"
+ #include "rtc_base/network/received_packet.h"
+ #include "rtc_base/socket.h"
+ #include "rtc_base/socket_address.h"
+ #include "rtc_base/synchronization/mutex.h"
+-#include "test/wait_until.h"
++#include "rtc_base/thread.h"
++#include "rtc_base/time_utils.h"
+
+ namespace webrtc {
+
+@@ -32,11 +34,11 @@ namespace webrtc {
+ // NextPacket.
+
+ TestClient::TestClient(std::unique_ptr<AsyncPacketSocket> socket)
+- : TestClient(std::move(socket), std::monostate()) {}
++ : TestClient(std::move(socket), nullptr) {}
+
+ TestClient::TestClient(std::unique_ptr<AsyncPacketSocket> socket,
+- ClockVariant clock)
+- : clock_(clock), socket_(std::move(socket)) {
++ ThreadProcessingFakeClock* fake_clock)
++ : fake_clock_(fake_clock), socket_(std::move(socket)) {
+ socket_->RegisterReceivedPacketCallback(
+ [&](AsyncPacketSocket* socket, const ReceivedIpPacket& packet) {
+ OnPacket(socket, packet);
+@@ -48,8 +50,11 @@ TestClient::~TestClient() {}
+
+ bool TestClient::CheckConnState(AsyncPacketSocket::State state) {
+ // Wait for our timeout value until the socket reaches the desired state.
+- return WaitUntil([&]() { return socket_->GetState() == state; },
+- {.clock = clock_});
++ int64_t end = TimeAfter(kTimeoutMs);
++ while (socket_->GetState() != state && TimeUntil(end) > 0) {
++ AdvanceTime(1);
++ }
++ return (socket_->GetState() == state);
+ }
+
+ int TestClient::Send(const char* buf, size_t size) {
+@@ -64,7 +69,7 @@ int TestClient::SendTo(const char* buf,
+ return socket_->SendTo(buf, size, dest, options);
+ }
+
+-std::unique_ptr<TestClient::Packet> TestClient::NextPacket(TimeDelta timeout) {
++std::unique_ptr<TestClient::Packet> TestClient::NextPacket(int timeout_ms) {
+ // If no packets are currently available, we go into a get/dispatch loop for
+ // at most timeout_ms. If, during the loop, a packet arrives, then we can
+ // stop early and return it.
+@@ -76,20 +81,21 @@ std::unique_ptr<TestClient::Packet> TestClient::NextPacket(TimeDelta timeout) {
+ // Pumping another thread's queue could lead to messages being dispatched from
+ // the wrong thread to non-thread-safe objects.
+
+- bool packets_available = WaitUntil(
+- [&] {
+- MutexLock lock(&mutex_);
+- return !packets_.empty();
+- },
+- {
+- .timeout = timeout,
+- .clock = clock_,
+- });
++ int64_t end = TimeAfter(timeout_ms);
++ while (TimeUntil(end) > 0) {
++ {
++ MutexLock lock(&mutex_);
++ if (!packets_.empty()) {
++ break;
++ }
++ }
++ AdvanceTime(1);
++ }
+
+ // Return the first packet placed in the queue.
+ std::unique_ptr<Packet> packet;
+ MutexLock lock(&mutex_);
+- if (packets_available) {
++ if (!packets_.empty()) {
+ packet = std::move(packets_.front());
+ packets_.erase(packets_.begin());
+ }
+@@ -101,7 +107,7 @@ bool TestClient::CheckNextPacket(const char* buf,
+ size_t size,
+ SocketAddress* addr) {
+ bool res = false;
+- std::unique_ptr<Packet> packet = NextPacket(kTimeout);
++ std::unique_ptr<Packet> packet = NextPacket(kTimeoutMs);
+ if (packet) {
+ res = (packet->buf.size() == size &&
+ memcmp(packet->buf.data(), buf, size) == 0 &&
+@@ -126,8 +132,20 @@ bool TestClient::CheckTimestamp(std::optional<Timestamp> packet_timestamp) {
+ return res;
+ }
+
++void TestClient::AdvanceTime(int ms) {
++ // If the test is using a fake clock, we must advance the fake clock to
++ // advance time. Otherwise, ProcessMessages will work.
++ if (fake_clock_) {
++ for (int64_t start = TimeMillis(); TimeMillis() < start + ms;) {
++ fake_clock_->AdvanceTime(TimeDelta::Millis(1));
++ };
++ } else {
++ Thread::Current()->ProcessMessages(1);
++ }
++}
++
+ bool TestClient::CheckNoPacket() {
+- return NextPacket(kNoPacketTimeout) == nullptr;
++ return NextPacket(kNoPacketTimeoutMs) == nullptr;
+ }
+
+ int TestClient::GetError() {
+diff --git a/rtc_base/test_client.h b/rtc_base/test_client.h
+index 7a7d77106b..355f578711 100644
+--- a/rtc_base/test_client.h
++++ b/rtc_base/test_client.h
+@@ -16,16 +16,15 @@
+ #include <optional>
+ #include <vector>
+
+-#include "api/units/time_delta.h"
+ #include "api/units/timestamp.h"
+ #include "rtc_base/async_packet_socket.h"
+ #include "rtc_base/buffer.h"
++#include "rtc_base/fake_clock.h"
+ #include "rtc_base/network/received_packet.h"
+ #include "rtc_base/socket.h"
+ #include "rtc_base/socket_address.h"
+ #include "rtc_base/synchronization/mutex.h"
+ #include "rtc_base/third_party/sigslot/sigslot.h"
+-#include "test/wait_until.h"
+
+ namespace webrtc {
+
+@@ -44,7 +43,7 @@ class TestClient : public sigslot::has_slots<> {
+ };
+
+ // Default timeout for NextPacket reads.
+- static constexpr TimeDelta kTimeout = TimeDelta::Seconds(5);
++ static const int kTimeoutMs = 5000;
+
+ // Creates a client that will send and receive with the given socket and
+ // will post itself messages with the given thread.
+@@ -52,7 +51,8 @@ class TestClient : public sigslot::has_slots<> {
+ // Create a test client that will use a fake clock. NextPacket needs to wait
+ // for a packet to be received, and thus it needs to advance the fake clock
+ // if the test is using one, rather than just sleeping.
+- TestClient(std::unique_ptr<AsyncPacketSocket> socket, ClockVariant clock);
++ TestClient(std::unique_ptr<AsyncPacketSocket> socket,
++ ThreadProcessingFakeClock* fake_clock);
+ ~TestClient() override;
+
+ TestClient(const TestClient&) = delete;
+@@ -77,11 +77,11 @@ class TestClient : public sigslot::has_slots<> {
+
+ // Returns the next packet received by the client or null if none is received
+ // within the specified timeout.
+- std::unique_ptr<Packet> NextPacket(TimeDelta timeout);
++ std::unique_ptr<Packet> NextPacket(int timeout_ms);
+
+ // Checks that the next packet has the given contents. Returns the remote
+ // address that the packet was sent from.
+- bool CheckNextPacket(const char* buf, size_t size, SocketAddress* addr);
++ bool CheckNextPacket(const char* buf, size_t len, SocketAddress* addr);
+
+ // Checks that no packets have arrived or will arrive in the next second.
+ bool CheckNoPacket();
+@@ -96,7 +96,7 @@ class TestClient : public sigslot::has_slots<> {
+
+ private:
+ // Timeout for reads when no packet is expected.
+- static constexpr TimeDelta kNoPacketTimeout = TimeDelta::Seconds(1);
++ static const int kNoPacketTimeoutMs = 1000;
+ // Workaround for the fact that AsyncPacketSocket::GetConnState doesn't exist.
+ Socket::ConnState GetState();
+
+@@ -104,8 +104,9 @@ class TestClient : public sigslot::has_slots<> {
+ const ReceivedIpPacket& received_packet);
+ void OnReadyToSend(AsyncPacketSocket* socket);
+ bool CheckTimestamp(std::optional<Timestamp> packet_timestamp);
++ void AdvanceTime(int ms);
+
+- ClockVariant clock_;
++ ThreadProcessingFakeClock* fake_clock_ = nullptr;
+ Mutex mutex_;
+ std::unique_ptr<AsyncPacketSocket> socket_;
+ std::vector<std::unique_ptr<Packet>> packets_;
+@@ -115,4 +116,5 @@ class TestClient : public sigslot::has_slots<> {
+
+ } // namespace webrtc
+
++
+ #endif // RTC_BASE_TEST_CLIENT_H_
diff --git a/third_party/libwebrtc/moz-patch-stack/p0002.patch b/third_party/libwebrtc/moz-patch-stack/p0002.patch
@@ -1,331 +1,61 @@
-From: Palak Agarwal <agpalak@google.com>
-Date: Tue, 7 Oct 2025 13:45:52 +0200
-Subject: (cherry-pick-branch-heads/7390) [M141] Add logging while creating
- {Window|Screen}Capturer
+From: =?UTF-8?q?Henrik=20Bostr=C3=B6m?= <hbos@webrtc.org>
+Date: Wed, 10 Sep 2025 12:47:04 +0200
+Subject: (cherry-pick-branch-heads/7390) [M141] Do not hide inbound-rtp if
+ media is received.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
-(cherry picked from commit 6908505ae0eba5d530ad0bb4b37d4654a4f36c95)
+This condition neglected the fact that if Insertable Streams API is used
+we can have frames or samples despite packets never being received.
-Fixed: chromium:450184498
-Bug: chromium:448881311
-Change-Id: I0f043f58bf831e6822451cac99a8972a054ffdf7
-Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/414800
-Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
-Reviewed-by: Harald Alvestrand <hta@webrtc.org>
-Commit-Queue: Palak Agarwal <agpalak@google.com>
-Cr-Original-Commit-Position: refs/heads/main@{#45856}
-Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/415420
-Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
-Cr-Commit-Position: refs/branch-heads/7390@{#3}
+This CL fixes this unintended regression.
+
+# Ignore unrelated compile issues on ios webrtc bots
+NOTRY=True
+
+(cherry picked from commit c15949eda5a00122e2f3b5a643e15781049b9927)
+
+Bug: chromium:444048024, chromium:444384230
+Change-Id: Ie6e17a3bc96701476787f5898446f3f706715d15
+Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/408884
+Commit-Queue: Guido Urdaneta <guidou@webrtc.org>
+Reviewed-by: Guido Urdaneta <guidou@webrtc.org>
+Auto-Submit: Henrik Boström <hbos@webrtc.org>
+Commit-Queue: Henrik Boström <hbos@webrtc.org>
+Cr-Original-Commit-Position: refs/heads/main@{#45616}
+Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/409020
+Cr-Commit-Position: refs/branch-heads/7390@{#2}
Cr-Branched-From: 2f553bf8d573c90176d51559b76dfc836996c8f5-refs/heads/main@{#45520}
---
- modules/desktop_capture/desktop_capturer.cc | 15 +++++++++++++++
- .../linux/x11/screen_capturer_x11.cc | 6 ++++++
- .../linux/x11/window_capturer_x11.cc | 4 ++++
- modules/desktop_capture/screen_capturer_darwin.mm | 7 +++++++
- .../desktop_capture/screen_capturer_fuchsia.cc | 3 +++
- modules/desktop_capture/screen_capturer_linux.cc | 4 ++++
- modules/desktop_capture/screen_capturer_null.cc | 4 ++++
- modules/desktop_capture/screen_capturer_win.cc | 6 ++++++
- modules/desktop_capture/window_capturer_linux.cc | 4 ++++
- modules/desktop_capture/window_capturer_mac.mm | 2 ++
- modules/desktop_capture/window_capturer_null.cc | 3 +++
- modules/desktop_capture/window_capturer_win.cc | 7 +++++++
- 12 files changed, 65 insertions(+)
+ pc/rtc_stats_collector.cc | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
-diff --git a/modules/desktop_capture/desktop_capturer.cc b/modules/desktop_capture/desktop_capturer.cc
-index ae9aba26ee..bf63f73178 100644
---- a/modules/desktop_capture/desktop_capturer.cc
-+++ b/modules/desktop_capture/desktop_capturer.cc
-@@ -21,6 +21,7 @@
- #include "modules/desktop_capture/desktop_capturer_differ_wrapper.h"
- #include "modules/desktop_capture/desktop_geometry.h"
- #include "modules/desktop_capture/shared_memory.h"
-+#include "rtc_base/logging.h"
- #include "system_wrappers/include/metrics.h"
-
- #if defined(WEBRTC_WIN)
-@@ -81,18 +82,26 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateWindowCapturer(
- #if defined(RTC_ENABLE_WIN_WGC)
- if (options.allow_wgc_window_capturer() &&
- IsWgcSupported(CaptureType::kWindow)) {
-+ RTC_LOG(LS_INFO) << "video capture: DesktopCapturer::CreateWindowCapturer "
-+ "creates DesktopCapturer of type WgcCapturerWin";
- return WgcCapturerWin::CreateRawWindowCapturer(options);
- }
- #endif // defined(RTC_ENABLE_WIN_WGC)
-
- #if defined(WEBRTC_WIN)
- if (options.allow_cropping_window_capturer()) {
-+ RTC_LOG(LS_INFO)
-+ << "video capture: DesktopCapturer::CreateWindowCapturer "
-+ "creates DesktopCapturer of type CroppingWindowCapturerWin";
- return CroppingWindowCapturer::CreateCapturer(options);
- }
- #endif // defined(WEBRTC_WIN)
-
- std::unique_ptr<DesktopCapturer> capturer = CreateRawWindowCapturer(options);
- if (capturer && options.detect_updated_region()) {
-+ RTC_LOG(LS_INFO) << "video capture: DesktopCapturer::CreateWindowCapturer "
-+ "creates DesktopCapturer of type "
-+ "DesktopCapturerDifferWrapper over a base capturer";
- capturer.reset(new DesktopCapturerDifferWrapper(std::move(capturer)));
- }
-
-@@ -105,12 +114,18 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateScreenCapturer(
- #if defined(RTC_ENABLE_WIN_WGC)
- if (options.allow_wgc_screen_capturer() &&
- IsWgcSupported(CaptureType::kScreen)) {
-+ RTC_LOG(LS_INFO) << "video capture: DesktopCapturer::CreateScreenCapturer "
-+ "creates DesktopCapturer of type WgcCapturerWin";
- return WgcCapturerWin::CreateRawScreenCapturer(options);
- }
- #endif // defined(RTC_ENABLE_WIN_WGC)
-
- std::unique_ptr<DesktopCapturer> capturer = CreateRawScreenCapturer(options);
- if (capturer && options.detect_updated_region()) {
-+ RTC_LOG(LS_INFO)
-+ << "video capture: DesktopCapturer::CreateScreenCapturer creates "
-+ "DesktopCapturer of type DesktopCapturerDifferWrapper over a base "
-+ "capturer";
- capturer.reset(new DesktopCapturerDifferWrapper(std::move(capturer)));
- }
-
-diff --git a/modules/desktop_capture/linux/x11/screen_capturer_x11.cc b/modules/desktop_capture/linux/x11/screen_capturer_x11.cc
-index 90dd797cb3..f10dcabc7e 100644
---- a/modules/desktop_capture/linux/x11/screen_capturer_x11.cc
-+++ b/modules/desktop_capture/linux/x11/screen_capturer_x11.cc
-@@ -511,8 +511,14 @@ std::unique_ptr<DesktopCapturer> ScreenCapturerX11::CreateRawScreenCapturer(
- if (!options.x_display())
- return nullptr;
-
-+ RTC_LOG(LS_INFO)
-+ << "video capture: ScreenCapturerX11::CreateRawScreenCapturer creates "
-+ "DesktopCapturer of type ScreenCapturerX11";
- std::unique_ptr<ScreenCapturerX11> capturer(new ScreenCapturerX11());
- if (!capturer->Init(options)) {
-+ RTC_LOG(LS_INFO)
-+ << "video capture: ScreenCapturerX11::CreateRawScreenCapturer "
-+ "DesktopCapturer is null because it can not be initiated";
- return nullptr;
- }
-
-diff --git a/modules/desktop_capture/linux/x11/window_capturer_x11.cc b/modules/desktop_capture/linux/x11/window_capturer_x11.cc
-index 8e592ff2d9..9505205b76 100644
---- a/modules/desktop_capture/linux/x11/window_capturer_x11.cc
-+++ b/modules/desktop_capture/linux/x11/window_capturer_x11.cc
-@@ -247,6 +247,10 @@ std::unique_ptr<DesktopCapturer> WindowCapturerX11::CreateRawWindowCapturer(
- const DesktopCaptureOptions& options) {
- if (!options.x_display())
- return nullptr;
-+
-+ RTC_LOG(LS_INFO)
-+ << "video capture: WindowCapturerX11::CreateRawWindowCapturer creates "
-+ "DesktopCapturer of type WindowCapturerX11";
- return std::unique_ptr<DesktopCapturer>(new WindowCapturerX11(options));
- }
-
-diff --git a/modules/desktop_capture/screen_capturer_darwin.mm b/modules/desktop_capture/screen_capturer_darwin.mm
-index 95a877c45d..3f14ddfe58 100644
---- a/modules/desktop_capture/screen_capturer_darwin.mm
-+++ b/modules/desktop_capture/screen_capturer_darwin.mm
-@@ -12,6 +12,7 @@
-
- #include "modules/desktop_capture/mac/screen_capturer_mac.h"
- #include "modules/desktop_capture/mac/screen_capturer_sck.h"
-+#include "rtc_base/logging.h"
-
- namespace webrtc {
-
-@@ -27,10 +28,16 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawScreenCapturer(
- std::unique_ptr<DesktopCapturer> sck_capturer =
- CreateScreenCapturerSck(options);
- if (sck_capturer) {
-+ RTC_LOG(LS_INFO)
-+ << "video capture: DesktopCapturer::CreateRawScreenCapturer creates "
-+ "DesktopCapturer of type ScreenCapturerSck";
- return sck_capturer;
+diff --git a/pc/rtc_stats_collector.cc b/pc/rtc_stats_collector.cc
+index 8686143e68..8d6cc22426 100644
+--- a/pc/rtc_stats_collector.cc
++++ b/pc/rtc_stats_collector.cc
+@@ -1754,7 +1754,10 @@ void RTCStatsCollector::ProduceAudioRTPStreamStats_n(
+ if (!voice_receiver_info.connected()) {
+ continue; // The SSRC is not known yet.
+ }
+- if (spec_lifetime && voice_receiver_info.packets_received == 0) {
++ // Check both packets received and samples received to handle the Insertable
++ // Streams use case of receiving media without receiving packets.
++ if (spec_lifetime && voice_receiver_info.packets_received == 0 &&
++ voice_receiver_info.total_samples_received == 0) {
+ // The SSRC is known despite not receiving any packets. This happens if
+ // SSRC is signalled in the SDP which we should not rely on for getStats.
+ continue;
+@@ -1868,7 +1871,10 @@ void RTCStatsCollector::ProduceVideoRTPStreamStats_n(
+ if (!video_receiver_info.connected()) {
+ continue; // The SSRC is not known yet.
}
- }
-
-+ RTC_LOG(LS_INFO)
-+ << "video capture: DesktopCapturer::CreateRawScreenCapturer creates "
-+ "DesktopCapturer of type ScreenCapturerMac";
- auto capturer =
- std::make_unique<ScreenCapturerMac>(options.configuration_monitor(),
- options.detect_updated_region(),
-diff --git a/modules/desktop_capture/screen_capturer_fuchsia.cc b/modules/desktop_capture/screen_capturer_fuchsia.cc
-index c3f51ef0fc..2a6c5e753d 100644
---- a/modules/desktop_capture/screen_capturer_fuchsia.cc
-+++ b/modules/desktop_capture/screen_capturer_fuchsia.cc
-@@ -56,6 +56,9 @@ size_t RoundUpToMultiple(size_t value, size_t multiple) {
-
- std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawScreenCapturer(
- const DesktopCaptureOptions& options) {
-+ RTC_LOG(LS_INFO)
-+ << "video capture: DesktopCapturer::CreateRawScreenCapturer creates "
-+ "DesktopCapturer of type ScreenCapturerFuchsia";
- std::unique_ptr<ScreenCapturerFuchsia> capturer(new ScreenCapturerFuchsia());
- return capturer;
- }
-diff --git a/modules/desktop_capture/screen_capturer_linux.cc b/modules/desktop_capture/screen_capturer_linux.cc
-index 94726750c5..f25e08fb59 100644
---- a/modules/desktop_capture/screen_capturer_linux.cc
-+++ b/modules/desktop_capture/screen_capturer_linux.cc
-@@ -13,6 +13,7 @@
- #include "modules/desktop_capture/desktop_capture_options.h"
- #include "modules/desktop_capture/desktop_capture_types.h"
- #include "modules/desktop_capture/desktop_capturer.h"
-+#include "rtc_base/logging.h"
-
- #if defined(WEBRTC_USE_PIPEWIRE)
- #include "modules/desktop_capture/linux/wayland/base_capturer_pipewire.h"
-@@ -29,6 +30,9 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawScreenCapturer(
- const DesktopCaptureOptions& options) {
- #if defined(WEBRTC_USE_PIPEWIRE)
- if (options.allow_pipewire() && BaseCapturerPipeWire::IsSupported()) {
-+ RTC_LOG(LS_INFO)
-+ << "video capture: DesktopCapturer::CreateRawScreenCapturer creates "
-+ "DesktopCapturer of type BaseCapturerPipeWire";
- return std::make_unique<BaseCapturerPipeWire>(options,
- CaptureType::kScreen);
- }
-diff --git a/modules/desktop_capture/screen_capturer_null.cc b/modules/desktop_capture/screen_capturer_null.cc
-index aa6d4991a0..21b2f46c4d 100644
---- a/modules/desktop_capture/screen_capturer_null.cc
-+++ b/modules/desktop_capture/screen_capturer_null.cc
-@@ -11,12 +11,16 @@
- #include <memory>
-
- #include "modules/desktop_capture/desktop_capturer.h"
-+#include "rtc_base/logging.h"
-
- namespace webrtc {
-
- // static
- std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawScreenCapturer(
- const DesktopCaptureOptions& options) {
-+ RTC_LOG(LS_INFO)
-+ << "video capture: DesktopCapturer::CreateRawScreenCapturer creates null "
-+ "DesktopCapturer";
- return nullptr;
- }
-
-diff --git a/modules/desktop_capture/screen_capturer_win.cc b/modules/desktop_capture/screen_capturer_win.cc
-index a5f2052979..6620888f18 100644
---- a/modules/desktop_capture/screen_capturer_win.cc
-+++ b/modules/desktop_capture/screen_capturer_win.cc
-@@ -19,6 +19,7 @@
- #include "modules/desktop_capture/win/dxgi_duplicator_controller.h"
- #include "modules/desktop_capture/win/screen_capturer_win_directx.h"
- #include "modules/desktop_capture/win/screen_capturer_win_gdi.h"
-+#include "rtc_base/logging.h"
-
- namespace webrtc {
-
-@@ -26,6 +27,9 @@ namespace {
-
- std::unique_ptr<DesktopCapturer> CreateScreenCapturerWinDirectx(
- const DesktopCaptureOptions& options) {
-+ RTC_LOG(LS_INFO)
-+ << "video capture: DesktopCapturer::CreateRawScreenCapturer creates "
-+ "DesktopCapturer of type ScreenCapturerWinDirectx";
- std::unique_ptr<DesktopCapturer> capturer(
- new ScreenCapturerWinDirectx(options));
- capturer.reset(new BlankDetectorDesktopCapturerWrapper(
-@@ -39,6 +43,8 @@ std::unique_ptr<DesktopCapturer> CreateScreenCapturerWinDirectx(
- std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawScreenCapturer(
- const DesktopCaptureOptions& options) {
- // Default capturer if no options are enabled is GDI.
-+ RTC_LOG(LS_INFO) << "video capture: DesktopCapturer::CreateRawScreenCapturer "
-+ "creates DesktopCapturer of type ScreenCapturerWinGdi";
- std::unique_ptr<DesktopCapturer> capturer(new ScreenCapturerWinGdi(options));
-
- // If DirectX is enabled use it as main capturer with GDI as fallback.
-diff --git a/modules/desktop_capture/window_capturer_linux.cc b/modules/desktop_capture/window_capturer_linux.cc
-index f621a63e72..87ea3d5721 100644
---- a/modules/desktop_capture/window_capturer_linux.cc
-+++ b/modules/desktop_capture/window_capturer_linux.cc
-@@ -13,6 +13,7 @@
- #include "modules/desktop_capture/desktop_capture_options.h"
- #include "modules/desktop_capture/desktop_capture_types.h"
- #include "modules/desktop_capture/desktop_capturer.h"
-+#include "rtc_base/logging.h"
-
- #if defined(WEBRTC_USE_PIPEWIRE)
- #include "modules/desktop_capture/linux/wayland/base_capturer_pipewire.h"
-@@ -29,6 +30,9 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawWindowCapturer(
- const DesktopCaptureOptions& options) {
- #if defined(WEBRTC_USE_PIPEWIRE)
- if (options.allow_pipewire() && BaseCapturerPipeWire::IsSupported()) {
-+ RTC_LOG(LS_INFO)
-+ << "video capture: DesktopCapturer::CreateRawWindowCapturer creates "
-+ "DesktopCapturer of type BaseCapturerPipeWire";
- return std::make_unique<BaseCapturerPipeWire>(options,
- CaptureType::kWindow);
- }
-diff --git a/modules/desktop_capture/window_capturer_mac.mm b/modules/desktop_capture/window_capturer_mac.mm
-index a1e6157b87..731090d3fb 100644
---- a/modules/desktop_capture/window_capturer_mac.mm
-+++ b/modules/desktop_capture/window_capturer_mac.mm
-@@ -217,6 +217,8 @@ void WindowCapturerMac::CaptureFrame() {
- // static
- std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawWindowCapturer(
- const DesktopCaptureOptions& options) {
-+ RTC_LOG(LS_INFO) << "video capture: DesktopCapturer::CreateRawWindowCapturer "
-+ "creates DesktopCapturer of type WindowCapturerMac";
- return std::unique_ptr<DesktopCapturer>(new WindowCapturerMac(
- options.full_screen_window_detector(), options.configuration_monitor()));
- }
-diff --git a/modules/desktop_capture/window_capturer_null.cc b/modules/desktop_capture/window_capturer_null.cc
-index 2061dc5248..384e186d20 100644
---- a/modules/desktop_capture/window_capturer_null.cc
-+++ b/modules/desktop_capture/window_capturer_null.cc
-@@ -12,6 +12,7 @@
-
- #include "modules/desktop_capture/desktop_capturer.h"
- #include "rtc_base/checks.h"
-+#include "rtc_base/logging.h"
-
- namespace webrtc {
-
-@@ -65,6 +66,8 @@ void WindowCapturerNull::CaptureFrame() {
- // static
- std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawWindowCapturer(
- const DesktopCaptureOptions& options) {
-+ RTC_LOG(LS_INFO) << "video capture: DesktopCapturer::CreateRawWindowCapturer "
-+ "creates DesktopCapturer of type WindowCapturerNull";
- return std::unique_ptr<DesktopCapturer>(new WindowCapturerNull());
- }
-
-diff --git a/modules/desktop_capture/window_capturer_win.cc b/modules/desktop_capture/window_capturer_win.cc
-index 115bc7d9b0..15ed7f5121 100644
---- a/modules/desktop_capture/window_capturer_win.cc
-+++ b/modules/desktop_capture/window_capturer_win.cc
-@@ -15,6 +15,7 @@
- #include "modules/desktop_capture/desktop_capturer.h"
- #include "modules/desktop_capture/rgba_color.h"
- #include "modules/desktop_capture/win/window_capturer_win_gdi.h"
-+#include "rtc_base/logging.h"
-
- #if defined(RTC_ENABLE_WIN_WGC)
- #include "modules/desktop_capture/blank_detector_desktop_capturer_wrapper.h"
-@@ -28,6 +29,8 @@ namespace webrtc {
- // static
- std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawWindowCapturer(
- const DesktopCaptureOptions& options) {
-+ RTC_LOG(LS_INFO) << "video capture: DesktopCapturer::CreateRawWindowCapturer "
-+ "creates DesktopCapturer of type WindowCapturerWinGdi";
- std::unique_ptr<DesktopCapturer> capturer(
- WindowCapturerWinGdi::CreateRawWindowCapturer(options));
- #if defined(RTC_ENABLE_WIN_WGC)
-@@ -36,6 +39,10 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawWindowCapturer(
- // BlankDectector capturer will send an error when it detects a failed
- // GDI rendering, then Fallback capturer will try to capture it again with
- // WGC.
-+ RTC_LOG(LS_INFO)
-+ << "video capture: DesktopCapturer::CreateRawWindowCapturer creates "
-+ "DesktopCapturer of type FallbackDesktopCapturerWrapper which has a "
-+ "fallback capturer of type WgcCapturerWin";
- capturer = std::make_unique<BlankDetectorDesktopCapturerWrapper>(
- std::move(capturer), RgbaColor(0, 0, 0, 0),
- /*check_per_capture*/ true);
+- if (spec_lifetime && video_receiver_info.packets_received == 0) {
++ // Check both packets received and frames received to handle the Insertable
++ // Streams use case of receiving media without receiving packets.
++ if (spec_lifetime && video_receiver_info.packets_received == 0 &&
++ video_receiver_info.frames_received == 0) {
+ // The SSRC is known despite not receiving any packets. This happens if
+ // SSRC is signalled in the SDP which we should not rely on for getStats.
+ continue;
diff --git a/third_party/libwebrtc/moz-patch-stack/p0002.patch b/third_party/libwebrtc/moz-patch-stack/p0003.patch