Commit 7d61819e authored by jbr's avatar jbr

add error concealment

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@13397 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 31348b07
...@@ -1154,8 +1154,8 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size, ...@@ -1154,8 +1154,8 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
if(err) { if(err) {
switch(err) { switch(err) {
case AC3_PARSE_ERROR_SYNC: case AC3_PARSE_ERROR_SYNC:
av_log(avctx, AV_LOG_ERROR, "frame sync error\n"); av_log(avctx, AV_LOG_ERROR, "frame sync error : cannot use error concealment\n");
break; return -1;
case AC3_PARSE_ERROR_BSID: case AC3_PARSE_ERROR_BSID:
av_log(avctx, AV_LOG_ERROR, "invalid bitstream id\n"); av_log(avctx, AV_LOG_ERROR, "invalid bitstream id\n");
break; break;
...@@ -1172,7 +1172,6 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size, ...@@ -1172,7 +1172,6 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
av_log(avctx, AV_LOG_ERROR, "invalid header\n"); av_log(avctx, AV_LOG_ERROR, "invalid header\n");
break; break;
} }
return -1;
} }
/* check that reported frame size fits in input buffer */ /* check that reported frame size fits in input buffer */
...@@ -1185,11 +1184,12 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size, ...@@ -1185,11 +1184,12 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
if(avctx->error_resilience >= FF_ER_CAREFUL) { if(avctx->error_resilience >= FF_ER_CAREFUL) {
if(av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, &buf[2], s->frame_size-2)) { 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"); av_log(avctx, AV_LOG_ERROR, "frame CRC mismatch\n");
return -1; err = 1;
} }
/* TODO: error concealment */
} }
/* if frame is ok, set audio parameters */
if (!err) {
avctx->sample_rate = s->sample_rate; avctx->sample_rate = s->sample_rate;
avctx->bit_rate = s->bit_rate; avctx->bit_rate = s->bit_rate;
...@@ -1207,13 +1207,12 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size, ...@@ -1207,13 +1207,12 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
s->fbw_channels == s->out_channels)) { s->fbw_channels == s->out_channels)) {
set_downmix_coeffs(s); set_downmix_coeffs(s);
} }
}
/* parse the audio blocks */ /* parse the audio blocks */
for (blk = 0; blk < NB_BLOCKS; blk++) { for (blk = 0; blk < NB_BLOCKS; blk++) {
if (ac3_parse_audio_block(s, blk)) { if (!err && ac3_parse_audio_block(s, blk)) {
av_log(avctx, AV_LOG_ERROR, "error parsing the audio block\n"); av_log(avctx, AV_LOG_ERROR, "error parsing the audio block\n");
*data_size = 0;
return s->frame_size;
} }
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
for (ch = 0; ch < s->out_channels; ch++) for (ch = 0; ch < s->out_channels; ch++)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment