X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Faacdec_template.c;h=0c899285ddad4f60f7faf893d48c2a979ce8efd0;hb=fbb283cfefb1865375718c4a56ce608d96a4a8ed;hp=cf971810926ed7fe9dfb4d5aecce0ad50dfe4745;hpb=c00b218a8f75ed3eb87c213d95bd5775c0af5e12;p=ffmpeg diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index cf971810926..0c899285dda 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -3324,20 +3324,14 @@ static int aac_decode_frame(AVCodecContext *avctx, void *data, AV_PKT_DATA_JP_DUALMONO, &jp_dualmono_size); - if (new_extradata && 0) { - av_free(avctx->extradata); - avctx->extradata = av_mallocz(new_extradata_size + - AV_INPUT_BUFFER_PADDING_SIZE); - if (!avctx->extradata) - return AVERROR(ENOMEM); - avctx->extradata_size = new_extradata_size; - memcpy(avctx->extradata, new_extradata, new_extradata_size); - push_output_configuration(ac); - if (decode_audio_specific_config(ac, ac->avctx, &ac->oc[1].m4ac, - avctx->extradata, - avctx->extradata_size*8LL, 1) < 0) { - pop_output_configuration(ac); - return AVERROR_INVALIDDATA; + if (new_extradata) { + /* discard previous configuration */ + ac->oc[1].status = OC_NONE; + err = decode_audio_specific_config(ac, ac->avctx, &ac->oc[1].m4ac, + new_extradata, + new_extradata_size * 8LL, 1); + if (err < 0) { + return err; } }