mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-25 13:01:07 +00:00
fallbacksrc: Don't forward manual flush events to downstream
fallbackswitch might forward flush event if it's for the currently active pad. But forwarded flush event will be problematic in various reasons and that's not a behavior we expected.
This commit is contained in:
parent
5788837fb6
commit
930cc41aaa
1 changed files with 26 additions and 0 deletions
|
@ -2142,6 +2142,28 @@ impl FallbackSrc {
|
|||
}
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let stream_srcpads = [state.audio_stream.as_ref(), state.video_stream.as_ref()]
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.map(|s| {
|
||||
let srcpad = s.srcpad.clone();
|
||||
let probe_id = srcpad
|
||||
.add_probe(
|
||||
gst::PadProbeType::EVENT_DOWNSTREAM | gst::PadProbeType::EVENT_FLUSH,
|
||||
move |_pad, info| match info.data {
|
||||
Some(gst::PadProbeData::Event(ref ev)) => match ev.view() {
|
||||
gst::EventView::FlushStart(_) => gst::PadProbeReturn::Drop,
|
||||
gst::EventView::FlushStop(_) => gst::PadProbeReturn::Drop,
|
||||
_ => gst::PadProbeReturn::Ok,
|
||||
},
|
||||
_ => gst::PadProbeReturn::Ok,
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
(probe_id, srcpad)
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
drop(state_guard);
|
||||
|
||||
gst::debug!(CAT, obj: element, "Flushing source");
|
||||
|
@ -2155,6 +2177,10 @@ impl FallbackSrc {
|
|||
let _ = pad.send_event(gst::event::FlushStop::builder(true).build());
|
||||
}
|
||||
|
||||
for (probe_id, pad) in stream_srcpads {
|
||||
pad.remove_probe(probe_id);
|
||||
}
|
||||
|
||||
// Sleep for 1s before retrying
|
||||
|
||||
let mut state_guard = src.state.lock();
|
||||
|
|
Loading…
Reference in a new issue