changeset 5494:c2512a13877e libavcodec

fix decoding of adpcm swf big frames, fix RamboMJPEGAVP6_1Mbps.swf
author bcoudurier
date Sun, 05 Aug 2007 13:41:44 +0000
parents 80b481ec72a6
children 15c6ea63cb62
files adpcm.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/adpcm.c	Sun Aug 05 12:11:34 2007 +0000
+++ b/adpcm.c	Sun Aug 05 13:41:44 2007 +0000
@@ -1274,7 +1274,7 @@
     {
         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 @@
         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 @@
                 }
             }
         }
+        }
         src += buf_size;
         break;
     }