[FFmpeg-soc] [soc]: r2256 - eac3/ac3dec.c
jbr
subversion at mplayerhq.hu
Fri May 30 04:41:52 CEST 2008
Author: jbr
Date: Fri May 30 04:41:52 2008
New Revision: 2256
Log:
move header error logging to after crc check
Modified:
eac3/ac3dec.c
Modified: eac3/ac3dec.c
==============================================================================
--- eac3/ac3dec.c (original)
+++ eac3/ac3dec.c Fri May 30 04:41:52 2008
@@ -1224,51 +1224,49 @@ static int ac3_decode_frame(AVCodecConte
/* parse the syncinfo */
*data_size = 0;
err = parse_frame_header(s);
- if(err) {
- switch(err) {
- case AC3_PARSE_ERROR_SYNC:
- av_log(avctx, AV_LOG_ERROR, "frame sync error : cannot use error concealment\n");
- return -1;
- case AC3_PARSE_ERROR_BSID:
- av_log(avctx, AV_LOG_ERROR, "invalid bitstream id\n");
- break;
- case AC3_PARSE_ERROR_SAMPLE_RATE:
- av_log(avctx, AV_LOG_ERROR, "invalid sample rate\n");
- break;
- case AC3_PARSE_ERROR_FRAME_SIZE:
- av_log(avctx, AV_LOG_ERROR, "invalid frame size\n");
- break;
- case AC3_PARSE_ERROR_FRAME_TYPE:
- break;
- default:
- av_log(avctx, AV_LOG_ERROR, "invalid header\n");
- break;
- }
- }
/* check that reported frame size fits in input buffer */
if(s->frame_size > buf_size) {
av_log(avctx, AV_LOG_ERROR, "incomplete frame\n");
- return -1;
+ err = AC3_PARSE_ERROR_FRAME_SIZE;
}
/* check for crc mismatch */
- if(avctx->error_resilience >= FF_ER_CAREFUL) {
+ if(err != AC3_PARSE_ERROR_FRAME_SIZE && avctx->error_resilience >= FF_ER_CAREFUL) {
if(av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, &buf[2], s->frame_size-2)) {
av_log(avctx, AV_LOG_ERROR, "frame CRC mismatch\n");
err = 1;
}
}
+ if(err && err != 1) {
+ switch(err) {
+ case AC3_PARSE_ERROR_SYNC:
+ av_log(avctx, AV_LOG_ERROR, "frame sync error\n");
+ break;
+ case AC3_PARSE_ERROR_BSID:
+ av_log(avctx, AV_LOG_ERROR, "invalid bitstream id\n");
+ break;
+ case AC3_PARSE_ERROR_SAMPLE_RATE:
+ av_log(avctx, AV_LOG_ERROR, "invalid sample rate\n");
+ break;
+ case AC3_PARSE_ERROR_FRAME_SIZE:
+ av_log(avctx, AV_LOG_ERROR, "invalid frame size\n");
+ break;
+ case AC3_PARSE_ERROR_FRAME_TYPE:
/* skip frame if CRC is ok. otherwise use error concealment. */
/* TODO: add support for substreams and dependent frames */
- if(err == AC3_PARSE_ERROR_FRAME_TYPE) {
if(s->frame_type == EAC3_FRAME_TYPE_DEPENDENT || s->substreamid) {
av_log(avctx, AV_LOG_ERROR, "unsupported frame type : skipping frame\n");
return s->frame_size;
} else {
av_log(avctx, AV_LOG_ERROR, "invalid frame type\n");
}
+ break;
+ default:
+ av_log(avctx, AV_LOG_ERROR, "invalid header\n");
+ break;
+ }
}
/* if frame is ok, set audio parameters */
More information about the FFmpeg-soc
mailing list