fallbackswitch: only drop MISSING_DATA gap events pre queue

Regular gap events can be output by sources such as cefsrc in
normal operation, and should not trigger an active pad change.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/538>
This commit is contained in:
Mathieu Duponchelle 2021-08-01 18:15:19 +02:00 committed by Sebastian Dröge
parent 2092059f71
commit 198301c2ed
2 changed files with 9 additions and 3 deletions

View file

@ -39,6 +39,7 @@ pkg-config = "0.3"
[features]
default = ["libc"]
v1_18 = ["gst-base/v1_18"]
v1_20 = ["v1_18", "gst/v1_20"]
# We already use 1.14 which is new enough for static build
static = []

View file

@ -963,6 +963,7 @@ impl AggregatorImpl for FallbackSwitch {
Ok(())
}
#[cfg(feature = "v1_20")]
fn sink_event_pre_queue(
&self,
agg: &Self::Type,
@ -972,9 +973,13 @@ impl AggregatorImpl for FallbackSwitch {
use gst::EventView;
match event.view() {
EventView::Gap(_) => {
gst_debug!(CAT, obj: agg_pad, "Dropping gap event");
Ok(gst::FlowSuccess::Ok)
EventView::Gap(gap) => {
if gap.gap_flags().contains(gst::GapFlags::DATA) {
gst_debug!(CAT, obj: agg_pad, "Dropping gap event");
Ok(gst::FlowSuccess::Ok)
} else {
self.parent_sink_event_pre_queue(agg, agg_pad, event)
}
}
_ => self.parent_sink_event_pre_queue(agg, agg_pad, event),
}