aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mpegaudiodec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2007-02-03 12:42:12 +0000
committerMichael Niedermayer <michaelni@gmx.at>2007-02-03 12:42:12 +0000
commite0cf92048acd76e3364e551b6ae646929280d994 (patch)
tree3bc684a4f3b10108fba37e956d99b0e0dae10beb /libavcodec/mpegaudiodec.c
parentf0a85d5f5cb3f4c5d41529f5042cdf168fc8d937 (diff)
downloadffmpeg-e0cf92048acd76e3364e551b6ae646929280d994.tar.gz
fix decoding of takethat.mp3
Originally committed as revision 7812 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpegaudiodec.c')
-rw-r--r--libavcodec/mpegaudiodec.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c
index 367400581c..998efb85eb 100644
--- a/libavcodec/mpegaudiodec.c
+++ b/libavcodec/mpegaudiodec.c
@@ -1747,9 +1747,9 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g,
s_index+=4;
}
/* skip extension bits */
- bits_left = end_pos - get_bits_count(&s->gb);
+ bits_left = end_pos2 - get_bits_count(&s->gb);
//av_log(NULL, AV_LOG_ERROR, "left:%d buf:%p\n", bits_left, s->in_gb.buffer);
- if (bits_left < 0 || bits_left > 500) {
+ if (bits_left < 0/* || bits_left > 500*/) {
av_log(NULL, AV_LOG_ERROR, "bits_left=%d\n", bits_left);
s_index=0;
}else if(bits_left > 0 && s->error_resilience >= FF_ER_AGGRESSIVE){
@@ -1759,6 +1759,14 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g,
memset(&g->sb_hybrid[s_index], 0, sizeof(*g->sb_hybrid)*(576 - s_index));
skip_bits_long(&s->gb, bits_left);
+ i= get_bits_count(&s->gb);
+ if(s->in_gb.buffer && i >= s->gb.size_in_bits){
+ s->gb= s->in_gb;
+ s->in_gb.buffer=NULL;
+ assert((get_bits_count(&s->gb) & 7) == 0);
+ skip_bits_long(&s->gb, i - end_pos);
+ }
+
return 0;
}