#define SUM8(op, sum, w, p) \
{ \
- op(sum, (w)[0 * 64], p[0 * 64]); \
- op(sum, (w)[1 * 64], p[1 * 64]); \
- op(sum, (w)[2 * 64], p[2 * 64]); \
- op(sum, (w)[3 * 64], p[3 * 64]); \
- op(sum, (w)[4 * 64], p[4 * 64]); \
- op(sum, (w)[5 * 64], p[5 * 64]); \
- op(sum, (w)[6 * 64], p[6 * 64]); \
- op(sum, (w)[7 * 64], p[7 * 64]); \
+ op(sum, (w)[0 * 64], (p)[0 * 64]); \
+ op(sum, (w)[1 * 64], (p)[1 * 64]); \
+ op(sum, (w)[2 * 64], (p)[2 * 64]); \
+ op(sum, (w)[3 * 64], (p)[3 * 64]); \
+ op(sum, (w)[4 * 64], (p)[4 * 64]); \
+ op(sum, (w)[5 * 64], (p)[5 * 64]); \
+ op(sum, (w)[6 * 64], (p)[6 * 64]); \
+ op(sum, (w)[7 * 64], (p)[7 * 64]); \
}
#define SUM8P2(sum1, op1, sum2, op2, w1, w2, p) \
for(ch=0;ch<s->nb_channels;ch++) {
g = &granules[ch][gr];
if(get_bits_count(&s->gb)<0){
- av_log(s->avctx, AV_LOG_ERROR, "mdb:%d, lastbuf:%d skipping granule %d\n",
+ av_log(s->avctx, AV_LOG_DEBUG, "mdb:%d, lastbuf:%d skipping granule %d\n",
main_data_begin, s->last_buf_size, gr);
skip_bits_long(&s->gb, g->part2_3_length);
memset(g->sb_hybrid, 0, sizeof(g->sb_hybrid));
MPADecodeContext *s = avctx->priv_data;
uint32_t header;
int out_size;
- int skipped = 0;
OUT_INT *out_samples = data;
-retry:
if(buf_size < HEADER_SIZE)
return -1;
header = AV_RB32(buf);
if(ff_mpa_check_header(header) < 0){
- buf++;
- buf_size--;
- skipped++;
- av_log(avctx, AV_LOG_ERROR, "Header missing skipping one byte.\n");
- goto retry;
+ av_log(avctx, AV_LOG_ERROR, "Header missing\n");
+ return -1;
}
if (ff_mpegaudio_decode_header((MPADecodeHeader *)s, header) == 1) {
avctx->bit_rate = s->bit_rate;
avctx->sub_id = s->layer;
+ if(*data_size < 1152*avctx->channels*sizeof(OUT_INT))
+ return -1;
+ *data_size = 0;
+
if(s->frame_size<=0 || s->frame_size > buf_size){
av_log(avctx, AV_LOG_ERROR, "incomplete frame\n");
return -1;
}else
av_log(avctx, AV_LOG_DEBUG, "Error while decoding MPEG audio frame.\n"); //FIXME return -1 / but also return the number of bytes consumed
s->frame_size = 0;
- return buf_size + skipped;
+ return buf_size;
}
static void flush(AVCodecContext *avctx){
OUT_INT *outptr, *bp;
int fr, j, n;
+ if(*data_size < MPA_FRAME_SIZE * MPA_MAX_CHANNELS * s->frames * sizeof(OUT_INT))
+ return -1;
+
*data_size = 0;
// Discard too short frames
if (buf_size < HEADER_SIZE)