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

Michael Niedermayer git at videolan.org
Fri Aug 26 15:40:56 EEST 2016


ffmpeg | branch: release/2.8 | Michael Niedermayer <michael at niedermayer.cc> | Mon May 16 13:43:02 2016 +0200| [2e0af764b32f76859d6b441812e2e2c9b5c1bed3] | 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>
(cherry picked from commit 635b2ec5f20d6cdef1adf4907ca28f8f09abcecc)

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

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

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

diff --git a/libavformat/utils.c b/libavformat/utils.c
index d40ae64..d638ace 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2372,7 +2372,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