]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/decode.c
avcodec/decode: set best_effort_timestamp on output frames for all decoders
[ffmpeg] / libavcodec / decode.c
index 5a1849f9448f4872390927e896fa4f530797e75a..d804b0bed0c6d21fb0dc2f7173cf2303bfd9efba 100644 (file)
@@ -372,10 +372,6 @@ static inline int decode_simple_internal(AVCodecContext *avctx, AVFrame *frame,
     if (avctx->codec->type == AVMEDIA_TYPE_VIDEO) {
         if (frame->flags & AV_FRAME_FLAG_DISCARD)
             got_frame = 0;
-        if (got_frame)
-            frame->best_effort_timestamp = guess_correct_pts(avctx,
-                                                             frame->pts,
-                                                             frame->pkt_dts);
     } else if (avctx->codec->type == AVMEDIA_TYPE_AUDIO) {
         uint8_t *side;
         int side_size;
@@ -384,9 +380,6 @@ static inline int decode_simple_internal(AVCodecContext *avctx, AVFrame *frame,
         uint8_t discard_reason = 0;
 
         if (ret >= 0 && got_frame) {
-            frame->best_effort_timestamp = guess_correct_pts(avctx,
-                                                             frame->pts,
-                                                             frame->pkt_dts);
             if (frame->format == AV_SAMPLE_FMT_NONE)
                 frame->format = avctx->sample_fmt;
             if (!frame->channel_layout)
@@ -579,6 +572,10 @@ static int decode_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)
         avci->draining_done = 1;
 
     if (!ret) {
+        frame->best_effort_timestamp = guess_correct_pts(avctx,
+                                                         frame->pts,
+                                                         frame->pkt_dts);
+
         /* the only case where decode data is not set should be decoders
          * that do not call ff_get_buffer() */
         av_assert0((frame->private_ref && frame->private_ref->size == sizeof(FrameDecodeData)) ||