summaryrefslogtreecommitdiff
path: root/libavcodec/ac3dec.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2008-05-25 18:05:15 +0000
committerJustin Ruggles <justin.ruggles@gmail.com>2008-05-25 18:05:15 +0000
commitecfe94b2944700723f5a287c10b29a2d4f2ad5d6 (patch)
tree462e58b8bf791fe4789b905cb58d8a996efb0d66 /libavcodec/ac3dec.c
parent6477a940f6a9a1e84dbab42e4757cfa338e22c82 (diff)
add error concealment
Originally committed as revision 13397 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ac3dec.c')
-rw-r--r--libavcodec/ac3dec.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index bde213a222..b1b07f869f 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -1154,8 +1154,8 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
if(err) {
switch(err) {
case AC3_PARSE_ERROR_SYNC:
- av_log(avctx, AV_LOG_ERROR, "frame sync error\n");
- break;
+ 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;
@@ -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");
break;
}
- return -1;
}
/* 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,
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)) {
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->bit_rate = s->bit_rate;
@@ -1207,13 +1207,12 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
s->fbw_channels == s->out_channels)) {
set_downmix_coeffs(s);
}
+ }
/* parse the audio blocks */
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");
- *data_size = 0;
- return s->frame_size;
}
for (i = 0; i < 256; i++)
for (ch = 0; ch < s->out_channels; ch++)