[FFmpeg-cvslog] fftools/ffmpeg: stop using decoder properties in ist_dts_update()
Anton Khirnov
git at videolan.org
Mon May 15 15:16:13 EEST 2023
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Wed Apr 26 15:08:54 2023 +0200| [989e87b03ce6a03b288f8049dbe11a4083929747] | committer: Anton Khirnov
fftools/ffmpeg: stop using decoder properties in ist_dts_update()
This code runs post-demuxing and is not synchronized with the decoder
output (which may be delayed with respect to its input by arbitrary and
unknowable amounts), so accessing any decoder properties is incorrect.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=989e87b03ce6a03b288f8049dbe11a4083929747
---
fftools/ffmpeg.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 817b643c48..ca6ff780c3 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1856,7 +1856,7 @@ static void ist_dts_update(InputStream *ist, AVPacket *pkt)
if (!ist->saw_first_ts) {
ist->first_dts =
- ist->dts = ist->st->avg_frame_rate.num ? - ist->dec_ctx->has_b_frames * AV_TIME_BASE / av_q2d(ist->st->avg_frame_rate) : 0;
+ ist->dts = ist->st->avg_frame_rate.num ? - ist->par->video_delay * AV_TIME_BASE / av_q2d(ist->st->avg_frame_rate) : 0;
if (pkt->pts != AV_NOPTS_VALUE) {
ist->first_dts =
ist->dts += av_rescale_q(pkt->pts, pkt->time_base, AV_TIME_BASE_Q);
@@ -1889,11 +1889,11 @@ static void ist_dts_update(InputStream *ist, AVPacket *pkt)
ist->next_dts = av_rescale_q(next_dts + 1, av_inv_q(ist->framerate), time_base_q);
} else if (pkt->duration) {
ist->next_dts += av_rescale_q(pkt->duration, pkt->time_base, AV_TIME_BASE_Q);
- } else if(ist->dec_ctx->framerate.num != 0) {
+ } else if (ist->par->framerate.num != 0) {
int fields = (ist->codec_desc &&
(ist->codec_desc->props & AV_CODEC_PROP_FIELDS)) ?
ist->last_pkt_repeat_pict + 1 : 2;
- AVRational field_rate = av_mul_q(ist->dec_ctx->framerate,
+ AVRational field_rate = av_mul_q(ist->par->framerate,
(AVRational){ 2, 1 });
ist->next_dts += av_rescale_q(fields, av_inv_q(field_rate), AV_TIME_BASE_Q);
More information about the ffmpeg-cvslog
mailing list