diff options
author | Seungha Yang <seungha@centricular.com> | 2022-10-19 17:03:15 +0300 |
---|---|---|
committer | Seungha Yang <seungha@centricular.com> | 2022-10-19 19:56:36 +0300 |
commit | 1db66e5a3b7c54f015f61f4a8385a378d8d0dd36 (patch) | |
tree | 1651f85a0c42b6df2646158c426298fb157cc706 | |
parent | 12400b6b87e75cfdfa7701b62cf8698c11e14a73 (diff) |
fallbacksrc: Drop QoS event while pad is blocked
An element which creates QoS event might reference different
GstSegment timeline (e.g., fallback testsrc's one).
Then it can cause lots of buffers are being dropped in decoder,
because of the QoS events.
Drops the QoS event before we calculate appropriate pad offsets
from blocking pad probe.
-rw-r--r-- | utils/fallbackswitch/src/fallbacksrc/imp.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/utils/fallbackswitch/src/fallbacksrc/imp.rs b/utils/fallbackswitch/src/fallbacksrc/imp.rs index 3ec4f757e..829d18f2a 100644 --- a/utils/fallbackswitch/src/fallbacksrc/imp.rs +++ b/utils/fallbackswitch/src/fallbacksrc/imp.rs @@ -124,6 +124,7 @@ enum Source { struct Block { pad: gst::Pad, probe_id: gst::PadProbeId, + qos_probe_id: gst::PadProbeId, running_time: Option<gst::ClockTime>, } @@ -2003,9 +2004,22 @@ impl FallbackSrc { ) .unwrap(); + let qos_probe_id = block_pad + .add_probe(gst::PadProbeType::EVENT_UPSTREAM, |_pad, info| { + if let Some(gst::PadProbeData::Event(ref ev)) = info.data { + if let gst::EventView::Qos(_) = ev.view() { + return gst::PadProbeReturn::Drop; + } + } + + gst::PadProbeReturn::Ok + }) + .unwrap(); + Block { pad: block_pad.clone(), probe_id, + qos_probe_id, running_time: gst::ClockTime::NONE, } } @@ -2120,6 +2134,7 @@ impl FallbackSrc { fallback_source, ); block.pad.remove_probe(block.probe_id); + block.pad.remove_probe(block.qos_probe_id); } gst::debug!(CAT, imp: self, "Live source, unblocking directly"); @@ -2337,6 +2352,7 @@ impl FallbackSrc { block.pad.set_offset(offset); } block.pad.remove_probe(block.probe_id); + block.pad.remove_probe(block.qos_probe_id); } if let Some(block) = video_branch @@ -2347,6 +2363,7 @@ impl FallbackSrc { block.pad.set_offset(offset); } block.pad.remove_probe(block.probe_id); + block.pad.remove_probe(block.qos_probe_id); } } else if have_audio && want_audio { let audio_running_time = match audio_running_time { @@ -2381,6 +2398,7 @@ impl FallbackSrc { block.pad.set_offset(offset); } block.pad.remove_probe(block.probe_id); + block.pad.remove_probe(block.qos_probe_id); } } else if have_video && want_video { let video_running_time = match video_running_time { @@ -2415,6 +2433,7 @@ impl FallbackSrc { block.pad.set_offset(offset); } block.pad.remove_probe(block.probe_id); + block.pad.remove_probe(block.qos_probe_id); } } } @@ -2905,6 +2924,7 @@ impl FallbackSrc { source_srcpad.name() ); block.pad.remove_probe(block.probe_id); + block.pad.remove_probe(block.qos_probe_id); } let switch_sinkpads = [state.audio_stream.as_ref(), state.video_stream.as_ref()] .into_iter() |