summaryrefslogtreecommitdiff
path: root/libavformat/mp3dec.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat/mp3dec.c')
-rw-r--r--libavformat/mp3dec.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 7d0c2fb6ed..48deefd126 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -128,6 +128,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base)
const int64_t xing_offtbl[2][2] = {{32, 17}, {17,9}};
MPADecodeHeader c;
int vbrtag_size = 0;
+ int is_cbr;
v = avio_rb32(s->pb);
if(ff_mpa_check_header(v) < 0)
@@ -143,7 +144,8 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base)
/* Check for Xing / Info tag */
avio_skip(s->pb, xing_offtbl[c.lsf == 1][c.nb_channels == 1]);
v = avio_rb32(s->pb);
- if(v == MKBETAG('X', 'i', 'n', 'g') || v == MKBETAG('I', 'n', 'f', 'o')) {
+ is_cbr = v == MKBETAG('I', 'n', 'f', 'o');
+ if (v == MKBETAG('X', 'i', 'n', 'g') || is_cbr) {
v = avio_rb32(s->pb);
if(v & XING_FLAG_FRAMES)
frames = avio_rb32(s->pb);
@@ -176,7 +178,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base)
if(frames)
st->duration = av_rescale_q(frames, (AVRational){spf, c.sample_rate},
st->time_base);
- if(size && frames)
+ if (size && frames && !is_cbr)
st->codec->bit_rate = av_rescale(size, 8 * c.sample_rate, frames * (int64_t)spf);
return 0;