This document outlines the plan and remaining tasks for deprecating and eventually removing support for local SDP munging in WebRTC/Chrome.
Local SDP munging (modifying the SDP session description between createOffer/createAnswer and setLocalDescription) is a violation of WebRTC standards WebRTC, JSEP. While historically permitted in Chrome, it introduces significant security risks (e.g., localmess), compatibility issues (no other major browser supports it), and architectural complexity.
The goal is to reach a state of zero local SDP munging by rejecting all modifications.
The spec goal of “strings should compare equal” is hard to achieve, for a couple of reasons:
Therefore, the checker is designed to catch semantic changes, not necessarily all syntactic changes.
The usage of the various types of munge is tracked in WebRTC by the UMA histograms named WebRTC.PeerConnection.SdpMunging. There are separate histograms for Offer, Answer and PrAnswer, and each histogram tracks all the forms of munge as selectable buckets. Munges are checked in sequence, so if an instance applies multiple munges, only the one that is checked for first is detected. Unlcassified munges are in the “UnknownModification” bucket; it is good to update the detector to classify these munges as a new category whenever they can be identified.
There are also munges that are more easily detected at the Chrome level and counted in the Blink.UseCounter.Features UMA; these are buckets prefixed with “RTCLocalSdpModification”.
The deprecation uses an iterative rollout using the field trial WebRTC-NoSdpMangleReject. This trial takes a comma-separated list of numeric SdpMungingType values to disallow.
The rollout proceeds in phases:
The following munging types have been identified as having near-zero usage (<0.01% in UMA) and are candidates for immediate blocking:
kIceMode = 23) - Zero usagekAudioCodecsAddedL16 = 64)kAudioCodecsFmtpOpusFec = 66)kSsrcs = 27)kNumberOfContents = 4)kAudioCodecsFmtpOpusCbr = 67)kIcePwd = 21)kAudioCodecsRtcpReducedSize = 73)kDtlsSetup = 24)kVideoCodecsModifiedWithRawPacketization = 88)kWithoutCreateAnswer = 2)WebRTC-NoSdpMangleReject blocklist via Finch.Several munging types are widely used because spec-compliant alternative APIs are either not fully adopted or not yet implemented.
kAudioCodecsFmtpOpusStereo = 68)kVideoCodecsAddedWithRawPacketization = 87, kVideoCodecsModifiedWithRawPacketization = 88)RTCRtpSender.setParameters.kAudioCodecsRtcpFbRrtr = 72)a=rtcp-fb:<pt> rrtr).kRtpHeaderExtensionAdded = 41, kRtpHeaderExtensionRemoved = 40, kRtpHeaderExtensionModified = 42)kIceOptions = 20)If a unit test or integration test explicitly performs SDP munging (e.g. to test legacy behavior or error handling), it must declare which munging types it allows. This is done by configuring the WebRTC-NoSdpMangleAllowForTesting field trial with a comma-separated list of allowed SdpMungingType numeric values.
Example in an integration test:
// Allow kBundle (33) munging in this test. SetFieldTrials("WebRTC-NoSdpMangleAllowForTesting/Enabled,33/");
In sdp_munging_detector_unittest.cc, use the CreateFieldTrialsForMangleTesting helper, which also ensures that the rollout blocklist (WebRTC-NoSdpMangleReject) is disabled to prevent interference with the test assertions:
CreateFieldTrialsForMangleTesting("WebRTC-NoSdpMangleAllowForTesting/Enabled,1/");
To ensure that all tests performing SDP munging have properly declared their allowed munges, you can run the test suites with the allow-list enabled but empty from the command line. This forces rejection of all munging by default.
Run command example:
out/Default/peerconnection_unittests --force-fieldtrials=WebRTC-NoSdpMangleAllowForTesting/Enabled/
Any test that performs SDP munging without explicitly overriding this trial to allow its specific munge type will fail.
CreateFieldTrialsForMangleTesting in pc/sdp_munging_detector_unittest.cc