From 198301c2edcc87027593a18a0094d31be5e02ba1 Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Sun, 1 Aug 2021 18:15:19 +0200 Subject: [PATCH] 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: --- utils/fallbackswitch/Cargo.toml | 1 + utils/fallbackswitch/src/fallbackswitch/imp.rs | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/utils/fallbackswitch/Cargo.toml b/utils/fallbackswitch/Cargo.toml index e196afd0..b936090e 100644 --- a/utils/fallbackswitch/Cargo.toml +++ b/utils/fallbackswitch/Cargo.toml @@ -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 = [] diff --git a/utils/fallbackswitch/src/fallbackswitch/imp.rs b/utils/fallbackswitch/src/fallbackswitch/imp.rs index 8b059890..618c2a50 100644 --- a/utils/fallbackswitch/src/fallbackswitch/imp.rs +++ b/utils/fallbackswitch/src/fallbackswitch/imp.rs @@ -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), }