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

Lukas Rusak lorusak at gmail.com
Tue Jan 9 01:27:38 EET 2018


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)
-- 
2.14.3



More information about the ffmpeg-devel mailing list