From 2192c9d3b45ac219fc6870fc53fd7a66674980da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 2 Jul 2020 11:27:57 +0300 Subject: [PATCH] fallbacksrc: Unset ghost pad targets before removing from the element Workaround for https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/553 --- utils/fallbackswitch/src/fallbacksrc.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/utils/fallbackswitch/src/fallbacksrc.rs b/utils/fallbackswitch/src/fallbacksrc.rs index a2fd37dde..4e23458a7 100644 --- a/utils/fallbackswitch/src/fallbacksrc.rs +++ b/utils/fallbackswitch/src/fallbacksrc.rs @@ -95,7 +95,7 @@ struct Stream { switch: gst::Element, // output source pad, connected to switch - srcpad: gst::Pad, + srcpad: gst::GhostPad, } struct State { @@ -938,7 +938,8 @@ impl FallbackSrc { element.remove(&stream.switch).unwrap(); element.remove(&stream.clocksync).unwrap(); element.remove(&stream.fallback_input).unwrap(); - element.remove_pad(&stream.srcpad).unwrap(); + let _ = stream.srcpad.set_target(None::<&gst::Pad>); + let _ = element.remove_pad(&stream.srcpad); } state.video_stream = None; state.audio_stream = None; @@ -1980,7 +1981,7 @@ mod custom_source { struct Stream { source_pad: gst::Pad, - ghost_pad: gst::Pad, + ghost_pad: gst::GhostPad, // Dummy stream we created stream: gst::Stream, } @@ -2292,6 +2293,7 @@ mod custom_source { drop(state); ghost_pad.set_active(false).unwrap(); + let _ = ghost_pad.set_target(None::<&gst::Pad>); let _ = element.remove_pad(&ghost_pad); Ok(()) @@ -2335,6 +2337,7 @@ mod custom_source { drop(state); for pad in pads { + let _ = pad.ghost_pad.set_target(None::<&gst::Pad>); let _ = element.remove_pad(&pad.ghost_pad); }