From ca7cf7dee704ae77fb4a0bb4f4f5155235794ff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 13 Apr 2022 12:41:57 +0300 Subject: [PATCH] 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. --- utils/fallbackswitch/src/fallbackswitch/imp.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/utils/fallbackswitch/src/fallbackswitch/imp.rs b/utils/fallbackswitch/src/fallbackswitch/imp.rs index 38d7c589..307d78e7 100644 --- a/utils/fallbackswitch/src/fallbackswitch/imp.rs +++ b/utils/fallbackswitch/src/fallbackswitch/imp.rs @@ -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);