webrtcsink: Don't reject caps events if the codec_data changes

We only care if actually incompatible changes are happening, which would
be reflected by other caps fields.

Use the same codec caps cleanup function as elsewhere for this purpose.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2315>
This commit is contained in:
Sebastian Dröge 2025-06-23 11:51:25 +03:00 committed by GStreamer Marge Bot
parent 88dbe2dc4e
commit 7cd277e56b

View file

@ -4184,10 +4184,15 @@ impl BaseWebRTCSink {
/// Check if the caps of a sink pad can be changed from `current` to `new` without requiring a WebRTC renegotiation
fn input_caps_change_allowed(&self, current: &gst::CapsRef, new: &gst::CapsRef) -> bool {
let Some(current) = current.structure(0) else {
let mut current = cleanup_codec_caps(current.to_owned());
let current = current.get_mut().unwrap();
let mut new = cleanup_codec_caps(new.to_owned());
let new = new.get_mut().unwrap();
let Some(current) = current.structure_mut(0) else {
return false;
};
let Some(new) = new.structure(0) else {
let Some(new) = new.structure_mut(0) else {
return false;
};
@ -4195,9 +4200,6 @@ impl BaseWebRTCSink {
return false;
}
let mut current = current.to_owned();
let mut new = new.to_owned();
// Allow changes of fields which should not be part of the SDP, and so can be updated without requiring
// a renegotiation.
let caps_type = current.name();
@ -4215,7 +4217,7 @@ impl BaseWebRTCSink {
new.remove_fields(VIDEO_ALLOWED_CHANGES.iter().copied());
// Multiview can be part of SDP, but missing field should be treated the same as mono view.
fn remove_multiview(s: &mut gst::Structure) {
fn remove_multiview(s: &mut gst::StructureRef) {
let is_mono = match s.get::<VideoMultiviewMode>("multiview-mode") {
Ok(mode) => mode == VideoMultiviewMode::Mono,
Err(_) => true,
@ -4224,8 +4226,8 @@ impl BaseWebRTCSink {
s.remove_fields(["multiview-mode", "multiview-flags"])
}
}
remove_multiview(&mut current);
remove_multiview(&mut new);
remove_multiview(current);
remove_multiview(new);
} else if caps_type.starts_with("audio/") {
// TODO
}