aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/aacdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-10-26 02:09:31 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-10-26 02:36:07 +0200
commit51bfaa21c85201ab31776a447599349a1ed6e96b (patch)
treeb7baafad803a06c5d582606f37f91a27e8342e59 /libavcodec/aacdec.c
parentf5fdb12d5552a3710611f15cd72ce6c7b6fb4da0 (diff)
parenta3a8572165ce636fb011b78764a2584777f81b95 (diff)
downloadffmpeg-51bfaa21c85201ab31776a447599349a1ed6e96b.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: (22 commits) g722dec: check output buffer size before decoding g722dec: cosmetics: reindent/linewrap g722dec: remove the use of lowres for half-rate decoding. tta: check for extradata allocation failure in tta demuxer tta: check for allocation failure of decode_buffer tta: use correct frame_length calculation. tta: add support for decoding 24-bit sample format cosmetics: indentation tta: remove pointless braces tta: check output buffer size after adjusting frame length for last frame tta: fix reading of format in TTA header. tta: remove useless commented-out lines tta: check remaining bitstream size while reading unary value lavf: deprecate AVStream.stream_copy avconc: split choose_codec() to choose_decoder/choose_encoder. lavf: simplify by using FFMAX/FFMIN. mpegenc: add preload private option. cosmetics: simplify latm_decode_init latm: avoid unnecessary reinit of the aac decoder aacdec: initialize sbr context only in new channel elements ... Conflicts: avconv.c libavcodec/resample.c libavcodec/tta.c libavformat/utils.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/aacdec.c')
-rw-r--r--libavcodec/aacdec.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index 97d187c2a2..7c8d74e857 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -184,9 +184,11 @@ static av_cold int che_configure(AACContext *ac,
int type, int id, int *channels)
{
if (che_pos[type][id]) {
- if (!ac->che[type][id] && !(ac->che[type][id] = av_mallocz(sizeof(ChannelElement))))
- return AVERROR(ENOMEM);
- ff_aac_sbr_ctx_init(ac, &ac->che[type][id]->sbr);
+ if (!ac->che[type][id]) {
+ if (!(ac->che[type][id] = av_mallocz(sizeof(ChannelElement))))
+ return AVERROR(ENOMEM);
+ ff_aac_sbr_ctx_init(ac, &ac->che[type][id]->sbr);
+ }
if (type != TYPE_CCE) {
ac->output_data[(*channels)++] = ac->che[type][id]->ch[0].ret;
if (type == TYPE_CPE ||
@@ -2521,8 +2523,9 @@ static int latm_decode_frame(AVCodecContext *avctx, void *out, int *out_size,
*out_size = 0;
return avpkt->size;
} else {
- aac_decode_close(avctx);
- if ((err = aac_decode_init(avctx)) < 0)
+ if ((err = decode_audio_specific_config(
+ &latmctx->aac_ctx, avctx, &latmctx->aac_ctx.m4ac,
+ avctx->extradata, avctx->extradata_size, 8*avctx->extradata_size)) < 0)
return err;
latmctx->initialized = 1;
}
@@ -2544,15 +2547,10 @@ static int latm_decode_frame(AVCodecContext *avctx, void *out, int *out_size,
av_cold static int latm_decode_init(AVCodecContext *avctx)
{
struct LATMContext *latmctx = avctx->priv_data;
- int ret;
-
- ret = aac_decode_init(avctx);
+ int ret = aac_decode_init(avctx);
- if (avctx->extradata_size > 0) {
+ if (avctx->extradata_size > 0)
latmctx->initialized = !ret;
- } else {
- latmctx->initialized = 0;
- }
return ret;
}