lavf: Dont compare absolute to relative timestamps in duration gcd

This prevents a division by 0

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-11-09 14:54:43 +01:00
parent 4c6e7c2d4d
commit 7ec1fe1f47
1 changed files with 1 additions and 1 deletions

View File

@ -2729,7 +2729,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
} }
st->info->duration_count++; st->info->duration_count++;
// ignore the first 4 values, they might have some random jitter // ignore the first 4 values, they might have some random jitter
if (st->info->duration_count > 3) if (st->info->duration_count > 3 && is_relative(pkt->dts) == is_relative(last))
st->info->duration_gcd = av_gcd(st->info->duration_gcd, duration); st->info->duration_gcd = av_gcd(st->info->duration_gcd, duration);
} }
if (pkt->dts != AV_NOPTS_VALUE) if (pkt->dts != AV_NOPTS_VALUE)