[FFmpeg-cvslog] lavc: set best effort timestamp if unset when using new decode API

wm4 git at videolan.org
Wed Oct 5 12:36:20 EEST 2016


ffmpeg | branch: master | wm4 <nfxjfg at googlemail.com> | Wed Oct  5 11:35:54 2016 +0200| [40fbf3204208f89a0626f85ce6dd06ca0741583b] | committer: wm4

lavc: set best effort timestamp if unset when using new decode API

Some API users (in particular ffmpeg.c) check the best effort timestamp
only.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=40fbf3204208f89a0626f85ce6dd06ca0741583b
---

 libavcodec/utils.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 6f4df93..1239d49 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2870,7 +2870,14 @@ int attribute_align_arg avcodec_receive_frame(AVCodecContext *avctx, AVFrame *fr
     if (avctx->codec->receive_frame) {
         if (avctx->internal->draining && !(avctx->codec->capabilities & AV_CODEC_CAP_DELAY))
             return AVERROR_EOF;
-        return avctx->codec->receive_frame(avctx, frame);
+        ret = avctx->codec->receive_frame(avctx, frame);
+        if (ret >= 0) {
+            if (av_frame_get_best_effort_timestamp(frame) == AV_NOPTS_VALUE) {
+                av_frame_set_best_effort_timestamp(frame,
+                    guess_correct_pts(avctx, frame->pkt_pts, frame->pkt_dts));
+            }
+        }
+        return ret;
     }
 
     // Emulation via old API.



More information about the ffmpeg-cvslog mailing list