diff options
author | Anton Khirnov <anton@khirnov.net> | 2023-04-26 15:08:54 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2023-05-15 10:57:19 +0200 |
commit | 989e87b03ce6a03b288f8049dbe11a4083929747 (patch) | |
tree | 23f0993f749205060e1fc303e1407bad54c27bc7 | |
parent | 0d25b404d43cacfa6244f391da49ead9ff97bedf (diff) | |
download | ffmpeg-989e87b03ce6a03b288f8049dbe11a4083929747.tar.gz |
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.
-rw-r--r-- | fftools/ffmpeg.c | 6 |
1 files 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); |