mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
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.
This commit is contained in:
parent
0d25b404d4
commit
989e87b03c
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user