commit c49ae10e7f29deafbb7d62ec7bec5da4fb2507c7
parent fc66d8c07b29a0647dd126bce027980eb7c3bddf
Author: Dan Baker <dbaker@mozilla.com>
Date: Thu, 23 Oct 2025 14:40:28 -0600
Bug 1995393 - Vendor libwebrtc from 5d74f2147f
Upstream commit: https://webrtc.googlesource.com/src/+/5d74f2147f1462d5d64a21a1f3143879a0009900
stats: make createDataChannel invalidate the stats cache
so calling getStats immediately before and after shows the channel.
See discussion in
https://github.com/w3c/webrtc-stats/issues/805
for context
Bug: webrtc:42233838
Change-Id: If2052556dbe81a04b3954281624da4400f27d122
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/403507
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@meta.com>
Reviewed-by: Guido Urdaneta <guidou@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#45323}
Diffstat:
3 files changed, 17 insertions(+), 2 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-10-23T20:37:12.022156+00:00.
+libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-23T20:40:11.118836+00:00.
# base of lastest vendoring
-65b75ab230
+5d74f2147f
diff --git a/third_party/libwebrtc/pc/data_channel_integrationtest.cc b/third_party/libwebrtc/pc/data_channel_integrationtest.cc
@@ -1184,11 +1184,25 @@ TEST_P(DataChannelIntegrationTest,
IsRtcOk());
auto caller_report = caller()->NewGetStats();
+ ASSERT_THAT(caller_report, NotNull());
EXPECT_EQ(1u, caller_report->GetStatsOfType<RTCTransportStats>().size());
auto callee_report = callee()->NewGetStats();
+ ASSERT_THAT(callee_report, NotNull());
EXPECT_EQ(1u, callee_report->GetStatsOfType<RTCTransportStats>().size());
}
+TEST_P(DataChannelIntegrationTest, CreateDataChannelInvalidatesStatsCache) {
+ ASSERT_TRUE(CreatePeerConnectionWrappers());
+ auto first_report = caller()->NewGetStats();
+ ASSERT_THAT(first_report, NotNull());
+ caller()->CreateDataChannel();
+ auto second_report = caller()->NewGetStats();
+ ASSERT_THAT(second_report, NotNull());
+
+ EXPECT_EQ(0u, first_report->GetStatsOfType<RTCDataChannelStats>().size());
+ EXPECT_EQ(1u, second_report->GetStatsOfType<RTCDataChannelStats>().size());
+}
+
TEST_P(DataChannelIntegrationTest, QueuedPacketsGetDeliveredInReliableMode) {
CreatePeerConnectionWrappers();
ConnectFakeSignaling();
diff --git a/third_party/libwebrtc/pc/peer_connection.cc b/third_party/libwebrtc/pc/peer_connection.cc
@@ -1397,6 +1397,7 @@ PeerConnection::CreateDataChannelOrError(const std::string& label,
return ret.MoveError();
}
+ ClearStatsCache();
scoped_refptr<DataChannelInterface> channel = ret.MoveValue();
// Check the onRenegotiationNeeded event (with plan-b backward compat)