[vlc-devel] [PATCH 11/11] decoder: use defines for the unset/forced preroll values
Steve Lhomme
robux4 at ycbcr.xyz
Fri Aug 30 07:55:48 CEST 2019
---
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 6dafc8e0e2..a670f928db 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 ((vlc_tick_t) INT64_MIN)
+#define PREROLL_FORCED ((vlc_tick_t) INT64_MAX)
+
/* 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 )
@@ -985,7 +989,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 );
@@ -993,7 +997,7 @@ static int DecoderPlayVideo( struct decoder_owner *p_owner, picture_t *p_picture
return VLC_EGENERIC;
}
- p_owner->i_preroll_end = (vlc_tick_t)INT64_MIN;
+ p_owner->i_preroll_end = PREROLL_NONE;
if( unlikely(prerolled) )
{
@@ -1122,7 +1126,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 );
@@ -1130,7 +1134,7 @@ static int DecoderPlayAudio( struct decoder_owner *p_owner, block_t *p_audio )
return VLC_EGENERIC;
}
- p_owner->i_preroll_end = (vlc_tick_t)INT64_MIN;
+ p_owner->i_preroll_end = PREROLL_NONE;
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;
--
2.17.1
More information about the vlc-devel
mailing list