aiffdec: do not set bit rate if block duration is unknown

Message ID 20120322154604.CC2BB5E0A3@aruru.libav.org
State New
Headers show

Commit Message

Janne Grunau March 22, 2012, 3:46 p.m.
Module: libav
Branch: master
Commit: 02f88eec1d9069ab6bb6c4177471226186647a8f

Author:    Justin Ruggles <justin.ruggles@gmail.com>
Committer: Justin Ruggles <justin.ruggles@gmail.com>
Date:      Wed Mar 21 14:30:33 2012 -0400

aiffdec: do not set bit rate if block duration is unknown

CC: libav-stable@libav.org

---

 libavformat/aiffdec.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

Patch

diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c
index 11bbcac..bbac1ab 100644
--- a/libavformat/aiffdec.c
+++ b/libavformat/aiffdec.c
@@ -157,8 +157,10 @@  static unsigned int get_aiff_header(AVFormatContext *s, int size,
     if (!codec->block_align)
         codec->block_align = (codec->bits_per_coded_sample * codec->channels) >> 3;
 
-    codec->bit_rate = codec->sample_rate * (codec->block_align << 3) /
-                      aiff->block_duration;
+    if (aiff->block_duration) {
+        codec->bit_rate = codec->sample_rate * (codec->block_align << 3) /
+                          aiff->block_duration;
+    }
 
     /* Chunk is over */
     if (size)