On 05/11/17 11:21, Rémi Denis-Courmont wrote:
> libav generally uses int64_t to represent timestamps, and thus
> AV_NOPTS_VALUE has to fit witin the range of int64_t.
> 
> The current definition of AV_NOPTS_VALUE results in AV_NOPTS_VALUE
> having the same type as uint64_t, since its value is positive and
> cannot be represented by int64_t.
> 
> See also ISO C11 §6.4.4.1 clause 5.
> 
> This patch ensures that AV_NOPTS_VALUE is an int64_t, avoiding
> undefined overflowing conversion from uint64_t to int64_t.

<mostly-pointless-pedantry>
The overflowing conversion is implementation-defined, not undefined - see 
§6.3.1.3 clause 3.
</mostly-pointless-pedantry>

> ---
>  libavutil/avutil.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavutil/avutil.h b/libavutil/avutil.h
> index 2339fe3c9c..6f90043952 100644
> --- a/libavutil/avutil.h
> +++ b/libavutil/avutil.h
> @@ -238,7 +238,7 @@ enum AVMediaType {
>   * either pts or dts.
>   */
>  
> -#define AV_NOPTS_VALUE          INT64_C(0x8000000000000000)
> +#define AV_NOPTS_VALUE          INT64_MIN
>  
>  /**
>   * Internal time base represented as integer
> 

LGTM.

- Mark
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to