[vlc-devel] [PATCH] Revert "input: use VLC_TICK_INVALID for time/length"

Francois Cartegnie fcvlcdev at free.fr
Mon Dec 14 11:46:02 CET 2020


microseconds duration != microseconds timestamps + offset

Unknown duration is always 0. Empty duration is straight EOF.

This reverts commit d34852727700e98ef5533bfdaead574ec1700f2a.
---
 src/input/es_out.c | 11 ++++-------
 src/input/input.c  | 14 +++++++-------
 2 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/src/input/es_out.c b/src/input/es_out.c
index ab3134ab9f..5c15604465 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -3694,14 +3694,11 @@ static int EsOutVaPrivControlLocked( es_out_t *out, int query, va_list args )
             else
                 i_delay = 0;
 
-            if( i_time != VLC_TICK_INVALID )
-            {
-                i_time -= i_delay;
-                if( i_time < VLC_TICK_0 )
-                    i_time = VLC_TICK_0;
-            }
+            i_time -= i_delay;
+            if( i_time < 0 )
+                i_time = 0;
 
-            if( i_length != VLC_TICK_INVALID )
+            if( i_length > 0 )
                 f_position -= (double)i_delay / i_length;
             if( f_position < 0 )
                 f_position = 0;
diff --git a/src/input/input.c b/src/input/input.c
index dafead8408..cebb54a5fc 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -534,7 +534,7 @@ static void MainLoopDemux( input_thread_t *p_input, bool *pb_changed )
     {
         vlc_tick_t i_time;
         if( demux_Control( p_demux, DEMUX_GET_TIME, &i_time ) )
-            i_time = VLC_TICK_INVALID;
+            i_time = 0;
 
         if( p_priv->i_stop <= i_time )
             i_ret = VLC_DEMUXER_EOF;
@@ -618,8 +618,8 @@ static void MainLoopStatistics( input_thread_t *p_input )
 {
     input_thread_private_t *priv = input_priv(p_input);
     double f_position = 0.0;
-    vlc_tick_t i_time;
-    vlc_tick_t i_length;
+    vlc_tick_t i_time = 0;
+    vlc_tick_t i_length = 0;
 
     /* update input status variables */
     if( demux_Control( priv->master->p_demux,
@@ -627,10 +627,10 @@ static void MainLoopStatistics( input_thread_t *p_input )
         f_position = 0.0;
 
     if( demux_Control( priv->master->p_demux, DEMUX_GET_TIME, &i_time ) )
-        i_time = VLC_TICK_INVALID;
+        i_time = 0;
 
     if( demux_Control( priv->master->p_demux, DEMUX_GET_LENGTH, &i_length ) )
-        i_length = VLC_TICK_INVALID;
+        i_length = 0;
 
     /* In case of failure (not implemented or in case of seek), use the last
      * normal_time value (that is VLC_TICK_0 by default). */
@@ -1288,8 +1288,8 @@ static int Init( input_thread_t * p_input )
     /* Init length */
     vlc_tick_t i_length;
     if( demux_Control( master->p_demux, DEMUX_GET_LENGTH, &i_length ) )
-        i_length = VLC_TICK_INVALID;
-    if( i_length == VLC_TICK_INVALID )
+        i_length = 0;
+    if( i_length == 0 )
         i_length = input_item_GetDuration( priv->p_item );
 
     input_SendEventTimes( p_input, 0.0, VLC_TICK_INVALID, priv->normal_time,
-- 
2.26.2



More information about the vlc-devel mailing list