Commit ddd86a29 authored by Michael Niedermayer's avatar Michael Niedermayer

ffmpeg: Fix division by 0 due to invalid timebase

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 539a8469
...@@ -2269,7 +2269,7 @@ static int output_packet(InputStream *ist, ...@@ -2269,7 +2269,7 @@ static int output_packet(InputStream *ist,
ret = transcode_video (ist, &avpkt, &got_output, &pkt_pts); ret = transcode_video (ist, &avpkt, &got_output, &pkt_pts);
if (avpkt.duration) { if (avpkt.duration) {
duration = av_rescale_q(avpkt.duration, ist->st->time_base, AV_TIME_BASE_Q); duration = av_rescale_q(avpkt.duration, ist->st->time_base, AV_TIME_BASE_Q);
} else if(ist->st->codec->time_base.num != 0) { } else if(ist->st->codec->time_base.num != 0 && ist->st->codec->time_base.den != 0) {
int ticks= ist->st->parser ? ist->st->parser->repeat_pict+1 : ist->st->codec->ticks_per_frame; int ticks= ist->st->parser ? ist->st->parser->repeat_pict+1 : ist->st->codec->ticks_per_frame;
duration = ((int64_t)AV_TIME_BASE * duration = ((int64_t)AV_TIME_BASE *
ist->st->codec->time_base.num * ticks) / ist->st->codec->time_base.num * ticks) /
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment