From 722dba12037febc4f6886bbf8d060ffbd920076f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 4 Apr 2023 12:34:27 +0300 Subject: [PATCH] fallbacksrc: Don't check caps when linking to the fallbackswitch Downstream might have different caps requirements and linking might fail. Instead of having linking fail, give upstream an opportunity to reconfigure and otherwise have a normal negotiation error during data flow. Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/334 Part-of: --- utils/fallbackswitch/src/fallbacksrc/imp.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/utils/fallbackswitch/src/fallbacksrc/imp.rs b/utils/fallbackswitch/src/fallbacksrc/imp.rs index 7d73c423..8ba75c5a 100644 --- a/utils/fallbackswitch/src/fallbacksrc/imp.rs +++ b/utils/fallbackswitch/src/fallbacksrc/imp.rs @@ -1178,8 +1178,13 @@ impl FallbackSrc { let dummy_srcpad = dummy_source.static_pad("src").unwrap(); let dummy_sinkpad = switch.request_pad_simple("sink_%u").unwrap(); - dummy_srcpad.link(&dummy_sinkpad).unwrap(); dummy_sinkpad.set_property("priority", 2u32); + dummy_srcpad + .link_full( + &dummy_sinkpad, + gst::PadLinkCheck::all() & !gst::PadLinkCheck::CAPS, + ) + .unwrap(); switch.connect_notify(Some("active-pad"), move |switch, _pspec| { let element = match switch @@ -1894,7 +1899,12 @@ impl FallbackSrc { // Link the new source pad in let switch_pad = switch.request_pad_simple("sink_%u").unwrap(); switch_pad.set_property("priority", u32::from(fallback_source)); - ghostpad.link(&switch_pad).unwrap(); + ghostpad + .link_full( + &switch_pad, + gst::PadLinkCheck::all() & !gst::PadLinkCheck::CAPS, + ) + .unwrap(); pad.add_probe(gst::PadProbeType::EVENT_DOWNSTREAM, move |pad, info| { let element = match pad