utils/fallbacksrc: Remove custom source elements from internal bin when shutting down

Otherwise we can't add it again later to a new bin when starting up again.
This commit is contained in:
Sebastian Dröge 2020-09-23 19:21:38 +03:00 committed by Sebastian Dröge
parent fab361d32d
commit bf82e750f4

View file

@ -1109,6 +1109,18 @@ impl FallbackSrc {
state.video_stream = None;
state.audio_stream = None;
if let Source::Element(ref source) = state.configured_source {
// Explicitly remove the source element from the CustomSource so that we can
// later create a new CustomSource and add it again there.
if source.has_as_parent(&state.source) {
let _ = source.set_state(gst::State::Null);
let _ = state
.source
.downcast_ref::<gst::Bin>()
.unwrap()
.remove(source);
}
}
element.remove(&state.source).unwrap();
if let Some(timeout) = state.source_pending_restart_timeout.take() {