changeset 10165:b30c708ce76a libavcodec

reinit get_bits for every decode_packet call
author faust3
date Fri, 11 Sep 2009 15:59:27 +0000
parents 944071b6fcb4
children e91ff9368e06
files wmaprodec.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/wmaprodec.c	Fri Sep 11 06:25:36 2009 +0000
+++ b/wmaprodec.c	Fri Sep 11 15:59:27 2009 +0000
@@ -190,6 +190,7 @@
 
     /* packet decode state */
     GetBitContext    pgb;                           ///< bitstream reader context for the packet
+    uint8_t          packet_offset;                 ///< frame offset in the packet
     uint8_t          packet_sequence_number;        ///< current packet number
     int              num_saved_bits;                ///< saved number of bits
     int              frame_offset;                  ///< frame offset in the bit reservoir
@@ -1502,6 +1503,9 @@
 
     } else {
         int frame_size;
+        s->buf_bit_size = avpkt->size << 3;
+        init_get_bits(gb, avpkt->data, s->buf_bit_size);
+        skip_bits(gb, s->packet_offset);
         if (remaining_bits(s, gb) > s->log2_frame_size &&
             (frame_size = show_bits(gb, s->log2_frame_size)) &&
             frame_size <= remaining_bits(s, gb)) {
@@ -1519,8 +1523,9 @@
     }
 
     *data_size = (int8_t *)s->samples - (int8_t *)data;
+    s->packet_offset = get_bits_count(gb) & 7;
 
-    return (!s->packet_done && !s->packet_loss)?0: avctx->block_align;
+    return get_bits_count(gb) >> 3;
 }
 
 /**