lavf: Dont compare absolute to relative timestamps in duration gcd
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 9 Nov 2012 13:54:43 +0000 (14:54 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 9 Nov 2012 13:59:43 +0000 (14:59 +0100)
This prevents a division by 0

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/utils.c

index 1c5614f..0240b0c 100644 (file)
@@ -2729,7 +2729,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
                 }
                 st->info->duration_count++;
                 // 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);
             }
             if (pkt->dts != AV_NOPTS_VALUE)