[vlc-devel] [PATCH] input_clock: set the final i_late version early

Steve Lhomme robux4 at ycbcr.xyz
Thu Aug 13 14:10:26 CEST 2020


---
 src/clock/input_clock.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/clock/input_clock.c b/src/clock/input_clock.c
index a143f02fc6f..b5472b33856 100644
--- a/src/clock/input_clock.c
+++ b/src/clock/input_clock.c
@@ -270,7 +270,7 @@ vlc_tick_t input_clock_Update( input_clock_t *cl, vlc_object_t *p_log,
     /* It does not take the decoder latency into account but it is not really
      * the goal of the clock here */
     const vlc_tick_t i_system_expected = ClockStreamToSystem( cl, i_ck_stream + AvgGet( &cl->drift ) );
-    const vlc_tick_t i_late = ( i_ck_system - cl->i_pts_delay ) - i_system_expected;
+    const vlc_tick_t i_late = __MAX(0, ( i_ck_system - cl->i_pts_delay ) - i_system_expected);
     if( i_late > 0 )
     {
         cl->late.pi_value[cl->late.i_index] = i_late;
@@ -279,7 +279,7 @@ vlc_tick_t input_clock_Update( input_clock_t *cl, vlc_object_t *p_log,
 
     vlc_mutex_unlock( &cl->lock );
 
-    return i_late > 0 ? i_late : 0;
+    return i_late;
 }
 
 /*****************************************************************************
-- 
2.26.2



More information about the vlc-devel mailing list