diff libmpcodecs/ad_libmad.c @ 34741:6cfaa555bec1

libmad: set i_bps only if it is not already set. Since that value is only based on the very first MP3 frame, it is very likely to be much less accurate than any existing value from a demuxer. Patch by Benot Thbaudeau. Signed-off-by: "Benot Thbaudeau" <benoit.thebaudeau@advansee.com>
author reimar
date Sat, 24 Mar 2012 19:22:16 +0000
parents 0eb4c719ca0c
children 83d0141a1cdc
line wrap: on
line diff
--- a/libmpcodecs/ad_libmad.c	Sat Mar 24 19:19:48 2012 +0000
+++ b/libmpcodecs/ad_libmad.c	Sat Mar 24 19:22:16 2012 +0000
@@ -100,7 +100,8 @@
 
   sh->channels=(this->frame.header.mode == MAD_MODE_SINGLE_CHANNEL) ? 1 : 2;
   sh->samplerate=this->frame.header.samplerate;
-  sh->i_bps=this->frame.header.bitrate/8;
+  if (sh->i_bps < 1)
+    sh->i_bps=this->frame.header.bitrate/8;
   sh->samplesize=2;
 
   return 1;