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

Steve Lhomme robux4 at ycbcr.xyz
Tue Aug 27 10:28:01 CEST 2019


I'd like the create VLC_TICK_INFINITE_PAST and VLC_TICK_INFINITE_FUTURE 
then we could just use that.

OK with that ?

On 2019-08-27 10:26, Rémi Denis-Courmont wrote:
> Hi,
> 
> Not a huge fan of macros that look like constants but aren't. Maybe remove useless cast.
> 
> Le 27 août 2019 08:27:16 GMT+03:00, Steve Lhomme <robux4 at ycbcr.xyz> a écrit :
>> ---
>> 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
>>
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
> 
> -- 
> Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
> 
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
> 


More information about the vlc-devel mailing list