1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2026-06-19 19:03:00 +02:00

avcodec/decode: reset PTS correction counters in ff_decode_flush_buffers

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 <bogdan@pydevsolutions.com>
This commit is contained in:
Bogdan Lisman
2026-06-15 01:15:57 +03:00
committed by James Almer
parent 491e0d1cfb
commit d69e8d0a95
+2
View File
@@ -2364,6 +2364,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;