Commit d6c36fba authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'a10c4ce2'

* commit 'a10c4ce2':
  aac: Forward errors properly in aac_decode_frame_int

Conflicts:
	libavcodec/aacdec.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 48af8781 a10c4ce2
...@@ -2506,7 +2506,7 @@ static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb) ...@@ -2506,7 +2506,7 @@ static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb)
int size; int size;
AACADTSHeaderInfo hdr_info; AACADTSHeaderInfo hdr_info;
uint8_t layout_map[MAX_ELEM_ID*4][3]; uint8_t layout_map[MAX_ELEM_ID*4][3];
int layout_map_tags; int layout_map_tags, ret;
size = avpriv_aac_parse_header(gb, &hdr_info); size = avpriv_aac_parse_header(gb, &hdr_info);
if (size > 0) { if (size > 0) {
...@@ -2520,12 +2520,15 @@ static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb) ...@@ -2520,12 +2520,15 @@ static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb)
push_output_configuration(ac); push_output_configuration(ac);
if (hdr_info.chan_config) { if (hdr_info.chan_config) {
ac->oc[1].m4ac.chan_config = hdr_info.chan_config; ac->oc[1].m4ac.chan_config = hdr_info.chan_config;
if (set_default_channel_config(ac->avctx, layout_map, if ((ret = set_default_channel_config(ac->avctx,
&layout_map_tags, hdr_info.chan_config)) layout_map,
return -7; &layout_map_tags,
if (output_configure(ac, layout_map, layout_map_tags, hdr_info.chan_config)) < 0)
FFMAX(ac->oc[1].status, OC_TRIAL_FRAME), 0)) return ret;
return -7; if ((ret = output_configure(ac, layout_map, layout_map_tags,
FFMAX(ac->oc[1].status,
OC_TRIAL_FRAME), 0)) < 0)
return ret;
} else { } else {
ac->oc[1].m4ac.chan_config = 0; ac->oc[1].m4ac.chan_config = 0;
/** /**
...@@ -2572,22 +2575,19 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data, ...@@ -2572,22 +2575,19 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
ac->frame = data; ac->frame = data;
if (show_bits(gb, 12) == 0xfff) { if (show_bits(gb, 12) == 0xfff) {
if (parse_adts_frame_header(ac, gb) < 0) { if ((err = parse_adts_frame_header(ac, gb)) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error decoding AAC frame header.\n"); av_log(avctx, AV_LOG_ERROR, "Error decoding AAC frame header.\n");
err = -1;
goto fail; goto fail;
} }
if (ac->oc[1].m4ac.sampling_index > 12) { if (ac->oc[1].m4ac.sampling_index > 12) {
av_log(ac->avctx, AV_LOG_ERROR, "invalid sampling rate index %d\n", ac->oc[1].m4ac.sampling_index); av_log(ac->avctx, AV_LOG_ERROR, "invalid sampling rate index %d\n", ac->oc[1].m4ac.sampling_index);
err = -1; err = AVERROR_INVALIDDATA;
goto fail; goto fail;
} }
} }
if (frame_configure_elements(avctx) < 0) { if ((err = frame_configure_elements(avctx)) < 0)
err = -1;
goto fail; goto fail;
}
ac->tags_mapped = 0; ac->tags_mapped = 0;
// parse // parse
...@@ -2598,7 +2598,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data, ...@@ -2598,7 +2598,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
if (!(che=get_che(ac, elem_type, elem_id))) { if (!(che=get_che(ac, elem_type, elem_id))) {
av_log(ac->avctx, AV_LOG_ERROR, "channel element %d.%d is not allocated\n", av_log(ac->avctx, AV_LOG_ERROR, "channel element %d.%d is not allocated\n",
elem_type, elem_id); elem_type, elem_id);
err = -1; err = AVERROR_INVALIDDATA;
goto fail; goto fail;
} }
samples = 1024; samples = 1024;
...@@ -2656,7 +2656,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data, ...@@ -2656,7 +2656,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
elem_id += get_bits(gb, 8) - 1; elem_id += get_bits(gb, 8) - 1;
if (get_bits_left(gb) < 8 * elem_id) { if (get_bits_left(gb) < 8 * elem_id) {
av_log(avctx, AV_LOG_ERROR, "TYPE_FIL: "overread_err); av_log(avctx, AV_LOG_ERROR, "TYPE_FIL: "overread_err);
err = -1; err = AVERROR_INVALIDDATA;
goto fail; goto fail;
} }
while (elem_id > 0) while (elem_id > 0)
...@@ -2665,7 +2665,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data, ...@@ -2665,7 +2665,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
break; break;
default: default:
err = -1; /* should not happen, but keeps compiler happy */ err = AVERROR_BUG; /* should not happen, but keeps compiler happy */
break; break;
} }
...@@ -2677,7 +2677,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data, ...@@ -2677,7 +2677,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
if (get_bits_left(gb) < 3) { if (get_bits_left(gb) < 3) {
av_log(avctx, AV_LOG_ERROR, overread_err); av_log(avctx, AV_LOG_ERROR, overread_err);
err = -1; err = AVERROR_INVALIDDATA;
goto fail; goto fail;
} }
} }
......
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