utils: fix rounding of micro seconds
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 31 Oct 2012 17:48:58 +0000 (18:48 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 31 Oct 2012 18:12:47 +0000 (19:12 +0100)
Found-by: Johan Wessfeldt <johan.wessfeldt@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/utils.c

index fb5742b..3171b21 100644 (file)
@@ -3354,8 +3354,9 @@ void av_dump_format(AVFormatContext *ic,
         av_log(NULL, AV_LOG_INFO, "  Duration: ");
         if (ic->duration != AV_NOPTS_VALUE) {
             int hours, mins, secs, us;
-            secs = ic->duration / AV_TIME_BASE;
-            us = ic->duration % AV_TIME_BASE;
+            int64_t duration = ic->duration + 5000;
+            secs = duration / AV_TIME_BASE;
+            us = duration % AV_TIME_BASE;
             mins = secs / 60;
             secs %= 60;
             hours = mins / 60;