From f156dc54f8c285ec2f11cd9cc7e2e0d7c510cb04 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 14 Mar 2013 04:41:26 +0100 Subject: [PATCH] mpegaudio_parser: fix off by 1 error See: commit 29d8cd265a536063420afe78375b2176a9e1abc5 Author: Alexander Kojevnikov Date: Tue Feb 26 21:47:11 2013 -0800 mp3dec: Fix VBR bit rate parsing When parsing the Xing/Info tag, don't set the bit rate if it's an Info tag. When parsing the stream, don't override the bit rate if it's already set, otherwise calculate the mean bit rate from parsed frames. This way, the bit rate will be set correctly both for CBR and VBR streams. Signed-off-by: Alexander Kojevnikov Signed-off-by: Michael Niedermayer Signed-off-by: Michael Niedermayer --- libavcodec/mpegaudio_parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mpegaudio_parser.c b/libavcodec/mpegaudio_parser.c index f592d5a0ae..408193671f 100644 --- a/libavcodec/mpegaudio_parser.c +++ b/libavcodec/mpegaudio_parser.c @@ -78,7 +78,7 @@ static int mpegaudio_parse(AVCodecParserContext *s1, s->header_count++; s->frame_size = ret-4; - if (s->header_count > 1) { + if (s->header_count > 0) { avctx->sample_rate= sr; avctx->channels = channels; s1->duration = frame_size;