Originally committed as revision 21519 to svn://svn.ffmpeg.org/ffmpeg/trunk
| ... | ... |
@@ -1236,21 +1236,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size, |
| 1236 | 1236 |
*data_size = 0; |
| 1237 | 1237 |
err = parse_frame_header(s); |
| 1238 | 1238 |
|
| 1239 |
- /* check that reported frame size fits in input buffer */ |
|
| 1240 |
- if(!err && s->frame_size > buf_size) {
|
|
| 1241 |
- av_log(avctx, AV_LOG_ERROR, "incomplete frame\n"); |
|
| 1242 |
- err = AAC_AC3_PARSE_ERROR_FRAME_SIZE; |
|
| 1243 |
- } |
|
| 1244 |
- |
|
| 1245 |
- /* check for crc mismatch */ |
|
| 1246 |
- if(err != AAC_AC3_PARSE_ERROR_FRAME_SIZE && avctx->error_recognition >= FF_ER_CAREFUL) {
|
|
| 1247 |
- if(av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, &buf[2], s->frame_size-2)) {
|
|
| 1248 |
- av_log(avctx, AV_LOG_ERROR, "frame CRC mismatch\n"); |
|
| 1249 |
- err = AAC_AC3_PARSE_ERROR_CRC; |
|
| 1250 |
- } |
|
| 1251 |
- } |
|
| 1252 |
- |
|
| 1253 |
- if(err && err != AAC_AC3_PARSE_ERROR_CRC) {
|
|
| 1239 |
+ if (err) {
|
|
| 1254 | 1240 |
switch(err) {
|
| 1255 | 1241 |
case AAC_AC3_PARSE_ERROR_SYNC: |
| 1256 | 1242 |
av_log(avctx, AV_LOG_ERROR, "frame sync error\n"); |
| ... | ... |
@@ -1278,6 +1264,18 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size, |
| 1278 | 1278 |
av_log(avctx, AV_LOG_ERROR, "invalid header\n"); |
| 1279 | 1279 |
break; |
| 1280 | 1280 |
} |
| 1281 |
+ } else {
|
|
| 1282 |
+ /* check that reported frame size fits in input buffer */ |
|
| 1283 |
+ if (s->frame_size > buf_size) {
|
|
| 1284 |
+ av_log(avctx, AV_LOG_ERROR, "incomplete frame\n"); |
|
| 1285 |
+ err = AAC_AC3_PARSE_ERROR_FRAME_SIZE; |
|
| 1286 |
+ } else if (avctx->error_recognition >= FF_ER_CAREFUL) {
|
|
| 1287 |
+ /* check for crc mismatch */ |
|
| 1288 |
+ if (av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, &buf[2], s->frame_size-2)) {
|
|
| 1289 |
+ av_log(avctx, AV_LOG_ERROR, "frame CRC mismatch\n"); |
|
| 1290 |
+ err = AAC_AC3_PARSE_ERROR_CRC; |
|
| 1291 |
+ } |
|
| 1292 |
+ } |
|
| 1281 | 1293 |
} |
| 1282 | 1294 |
|
| 1283 | 1295 |
/* if frame is ok, set audio parameters */ |