diff options
author | Luca Barbato <lu_zero@gentoo.org> | 2015-06-04 10:19:50 +0200 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2015-06-07 10:14:46 +0200 |
commit | bc76c46943272515805d7ac48ca39f14826d1fed (patch) | |
tree | 0e063347b452f0bb7aec260445ff581cad8b6428 /libavcodec/aacdec.c | |
parent | a188108ebf28ebac9d2b8fc7d5b391aef45698b3 (diff) |
aac: Wait to know the channels before allocating frame
The channel configuration can be delivered only by the PCE,
try to parse it first and not try to decode until a channel
configuration is set.
CC: libav-stable@libav.org
Diffstat (limited to 'libavcodec/aacdec.c')
-rw-r--r-- | libavcodec/aacdec.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index 9d14357086..683aee25d5 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -2821,8 +2821,9 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data, } } - if ((err = frame_configure_elements(avctx)) < 0) - goto fail; + if (avctx->channels) + if ((err = frame_configure_elements(avctx)) < 0) + goto fail; // The FF_PROFILE_AAC_* defines are all object_type - 1 // This may lead to an undefined profile being signaled @@ -2833,6 +2834,9 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data, while ((elem_type = get_bits(gb, 3)) != TYPE_END) { elem_id = get_bits(gb, 4); + if (!avctx->channels && elem_type != TYPE_PCE) + goto fail; + if (elem_type < TYPE_DSE) { if (!(che=get_che(ac, elem_type, elem_id))) { av_log(ac->avctx, AV_LOG_ERROR, "channel element %d.%d is not allocated\n", @@ -2919,6 +2923,11 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data, } } + if (!avctx->channels) { + *got_frame_ptr = 0; + return 0; + } + spectral_to_sample(ac); multiplier = (ac->oc[1].m4ac.sbr == 1) ? ac->oc[1].m4ac.ext_sample_rate > ac->oc[1].m4ac.sample_rate : 0; |