mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-20 02:21:00 +00:00
utils/fallbackswitch: Use the correct segment when deciding to drop fallback buffers
Thanks to Jan Schmidt for noticing.
This commit is contained in:
parent
bf82e750f4
commit
331374fabe
1 changed files with 26 additions and 22 deletions
|
@ -219,29 +219,33 @@ impl FallbackSwitch {
|
|||
|
||||
// Drop all older buffers from the fallback sinkpad
|
||||
if let Some(fallback_sinkpad) = fallback_sinkpad {
|
||||
let fallback_segment = self
|
||||
.sinkpad
|
||||
.get_segment()
|
||||
.downcast::<gst::ClockTime>()
|
||||
.map_err(|_| {
|
||||
gst_error!(CAT, obj: agg, "Only TIME segments supported");
|
||||
gst::FlowError::Error
|
||||
})?;
|
||||
let segment = fallback_sinkpad.get_segment();
|
||||
|
||||
while let Some(fallback_buffer) = fallback_sinkpad.peek_buffer() {
|
||||
let fallback_pts = fallback_buffer.get_dts_or_pts();
|
||||
if fallback_pts.is_none()
|
||||
|| fallback_segment.to_running_time(fallback_pts) <= state.last_sinkpad_time
|
||||
{
|
||||
gst_debug!(
|
||||
CAT,
|
||||
obj: agg,
|
||||
"Dropping fallback buffer {:?}",
|
||||
fallback_buffer
|
||||
);
|
||||
fallback_sinkpad.drop_buffer();
|
||||
} else {
|
||||
break;
|
||||
// Might have no segment at all yet
|
||||
if segment.get_format() != gst::Format::Undefined {
|
||||
let fallback_segment = fallback_sinkpad
|
||||
.get_segment()
|
||||
.downcast::<gst::ClockTime>()
|
||||
.map_err(|_| {
|
||||
gst_error!(CAT, obj: agg, "Only TIME segments supported");
|
||||
gst::FlowError::Error
|
||||
})?;
|
||||
|
||||
while let Some(fallback_buffer) = fallback_sinkpad.peek_buffer() {
|
||||
let fallback_pts = fallback_buffer.get_dts_or_pts();
|
||||
if fallback_pts.is_none()
|
||||
|| fallback_segment.to_running_time(fallback_pts) <= state.last_sinkpad_time
|
||||
{
|
||||
gst_debug!(
|
||||
CAT,
|
||||
obj: agg,
|
||||
"Dropping fallback buffer {:?}",
|
||||
fallback_buffer
|
||||
);
|
||||
fallback_sinkpad.drop_buffer();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue