Revision 2f62e147

View differences:

libavcodec/wmadec.c
1240 1240
            /* add bit_offset bits to last frame */
1241 1241
            if ((s->last_superframe_len + ((bit_offset + 7) >> 3)) > 
1242 1242
                MAX_CODED_SUPERFRAME_SIZE)
1243
                return -1;
1243
                goto fail;
1244 1244
            q = s->last_superframe + s->last_superframe_len;
1245 1245
            len = bit_offset;
1246 1246
            while (len > 0) {
......
1259 1259
            /* this frame is stored in the last superframe and in the
1260 1260
               current one */
1261 1261
            if (wma_decode_frame(s, samples) < 0)
1262
                return -1;
1262
                goto fail;
1263 1263
            samples += s->nb_channels * s->frame_len;
1264 1264
        }
1265 1265

  
......
1273 1273
        s->reset_block_lengths = 1;
1274 1274
        for(i=0;i<nb_frames;i++) {
1275 1275
            if (wma_decode_frame(s, samples) < 0)
1276
                return -1;
1276
                goto fail;
1277 1277
            samples += s->nb_channels * s->frame_len;
1278 1278
        }
1279 1279

  
......
1283 1283
        pos >>= 3;
1284 1284
        len = buf_size - pos;
1285 1285
        if (len > MAX_CODED_SUPERFRAME_SIZE || len < 0) {
1286
            return -1;
1286
            goto fail;
1287 1287
        }
1288 1288
        s->last_superframe_len = len;
1289 1289
        memcpy(s->last_superframe, buf + pos, len);
1290 1290
    } else {
1291 1291
        /* single frame decode */
1292 1292
        if (wma_decode_frame(s, samples) < 0)
1293
            return -1;
1293
            goto fail;
1294 1294
        samples += s->nb_channels * s->frame_len;
1295 1295
    }
1296 1296
    *data_size = (int8_t *)samples - (int8_t *)data;
1297 1297
    return s->block_align;
1298
 fail:
1299
    /* when error, we reset the bit reservoir */
1300
    s->last_superframe_len = 0;
1301
    return -1;
1298 1302
}
1299 1303

  
1300 1304
static int wma_decode_end(AVCodecContext *avctx)

Also available in: Unified diff