fail:  s->last_superframe_len = 0; return -1;
static int wma_decode_superframe(AVCodecContext *avctx,                                  void *data, int *data_size,                                 UINT8 *buf, int buf_size){    WMADecodeContext *s = avctx->priv_data;    int nb_frames, bit_offset, i, pos, len;    uint8_t *q;    int16_t *samples;        trace("***decode_superframe:\n");    samples = data;    init_get_bits(&s->gb, buf, buf_size);        if (s->use_bit_reservoir) {        /* read super frame header */        get_bits(&s->gb, 4); /* super frame index */        nb_frames = get_bits(&s->gb, 4) - 1;        bit_offset = get_bits(&s->gb, s->byte_offset_bits + 3);        if (s->last_superframe_len > 0) {            //        printf("skip=%d\n", s->last_bitoffset);            /* add bit_offset bits to last frame */            if ((s->last_superframe_len + ((bit_offset + 7) >> 3)) >                 MAX_CODED_SUPERFRAME_SIZE)                return -1;            q = s->last_superframe + s->last_superframe_len;            len = bit_offset;            while (len > 0) {                *q++ = (get_bits)(&s->gb, 8);                len -= 8;            }            if (len > 0) {                *q++ = (get_bits)(&s->gb, len) << (8 - len);            }                        /* XXX: bit_offset bits into last frame */            init_get_bits(&s->gb, s->last_superframe, MAX_CODED_SUPERFRAME_SIZE);            /* skip unused bits */            if (s->last_bitoffset > 0)                skip_bits(&s->gb, s->last_bitoffset);            /* this frame is stored in the last superframe and in the               current one */            if (wma_decode_frame(s, samples) < 0)                return -1;            samples += s->nb_channels * s->frame_len;        }        /* read each frame starting from bit_offset */        pos = bit_offset + 4 + 4 + s->byte_offset_bits + 3;        init_get_bits(&s->gb, buf + (pos >> 3), MAX_CODED_SUPERFRAME_SIZE - (pos >> 3));        len = pos & 7;        if (len > 0)            skip_bits(&s->gb, len);            s->reset_block_lengths = 1;        for(i=0;i<nb_frames;i++) {            if (wma_decode_frame(s, samples) < 0)                return -1;            samples += s->nb_channels * s->frame_len;        }        /* we copy the end of the frame in the last frame buffer */        pos = get_bits_count(&s->gb) + ((bit_offset + 4 + 4 + s->byte_offset_bits + 3) & ~7);        s->last_bitoffset = pos & 7;        pos >>= 3;        len = buf_size - pos;        if (len > MAX_CODED_SUPERFRAME_SIZE || len < 0) {            return -1;        }        s->last_superframe_len = len;        memcpy(s->last_superframe, buf + pos, len);    } else {        /* single frame decode */        if (wma_decode_frame(s, samples) < 0)            return -1;        samples += s->nb_channels * s->frame_len;    }    *data_size = (int8_t *)samples - (int8_t *)data;    return s->block_align;}