[libav-devel] [PATCH] avutil: make AV_NOPTS_VALUE signed negative

Vittorio Giovara vittorio.giovara at gmail.com
Mon Nov 6 01:38:36 CET 2017


On Sun, Nov 5, 2017 at 6:21 AM, Rémi Denis-Courmont <remi at remlab.net> 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.
> ---
>  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
> --
>

is a version bump necessary for this change?
-- 
Vittorio


More information about the libav-devel mailing list