commit 9992d3f9eec03a041b86b8350643866de228dffb
parent d4b00c50c4c436125e3bbd3f8c1ba666d0892768
Author: Dan Baker <dbaker@mozilla.com>
Date: Thu, 23 Oct 2025 15:29:29 -0600
Bug 1995393 - Vendor libwebrtc from 3d4bae08b2
Upstream commit: https://webrtc.googlesource.com/src/+/3d4bae08b2b44835ab25612e0cd60e2aff982b1e
SDP munging: Isolate candidate-count changes
Bug: webrtc:414284082
Change-Id: Iaac30a31d4f6b85613826158056ba6d3f14449a8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/404420
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Auto-Submit: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#45343}
Diffstat:
5 files changed, 36 insertions(+), 3 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-23T21:26:32.804291+00:00.
+libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-23T21:29:17.819152+00:00.
# base of lastest vendoring
-9ebd1ce74d
+3d4bae08b2
diff --git a/third_party/libwebrtc/api/uma_metrics.h b/third_party/libwebrtc/api/uma_metrics.h
@@ -199,6 +199,7 @@ enum SdpMungingType {
kDirection = 29,
kRtcpMux = 30,
kIceOptionsTrickle = 31,
+ kIceCandidateCount = 32,
// RTP header extension munging.
kRtpHeaderExtensionRemoved = 40,
kRtpHeaderExtensionAdded = 41,
diff --git a/third_party/libwebrtc/moz-patch-stack/p0002.patch b/third_party/libwebrtc/moz-patch-stack/p0002.patch
@@ -26,7 +26,7 @@ Cr-Branched-From: 9bd64751d9b3b35a820cb72c9029993e218146a1-refs/heads/main@{#452
1 file changed, 6 insertions(+)
diff --git a/pc/sdp_munging_detector.cc b/pc/sdp_munging_detector.cc
-index 58e580baa3..7b126d9b26 100644
+index 04f0d53fd0..88f38da30d 100644
--- a/pc/sdp_munging_detector.cc
+++ b/pc/sdp_munging_detector.cc
@@ -427,6 +427,12 @@ SdpMungingType DetermineSdpMungingType(
diff --git a/third_party/libwebrtc/pc/sdp_munging_detector.cc b/third_party/libwebrtc/pc/sdp_munging_detector.cc
@@ -559,6 +559,22 @@ SdpMungingType DetermineSdpMungingType(
return type;
}
+ // Validate number of candidates.
+ for (size_t content_index = 0; content_index < last_created_contents.size();
+ content_index++) {
+ // All contents have a (possibly empty) candidate set.
+ // Check that this holds.
+ RTC_DCHECK(sdesc->candidates(content_index));
+ if (sdesc->candidates(content_index)->count() !=
+ last_created_desc->candidates(content_index)->count()) {
+ RTC_LOG(LS_WARNING)
+ << "SDP munging: media section " << content_index << " changed from "
+ << last_created_desc->candidates(content_index)->count() << " to "
+ << sdesc->candidates(content_index)->count() << " candidates";
+ return SdpMungingType::kIceCandidateCount;
+ }
+ }
+
// TODO: crbug.com/40567530 - this serializes the descriptions back to a SDP
// string which is very complex and we not should be be forced to rely on
// string equality.
diff --git a/third_party/libwebrtc/pc/sdp_munging_detector_unittest.cc b/third_party/libwebrtc/pc/sdp_munging_detector_unittest.cc
@@ -26,6 +26,7 @@
#include "api/audio_codecs/audio_format.h"
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
+#include "api/candidate.h"
#include "api/create_peerconnection_factory.h"
#include "api/jsep.h"
#include "api/media_types.h"
@@ -1427,4 +1428,19 @@ TEST_F(SdpMungingTest, VideoCodecsRtcpReducedSize) {
ElementsAre(Pair(SdpMungingType::kVideoCodecsRtcpReducedSize, 1)));
}
+TEST_F(SdpMungingTest, NumberOfCandidates) {
+ auto pc = CreatePeerConnection();
+ pc->AddVideoTrack("video_track", {});
+
+ std::unique_ptr<SessionDescriptionInterface> offer = pc->CreateOffer();
+ IceCandidate candidate("", 0, Candidate());
+ EXPECT_TRUE(offer->AddCandidate(&candidate));
+
+ RTCError error;
+ EXPECT_TRUE(pc->SetLocalDescription(std::move(offer), &error));
+ EXPECT_THAT(
+ metrics::Samples("WebRTC.PeerConnection.SdpMunging.Offer.Initial"),
+ ElementsAre(Pair(SdpMungingType::kIceCandidateCount, 1)));
+}
+
} // namespace webrtc