webrtcsink: Fix compatibility with audio level header extension

Browsers send back SDP with vad=on (default) stripped, so our caps end up incompatible.
Let's re-add the explicit vad=on variant for compatibility.

Tested with Chrome, Safari and Firefox, audiolevel correctly shows up browser-side.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2116>
This commit is contained in:
Piotr Brzeziński 2025-02-28 13:20:05 +01:00 committed by GStreamer Marge Bot
parent 24144739c4
commit 75212c7b61

View file

@ -1439,6 +1439,19 @@ impl SessionInner {
filtered_s.extend(s.iter().filter_map(|(key, value)| {
if key.starts_with("a-") {
None
} else if key.starts_with("extmap-")
&& value
.get::<&str>()
.is_ok_and(|v| v == "urn:ietf:params:rtp-hdrext:ssrc-audio-level")
{
// Workaround for the audio-level header extension: our extmap for this will usually be an array
// with "vad=on", but browsers strip that (because it's the default) and just give us a string
// with the uri. To make the capsfilter work, lets re-add the vad=on variant to the caps.
let vad_on_array =
gst::Array::new(["", "urn:ietf:params:rtp-hdrext:ssrc-audio-level", "vad=on"])
.to_send_value();
let list = gst::List::new([vad_on_array, value.to_owned()]).to_send_value();
Some((key, list))
} else {
Some((key, value.to_owned()))
}