utils/update_stream_timings: fix division by zero
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 10 Sep 2012 14:57:31 +0000 (16:57 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 10 Sep 2012 14:57:31 +0000 (16:57 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/utils.c

index 0ea8787..948fdcf 100644 (file)
@@ -2101,7 +2101,7 @@ static void update_stream_timings(AVFormatContext *ic)
         if (end_time != INT64_MIN)
             duration = FFMAX(duration, end_time - start_time);
     }
-    if (duration != INT64_MIN && ic->duration == AV_NOPTS_VALUE) {
+    if (duration != INT64_MIN && duration > 0 && ic->duration == AV_NOPTS_VALUE) {
         ic->duration = duration;
     }
         if (ic->pb && (filesize = avio_size(ic->pb)) > 0 && ic->duration != AV_NOPTS_VALUE) {