summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAman Gupta <aman@tmm1.net>2019-08-30 15:42:00 -0700
committerAman Gupta <aman@tmm1.net>2019-09-11 10:28:56 -0700
commit3475758a3791dc89c6e7c406f8b032f035cd7d1e (patch)
treec428cfe43d5313cabd0db027712659bec845c133
parent8dc973dc89194d536425f7042b90bb6d3808be23 (diff)
avcodec/v4l2_m2m_dec: set pkt_dts on decoded frames to NOPTS
Without this ffmpeg will attempt to copy the dts from the most recently enqueued packet into the most recently dequeued frame, which does not account for the buffering inside v4l2 and is not accurate. Signed-off-by: Aman Gupta <aman@tmm1.net>
-rw-r--r--libavcodec/v4l2_buffers.c1
-rw-r--r--libavcodec/v4l2_m2m_dec.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c
index 0726dc121b..46c9f11d7b 100644
--- a/libavcodec/v4l2_buffers.c
+++ b/libavcodec/v4l2_buffers.c
@@ -420,6 +420,7 @@ int ff_v4l2_buffer_buf_to_avframe(AVFrame *frame, V4L2Buffer *avbuf)
frame->color_range = v4l2_get_color_range(avbuf);
frame->color_trc = v4l2_get_color_trc(avbuf);
frame->pts = v4l2_get_pts(avbuf);
+ frame->pkt_dts = AV_NOPTS_VALUE;
/* these two values are updated also during re-init in v4l2_process_driver_event */
frame->height = avbuf->context->height;
diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c
index fb2bfde714..a3744208f3 100644
--- a/libavcodec/v4l2_m2m_dec.c
+++ b/libavcodec/v4l2_m2m_dec.c
@@ -242,6 +242,7 @@ static const AVOption options[] = {
.close = v4l2_decode_close, \
.bsfs = bsf_name, \
.capabilities = AV_CODEC_CAP_HARDWARE | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING, \
+ .caps_internal = FF_CODEC_CAP_SETS_PKT_DTS, \
.wrapper_name = "v4l2m2m", \
};