[vlc-commits] decoder: use defines for the unset/forced preroll values

Steve Lhomme git at videolan.org
Tue Sep 3 10:12:26 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Aug 27 07:15:17 2019 +0200| [e5b94b633ab6d2a1c905e61c680a9a25be90b45f] | committer: Steve Lhomme

decoder: use defines for the unset/forced preroll values

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e5b94b633ab6d2a1c905e61c680a9a25be90b45f
---

 src/input/decoder.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index ead516f40c..e28b179212 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -109,6 +109,10 @@ struct decoder_owner
     /* -- Theses variables need locking on read *and* write -- */
     /* Preroll */
     vlc_tick_t i_preroll_end;
+
+#define PREROLL_NONE    INT64_MIN // vlc_tick_t
+#define PREROLL_FORCED  INT64_MAX // vlc_tick_t
+
     /* Pause & Rate */
     bool reset_out_state;
     vlc_tick_t pause_date;
@@ -773,11 +777,11 @@ static void DecoderWaitUnblock( struct decoder_owner *p_owner )
 static inline void DecoderUpdatePreroll( vlc_tick_t *pi_preroll, const block_t *p )
 {
     if( p->i_flags & BLOCK_FLAG_PREROLL )
-        *pi_preroll = (vlc_tick_t)INT64_MAX;
+        *pi_preroll = PREROLL_FORCED;
     /* Check if we can use the packet for end of preroll */
     else if( (p->i_flags & BLOCK_FLAG_DISCONTINUITY) &&
              (p->i_buffer == 0 || (p->i_flags & BLOCK_FLAG_CORRUPTED)) )
-        *pi_preroll = (vlc_tick_t)INT64_MAX;
+        *pi_preroll = PREROLL_FORCED;
     else if( p->i_dts != VLC_TICK_INVALID )
         *pi_preroll = __MIN( *pi_preroll, p->i_dts );
     else if( p->i_pts != VLC_TICK_INVALID )
@@ -987,7 +991,7 @@ static int DecoderPlayVideo( struct decoder_owner *p_owner, picture_t *p_picture
     }
 
     vlc_mutex_lock( &p_owner->lock );
-    bool prerolled = p_owner->i_preroll_end != (vlc_tick_t)INT64_MIN;
+    bool prerolled = p_owner->i_preroll_end != PREROLL_NONE;
     if( prerolled && p_owner->i_preroll_end > p_picture->date )
     {
         vlc_mutex_unlock( &p_owner->lock );
@@ -995,7 +999,7 @@ static int DecoderPlayVideo( struct decoder_owner *p_owner, picture_t *p_picture
         return VLC_SUCCESS;
     }
 
-    p_owner->i_preroll_end = (vlc_tick_t)INT64_MIN;
+    p_owner->i_preroll_end = PREROLL_NONE;
     vlc_mutex_unlock( &p_owner->lock );
 
     if( unlikely(prerolled) )
@@ -1119,7 +1123,7 @@ static int DecoderPlayAudio( struct decoder_owner *p_owner, block_t *p_audio )
     }
 
     vlc_mutex_lock( &p_owner->lock );
-    bool prerolled = p_owner->i_preroll_end != (vlc_tick_t)INT64_MIN;
+    bool prerolled = p_owner->i_preroll_end != PREROLL_NONE;
     if( prerolled && p_owner->i_preroll_end > p_audio->i_pts )
     {
         vlc_mutex_unlock( &p_owner->lock );
@@ -1127,7 +1131,7 @@ static int DecoderPlayAudio( struct decoder_owner *p_owner, block_t *p_audio )
         return VLC_SUCCESS;
     }
 
-    p_owner->i_preroll_end = (vlc_tick_t)INT64_MIN;
+    p_owner->i_preroll_end = PREROLL_NONE;
     vlc_mutex_unlock( &p_owner->lock );
 
     if( unlikely(prerolled) )
@@ -1452,7 +1456,7 @@ static void DecoderProcessFlush( struct decoder_owner *p_owner )
         }
     }
 
-    p_owner->i_preroll_end = (vlc_tick_t)INT64_MIN;
+    p_owner->i_preroll_end = PREROLL_NONE;
     vlc_mutex_unlock( &p_owner->lock );
 }
 
@@ -1750,7 +1754,7 @@ static struct decoder_owner * 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;



More information about the vlc-commits mailing list