[FFmpeg-devel] [PATCH] libavformat: Fix rounding error

Johan Wessfeldt johan.wessfeldt at gmail.com
Wed Oct 31 16:52:15 CET 2012


This patch fixes a rounding error when printing
the micro seconds part of the duration.

Signed-off-by: Johan Wessfeldt <johan.wessfeldt at gmail.com>
---
 libavformat/utils.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index fb5742b..c81b641 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3361,7 +3361,7 @@ void av_dump_format(AVFormatContext *ic,
             hours = mins / 60;
             mins %= 60;
             av_log(NULL, AV_LOG_INFO, "%02d:%02d:%02d.%02d", hours, mins, secs,
-                   (100 * us) / AV_TIME_BASE);
+                   (int)( (100.0f * us) / AV_TIME_BASE + 0.5f) );
         } else {
             av_log(NULL, AV_LOG_INFO, "N/A");
         }
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list