fallbacksrc: Unflush downstream pads of the source after shutting down everything

Otherwise the pads might still be flushing on the next try and the
source would never recover.
This commit is contained in:
Sebastian Dröge 2022-04-12 14:40:08 +03:00
parent 7233d6936c
commit 5788837fb6

View file

@ -2131,6 +2131,17 @@ impl FallbackSrc {
);
block.pad.remove_probe(block.probe_id);
}
let stream_sinkpads = [state.audio_stream.as_ref(), state.video_stream.as_ref()]
.into_iter()
.flatten()
.map(|s| {
if let Some(ref imagefreeze) = s.imagefreeze {
imagefreeze.static_pad("sink").unwrap()
} else {
s.clocksync_queue.static_pad("sink").unwrap()
}
})
.collect::<Vec<_>>();
drop(state_guard);
gst::debug!(CAT, obj: element, "Flushing source");
@ -2139,6 +2150,11 @@ impl FallbackSrc {
gst::debug!(CAT, obj: element, "Shutting down source");
let _ = source.set_state(gst::State::Null);
gst::debug!(CAT, obj: element, "Stop flushing downstream of source");
for pad in stream_sinkpads {
let _ = pad.send_event(gst::event::FlushStop::builder(true).build());
}
// Sleep for 1s before retrying
let mut state_guard = src.state.lock();