diff options
author | James Almer <jamrial@gmail.com> | 2020-12-12 21:37:53 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2020-12-13 12:14:57 -0300 |
commit | 4bff800dc9d238dee58049704768aa6c5c391ab2 (patch) | |
tree | 6dedecc004b063db6ef8a66d6eb033cc0984bef0 /libavcodec/decode.c | |
parent | bf4b9e933fbd01591bb75e8adf54b8d6d19273f1 (diff) | |
download | ffmpeg-4bff800dc9d238dee58049704768aa6c5c391ab2.tar.gz |
avcodec/decode: set best_effort_timestamp on output frames for all decoders
Fixes a decoding regression introduced by e9a2a87773, and as a side effect also
fixes bogus values set to certain audio frames that had some samples discarded,
where the offsets added to pts, pkt_dts and pkt_duration were not reflected in
best_effort_timestamp.
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/decode.c')
-rw-r--r-- | libavcodec/decode.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 5a1849f944..d804b0bed0 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -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)) || |