[FFmpeg-devel] [PATCH 2/3] libavcodec/v4l2_buffers: check for valid pts value

wm4 nfxjfg at googlemail.com
Tue Jan 9 01:46:17 EET 2018


On Mon,  8 Jan 2018 15:27:38 -0800
Lukas Rusak <lorusak at gmail.com> wrote:

> we check for a valid pts in v4l2_set_pts so we should do the same here
> 
> ---
>  libavcodec/v4l2_buffers.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c
> index fdafe7edca..5337f6f287 100644
> --- a/libavcodec/v4l2_buffers.c
> +++ b/libavcodec/v4l2_buffers.c
> @@ -71,7 +71,10 @@ static inline int64_t v4l2_get_pts(V4L2Buffer *avbuf)
>      /* convert pts back to encoder timebase */
>      v4l2_pts = avbuf->buf.timestamp.tv_sec * USEC_PER_SEC + avbuf->buf.timestamp.tv_usec;
>  
> -    return av_rescale_q(v4l2_pts, v4l2_timebase, s->avctx->time_base);
> +    if (v4l2_pts == 0)
> +        return AV_NOPTS_VALUE;
> +    else
> +        return av_rescale_q(v4l2_pts, v4l2_timebase, s->avctx->time_base);
>  }
>  
>  static enum AVColorPrimaries v4l2_get_color_primaries(V4L2Buffer *buf)

So, what about pts=0, which is valid? You shouldn't just turn 0 into
AV_NOPTS_VALUE.


More information about the ffmpeg-devel mailing list