[FFmpeg-cvslog] avformat/utils: Do not compute the bitrate from duration == 0

Michael Niedermayer git at videolan.org
Mon May 16 15:25:31 CEST 2016


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Mon May 16 13:43:02 2016 +0200| [635b2ec5f20d6cdef1adf4907ca28f8f09abcecc] | committer: Michael Niedermayer

avformat/utils: Do not compute the bitrate from duration == 0

Fixes division by 0 in fate-acodec-ra144

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=635b2ec5f20d6cdef1adf4907ca28f8f09abcecc
---

 libavformat/utils.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 774a2ba..5f5f03e 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2529,7 +2529,7 @@ static void update_stream_timings(AVFormatContext *ic)
     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) {
+    if (ic->pb && (filesize = avio_size(ic->pb)) > 0 && ic->duration > 0) {
         /* compute the bitrate */
         double bitrate = (double) filesize * 8.0 * AV_TIME_BASE /
                          (double) ic->duration;



More information about the ffmpeg-cvslog mailing list