aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>2007-08-05 13:41:44 +0000
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>2007-08-05 13:41:44 +0000
commitfe4ff07aa0085e3db704b9aaa74fbf4d37b5c217 (patch)
tree74f6b81aafb770470146e1e2dae48e0b963842df
parent7ba32703dd4e371052e63915145e07192035cbba (diff)
downloadffmpeg-fe4ff07aa0085e3db704b9aaa74fbf4d37b5c217.tar.gz
fix decoding of adpcm swf big frames, fix RamboMJPEGAVP6_1Mbps.swf
Originally committed as revision 9946 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/adpcm.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 9111a7ac10..3a1260a529 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -1274,7 +1274,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
{
GetBitContext gb;
const int *table;
- int k0, signmask, nb_bits;
+ int k0, signmask, nb_bits, count;
int size = buf_size*8;
init_get_bits(&gb, buf, size);
@@ -1286,12 +1286,13 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
k0 = 1 << (nb_bits-2);
signmask = 1 << (nb_bits-1);
+ while (get_bits_count(&gb) <= size - 22*avctx->channels) {
for (i = 0; i < avctx->channels; i++) {
*samples++ = c->status[i].predictor = get_sbits(&gb, 16);
c->status[i].step_index = get_bits(&gb, 6);
}
- while (get_bits_count(&gb) < size)
+ for (count = 0; get_bits_count(&gb) <= size - nb_bits*avctx->channels && count < 4095; count++)
{
int i;
@@ -1327,6 +1328,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
}
}
}
+ }
src += buf_size;
break;
}