commit 7f080c41c94daf2043ff2acad671050833ac8c8b
parent 5d73a38c71dafa5f8eafdc7f19c49e030a87963a
Author: Michael Froman <mfroman@mozilla.com>
Date: Wed, 8 Oct 2025 16:51:57 -0500
Bug 1993083 - Vendor libwebrtc from 3589135d09
Upstream commit: https://webrtc.googlesource.com/src/+/3589135d09261187663183ee3f01cd14852d8efa
sdp munging: detect rtcp-mux and rtcp-rsize changes
Changing rtcp-mux is sufficiently hard that is should be unused.
rtcp-rsize is newer for audio than for video so measurements are split
up per-type.
Bug: chromium:40567530
Change-Id: I66068f9ac51fc18b652ab65a88222ed739df8230
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/397661
Commit-Queue: Philipp Hancke <phancke@meta.com>
Reviewed-by: Evan Shrubsole <eshr@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#45023}
Diffstat:
4 files changed, 102 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 /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
-libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-08T21:50:44.503047+00:00.
+libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-08T21:51:47.922559+00:00.
# base of lastest vendoring
-cb88340bac
+3589135d09
diff --git a/third_party/libwebrtc/api/uma_metrics.h b/third_party/libwebrtc/api/uma_metrics.h
@@ -196,6 +196,7 @@ enum SdpMungingType {
kSsrcs = 27,
kIceOptionsRenomination = 28,
kDirection = 29,
+ kRtcpMux = 30,
// RTP header extension munging.
kRtpHeaderExtensionRemoved = 40,
kRtpHeaderExtensionAdded = 41,
@@ -214,6 +215,7 @@ enum SdpMungingType {
kAudioCodecsFmtp = 70,
kAudioCodecsRtcpFb = 71,
kAudioCodecsRtcpFbRrtr = 72,
+ kAudioCodecsRtcpReducedSize = 73,
// Video-related munging.
kVideoCodecsRemoved = 80,
kVideoCodecsAdded = 81,
@@ -224,6 +226,7 @@ enum SdpMungingType {
kVideoCodecsRtcpFb = 86,
kVideoCodecsAddedWithRawPacketization = 87,
kVideoCodecsModifiedWithRawPacketization = 88,
+ kVideoCodecsRtcpReducedSize = 89,
kMaxValue,
};
diff --git a/third_party/libwebrtc/pc/sdp_munging_detector.cc b/third_party/libwebrtc/pc/sdp_munging_detector.cc
@@ -426,6 +426,22 @@ SdpMungingType DetermineSdpMungingType(
}
}
+ // rtcp-mux.
+ if (last_created_media_description->rtcp_mux() !=
+ media_description_to_set->rtcp_mux()) {
+ RTC_LOG(LS_WARNING) << "SDP munging: rtcp-mux modified.";
+ return SdpMungingType::kRtcpMux;
+ }
+
+ // rtcp-rsize.
+ if (last_created_media_description->rtcp_reduced_size() !=
+ media_description_to_set->rtcp_reduced_size()) {
+ RTC_LOG(LS_WARNING) << "SDP munging: rtcp-rsize modified.";
+ return media_type == MediaType::AUDIO
+ ? SdpMungingType::kAudioCodecsRtcpReducedSize
+ : SdpMungingType::kVideoCodecsRtcpReducedSize;
+ }
+
// Validate codecs. We should have bailed out earlier if codecs were added
// or removed.
auto last_created_codecs = last_created_media_description->codecs();
@@ -470,6 +486,7 @@ SdpMungingType DetermineSdpMungingType(
}
}
+ // sendrecv et al.
if (last_created_media_description->direction() !=
media_description_to_set->direction()) {
RTC_LOG(LS_WARNING) << "SDP munging: transceiver direction modified.";
diff --git a/third_party/libwebrtc/pc/sdp_munging_detector_unittest.cc b/third_party/libwebrtc/pc/sdp_munging_detector_unittest.cc
@@ -52,6 +52,7 @@
#include "media/base/media_constants.h"
#include "media/base/stream_params.h"
#include "p2p/base/transport_description.h"
+#include "pc/peer_connection.h"
#include "pc/peer_connection_wrapper.h"
#include "pc/test/fake_audio_capture_module.h"
#include "pc/test/fake_rtc_certificate_generator.h"
@@ -1335,6 +1336,47 @@ TEST_F(SdpMungingTest, AudioCodecsRtcpFbRrtr) {
ElementsAre(Pair(SdpMungingType::kAudioCodecsRtcpFbRrtr, 1)));
}
+TEST_F(SdpMungingTest, RtcpMux) {
+ RTCConfiguration config;
+ config.rtcp_mux_policy = PeerConnection::kRtcpMuxPolicyNegotiate;
+ auto pc = CreatePeerConnection(config, /*field_trials=*/"");
+ // rtcp-mux is required by BUNDLE so set a remote description without BUNDLE
+ // and then remove rtcp-mux from the answer.
+ std::string sdp =
+ "v=0\r\n"
+ "o=- 0 3 IN IP4 127.0.0.1\r\n"
+ "s=-\r\n"
+ "t=0 0\r\n"
+ "a=fingerprint:sha-1 "
+ "D9:AB:00:AA:12:7B:62:54:CF:AD:3B:55:F7:60:BC:F3:40:A7:0B:5B\r\n"
+ "a=setup:actpass\r\n"
+ "a=ice-ufrag:ETEn\r\n"
+ "a=ice-pwd:OtSK0WpNtpUjkY4+86js7Z/l\r\n"
+ "m=audio 9 UDP/TLS/RTP/SAVPF 111\r\n"
+ "c=IN IP4 0.0.0.0\r\n"
+ "a=rtcp-mux\r\n"
+ "a=sendrecv\r\n"
+ "a=mid:0\r\n"
+ "a=rtpmap:111 opus/48000/2\r\n";
+ auto offer = CreateSessionDescription(SdpType::kOffer, sdp);
+ EXPECT_TRUE(pc->SetRemoteDescription(std::move(offer)));
+
+ auto answer = pc->CreateAnswer();
+ auto& contents = answer->description()->contents();
+ ASSERT_EQ(contents.size(), 1u);
+ auto* media_description = contents[0].media_description();
+ ASSERT_TRUE(media_description);
+ EXPECT_TRUE(media_description->rtcp_mux());
+ media_description->set_rtcp_mux(false);
+ // BUNDLE needs to be disabled too for this to work.
+
+ RTCError error;
+ EXPECT_TRUE(pc->SetLocalDescription(std::move(answer), &error));
+ EXPECT_THAT(
+ metrics::Samples("WebRTC.PeerConnection.SdpMunging.Answer.Initial"),
+ ElementsAre(Pair(SdpMungingType::kRtcpMux, 1)));
+}
+
TEST_F(SdpMungingTest, VideoCodecsRtcpFb) {
auto pc = CreatePeerConnection();
pc->AddVideoTrack("video_track", {});
@@ -1356,4 +1398,42 @@ TEST_F(SdpMungingTest, VideoCodecsRtcpFb) {
ElementsAre(Pair(SdpMungingType::kVideoCodecsRtcpFb, 1)));
}
+TEST_F(SdpMungingTest, AudioCodecsRtcpReducedSize) {
+ auto pc = CreatePeerConnection();
+ pc->AddAudioTrack("audio_track", {});
+
+ auto offer = pc->CreateOffer();
+ auto& contents = offer->description()->contents();
+ ASSERT_EQ(contents.size(), 1u);
+ auto* media_description = contents[0].media_description();
+ ASSERT_TRUE(media_description);
+ EXPECT_TRUE(media_description->rtcp_reduced_size());
+ media_description->set_rtcp_reduced_size(false);
+
+ RTCError error;
+ EXPECT_TRUE(pc->SetLocalDescription(std::move(offer), &error));
+ EXPECT_THAT(
+ metrics::Samples("WebRTC.PeerConnection.SdpMunging.Offer.Initial"),
+ ElementsAre(Pair(SdpMungingType::kAudioCodecsRtcpReducedSize, 1)));
+}
+
+TEST_F(SdpMungingTest, VideoCodecsRtcpReducedSize) {
+ auto pc = CreatePeerConnection();
+ pc->AddVideoTrack("video_track", {});
+
+ auto offer = pc->CreateOffer();
+ auto& contents = offer->description()->contents();
+ ASSERT_EQ(contents.size(), 1u);
+ auto* media_description = contents[0].media_description();
+ ASSERT_TRUE(media_description);
+ EXPECT_TRUE(media_description->rtcp_reduced_size());
+ media_description->set_rtcp_reduced_size(false);
+
+ RTCError error;
+ EXPECT_TRUE(pc->SetLocalDescription(std::move(offer), &error));
+ EXPECT_THAT(
+ metrics::Samples("WebRTC.PeerConnection.SdpMunging.Offer.Initial"),
+ ElementsAre(Pair(SdpMungingType::kVideoCodecsRtcpReducedSize, 1)));
+}
+
} // namespace webrtc