utils/fallbackswitch: Use the correct segment when deciding to drop fallback buffers

Thanks to Jan Schmidt for noticing.
This commit is contained in:
Sebastian Dröge 2020-09-24 09:34:26 +03:00 committed by Sebastian Dröge
parent bf82e750f4
commit 331374fabe

View file

@ -219,8 +219,11 @@ impl FallbackSwitch {
// Drop all older buffers from the fallback sinkpad // Drop all older buffers from the fallback sinkpad
if let Some(fallback_sinkpad) = fallback_sinkpad { if let Some(fallback_sinkpad) = fallback_sinkpad {
let fallback_segment = self let segment = fallback_sinkpad.get_segment();
.sinkpad
// Might have no segment at all yet
if segment.get_format() != gst::Format::Undefined {
let fallback_segment = fallback_sinkpad
.get_segment() .get_segment()
.downcast::<gst::ClockTime>() .downcast::<gst::ClockTime>()
.map_err(|_| { .map_err(|_| {
@ -245,6 +248,7 @@ impl FallbackSwitch {
} }
} }
} }
}
let pad_states = self.pad_states.read().unwrap(); let pad_states = self.pad_states.read().unwrap();
let active_caps = pad_states.sinkpad.caps.as_ref().unwrap().clone(); let active_caps = pad_states.sinkpad.caps.as_ref().unwrap().clone();