lavf: Avoid setting avg_frame_rate if delta_dts is negative
authorMartin Storsjö <martin@martin.st>
Fri, 20 Sep 2013 09:20:06 +0000 (12:20 +0300)
committerMartin Storsjö <martin@martin.st>
Sun, 22 Sep 2013 18:02:52 +0000 (21:02 +0300)
This avoids setting avg_frame_rate to invalid (negative)
values.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
libavformat/utils.c

index 22f6d01..0700c5d 100644 (file)
@@ -2373,7 +2373,8 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
                 double best_error = 0.01;
 
                 if (delta_dts     >= INT64_MAX / st->time_base.num ||
-                    delta_packets >= INT64_MAX / st->time_base.den)
+                    delta_packets >= INT64_MAX / st->time_base.den ||
+                    delta_dts < 0)
                     continue;
                 av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den,
                           delta_packets*(int64_t)st->time_base.den,