@@ -71,7 +71,7 @@ static int s302m_parse_frame_header(AVCodecContext *avctx, const uint8_t *buf,
channels = ((h >> 14) & 0x0003) * 2 + 2;
bits = ((h >> 4) & 0x0003) * 4 + 16;
- if (AES3_HEADER_LEN + frame_size != buf_size || bits > 24) {
+ if (AES3_HEADER_LEN + frame_size > buf_size || bits > 24) {
av_log(avctx, AV_LOG_ERROR, "frame has invalid header\n");
return AVERROR_INVALIDDATA;
}
@@ -107,16 +107,16 @@ static int s302m_decode_frame(AVCodecContext *avctx, void *data,
S302Context *s = avctx->priv_data;
AVFrame *frame = data;
const uint8_t *buf = avpkt->data;
- int buf_size = avpkt->size;
int block_size, ret;
+ int buf_size;
int i;
int non_pcm_data_type = -1;
- int frame_size = s302m_parse_frame_header(avctx, buf, buf_size);
+ int frame_size = s302m_parse_frame_header(avctx, buf, avpkt->size);
if (frame_size < 0)
return frame_size;
- buf_size -= AES3_HEADER_LEN;
+ buf_size = frame_size;
buf += AES3_HEADER_LEN;
/* get output buffer */
@@ -202,7 +202,7 @@ static int s302m_decode_frame(AVCodecContext *avctx, void *data,
return AVERROR_PATCHWELCOME;
}
if (s->non_pcm_mode & 1) {
- return avpkt->size;
+ return AES3_HEADER_LEN + frame_size;
}
}
@@ -210,7 +210,7 @@ static int s302m_decode_frame(AVCodecContext *avctx, void *data,
*got_frame_ptr = 1;
- return avpkt->size;
+ return AES3_HEADER_LEN + frame_size;
}
#define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_DECODING_PARAM
@@ -237,6 +237,6 @@ AVCodec ff_s302m_decoder = {
.id = AV_CODEC_ID_S302M,
.priv_data_size = sizeof(S302Context),
.decode = s302m_decode_frame,
- .capabilities = AV_CODEC_CAP_DR1,
+ .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_SUBFRAMES,
.priv_class = &s302m_class,
};
@@ -1,4 +1,4 @@
0bf5457fd41a22fc5cdd99ae5ad4e273 *tests/data/fate/acodec-s302m.mpegts
1527688 tests/data/fate/acodec-s302m.mpegts
-31f25a0020fd9017de9c3c608316854b *tests/data/fate/acodec-s302m.out.wav
-stddev: 986.94 PSNR: 36.44 MAXDIFF:18571 bytes: 1058400/ 1056708
+abc1b26737c8103c3f122539d239f6be *tests/data/fate/acodec-s302m.out.wav
+stddev: 986.15 PSNR: 36.45 MAXDIFF:18571 bytes: 1058400/ 1058400