[vlc-devel] [PATCH 5/8] decoder: use a define for the unset preroll

Steve Lhomme robux4 at ycbcr.xyz
Tue Aug 27 07:27:16 CEST 2019


---
 src/input/decoder.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index c0aa53f04d..b419954bab 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -109,6 +109,9 @@ struct decoder_owner
     /* -- Theses variables need locking on read *and* write -- */
     /* Preroll */
     vlc_tick_t i_preroll_end;
+
+#define PREROLL_NONE  ((vlc_tick_t) INT64_MIN)
+
     /* Pause & Rate */
     bool reset_out_state;
     vlc_tick_t pause_date;
@@ -1002,8 +1005,8 @@ static bool DecoderPlayVideo( struct decoder_owner *p_owner, picture_t *p_pictur
         return false;
     }
 
-    prerolled = p_owner->i_preroll_end > (vlc_tick_t)INT64_MIN;
-    p_owner->i_preroll_end = (vlc_tick_t)INT64_MIN;
+    prerolled = p_owner->i_preroll_end != PREROLL_NONE;
+    p_owner->i_preroll_end = PREROLL_NONE;
     vlc_mutex_unlock( &p_owner->lock );
 
     if( unlikely(prerolled) )
@@ -1149,8 +1152,8 @@ static bool DecoderPlayAudio( decoder_t *p_dec, block_t *p_audio )
         return false;
     }
 
-    prerolled = p_owner->i_preroll_end > (vlc_tick_t)INT64_MIN;
-    p_owner->i_preroll_end = (vlc_tick_t)INT64_MIN;
+    prerolled = p_owner->i_preroll_end != PREROLL_NONE;
+    p_owner->i_preroll_end = PREROLL_NONE;
     vlc_mutex_unlock( &p_owner->lock );
 
     if( unlikely(prerolled) )
@@ -1475,7 +1478,7 @@ static void DecoderProcessFlush( decoder_t *p_dec )
         }
     }
 
-    p_owner->i_preroll_end = (vlc_tick_t)INT64_MIN;
+    p_owner->i_preroll_end = PREROLL_NONE;
     vlc_mutex_unlock( &p_owner->lock );
 }
 
@@ -1774,7 +1777,7 @@ static decoder_t * CreateDecoder( vlc_object_t *p_parent,
     p_dec = &p_owner->dec;
 
     p_owner->p_clock = p_clock;
-    p_owner->i_preroll_end = (vlc_tick_t)INT64_MIN;
+    p_owner->i_preroll_end = PREROLL_NONE;
     p_owner->p_resource = p_resource;
     p_owner->cbs = cbs;
     p_owner->cbs_userdata = cbs_userdata;
-- 
2.17.1



More information about the vlc-devel mailing list