diff --git a/net/webrtc/src/webrtcsink/imp.rs b/net/webrtc/src/webrtcsink/imp.rs index bae4ad760..998e064a8 100644 --- a/net/webrtc/src/webrtcsink/imp.rs +++ b/net/webrtc/src/webrtcsink/imp.rs @@ -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::("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 }