pcm-mpeg: correct bitrate calculation
authorChristian Schmidt <schmidt@digadd.de>
Tue, 16 Oct 2012 13:40:58 +0000 (15:40 +0200)
committerLuca Barbato <lu_zero@gentoo.org>
Tue, 16 Oct 2012 14:03:03 +0000 (16:03 +0200)
Bitrate calculation is off since the bluray spec always specifies
an even number of coded channels. This was honored in the decoder,
but not for bitrate calculation.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
libavcodec/pcm-mpeg.c

index 4a38648..b5af649 100644 (file)
@@ -109,12 +109,12 @@ static int pcm_bluray_parse_header(AVCodecContext *avctx,
         return -1;
     }
 
-    avctx->bit_rate = avctx->channels * avctx->sample_rate *
+    avctx->bit_rate = FFALIGN(avctx->channels, 2) * avctx->sample_rate *
                       avctx->bits_per_coded_sample;
 
     if (avctx->debug & FF_DEBUG_PICT_INFO)
         av_dlog(avctx,
-                "pcm_bluray_parse_header: %d channels, %d bits per sample, %d kHz, %d kbit\n",
+                "pcm_bluray_parse_header: %d channels, %d bits per sample, %d Hz, %d bit/s\n",
                 avctx->channels, avctx->bits_per_coded_sample,
                 avctx->sample_rate, avctx->bit_rate);
     return 0;