pts_correction_num_faulty_pts and pts_correction_num_faulty_dts were not cleared by ff_decode_flush_buffers(), so they survived avcodec_flush_buffers(). After a seek, guess_correct_pts() therefore kept biasing its reordered-pts vs dts choice on pre-seek history instead of starting fresh as it does after ff_decode_preinit(), which already zeroes both counters. This could yield an incorrect AVFrame.best_effort_timestamp on the frames following a seek.
Reset both counters on flush, next to the existing last_pts/last_dts reset, so the decoder's timestamp-correction state is fully reinitialized. Fixes: ticket #11645 Reported-by: keks51 Signed-off-by: Bogdan Lisman <[email protected]> --- libavcodec/decode.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/decode.c b/libavcodec/decode.c index a18b99e115..f2cbc33a73 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -2362,6 +2362,8 @@ av_cold void ff_decode_flush_buffers(AVCodecContext *avctx) av_packet_unref(avci->last_pkt_props); av_packet_unref(avci->in_pkt); + dc->pts_correction_num_faulty_pts = + dc->pts_correction_num_faulty_dts = 0; dc->pts_correction_last_pts = dc->pts_correction_last_dts = INT64_MIN; -- 2.43.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
