diff options
author | Alexander Kojevnikov <alexander@kojevnikov.com> | 2013-03-06 21:38:55 -0800 |
---|---|---|
committer | Reinhard Tartler <siretart@tauware.de> | 2013-03-09 18:01:09 +0100 |
commit | d3b40af01f88aeb19f3400956fefa0e324ef5e2e (patch) | |
tree | e1de0989a8be725a4caea124c57bcec9ae5a82ac /libavcodec | |
parent | 60dd8b5733f9ec4919fbc732ace1be8184dde880 (diff) | |
download | ffmpeg-d3b40af01f88aeb19f3400956fefa0e324ef5e2e.tar.gz |
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.
CC:libav-stable@libav.org
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit eae0879d961b78717dd2a0899809ad22819ae9e3)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/mpegaudio_parser.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libavcodec/mpegaudio_parser.c b/libavcodec/mpegaudio_parser.c index c904873a18..58ea452773 100644 --- a/libavcodec/mpegaudio_parser.c +++ b/libavcodec/mpegaudio_parser.c @@ -30,6 +30,7 @@ typedef struct MpegAudioParseContext { int frame_size; uint32_t header; int header_count; + int no_bitrate; } MpegAudioParseContext; #define MPA_HEADER_SIZE 4 @@ -80,7 +81,10 @@ static int mpegaudio_parse(AVCodecParserContext *s1, avctx->sample_rate= sr; avctx->channels = channels; s1->duration = frame_size; - avctx->bit_rate = bit_rate; + if (s->no_bitrate || !avctx->bit_rate) { + s->no_bitrate = 1; + avctx->bit_rate += (bit_rate - avctx->bit_rate) / s->header_count; + } } break; } |