fallbackswitch: Fix clipping of buffers against the output running time

To handle buffers outside the segment correctly.

Also fix debug output to print the correct value.
This commit is contained in:
Sebastian Dröge 2022-04-13 12:41:57 +03:00 committed by Sebastian Dröge
parent 617a2ef49e
commit ca7cf7dee7

View file

@ -693,13 +693,18 @@ impl FallbackSwitch {
let discont_pending = state.discont_pending;
if is_active {
if start_running_time < state.output_running_time {
if Option::zip(start_running_time, state.output_running_time).map_or(
false,
|(start_running_time, output_running_time)| {
start_running_time < output_running_time
},
) {
log!(
CAT,
obj: pad,
"Dropping trailing buffer {:?} before timeout {}",
"Dropping trailing buffer {:?} before output running time {}",
buffer,
state.timeout_running_time
state.output_running_time.display(),
);
return Ok(gst::FlowSuccess::Ok);