diff options
author | Martin Storsjö <martin@martin.st> | 2011-04-12 10:35:23 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2011-04-13 15:43:46 +0300 |
commit | 2d3267936a40c0a8db6ab76aeb0017e1959ae2fa (patch) | |
tree | 2f21b75a3689d474179f9d82f7243f48377844da /libavcodec/libvo-aacenc.c | |
parent | 451d566f4b51bd4d371d7125fe458bcac3869a77 (diff) | |
download | ffmpeg-2d3267936a40c0a8db6ab76aeb0017e1959ae2fa.tar.gz |
libvo-aacenc: Only produce extradata if the global header flag is set
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavcodec/libvo-aacenc.c')
-rw-r--r-- | libavcodec/libvo-aacenc.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/libavcodec/libvo-aacenc.c b/libavcodec/libvo-aacenc.c index 205c00e922..7006d78c42 100644 --- a/libavcodec/libvo-aacenc.c +++ b/libavcodec/libvo-aacenc.c @@ -62,12 +62,6 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) return AVERROR_UNKNOWN; } - avctx->extradata_size = 2; - avctx->extradata = av_mallocz(avctx->extradata_size + - FF_INPUT_BUFFER_PADDING_SIZE); - if (!avctx->extradata) - return AVERROR(ENOMEM); - for (index = 0; index < 16; index++) if (avctx->sample_rate == ff_mpeg4audio_sample_rates[index]) break; @@ -76,8 +70,16 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) avctx->sample_rate); return AVERROR_NOTSUPP; } - avctx->extradata[0] = 0x02 << 3 | index >> 1; - avctx->extradata[1] = (index & 0x01) << 7 | avctx->channels << 3; + if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) { + avctx->extradata_size = 2; + avctx->extradata = av_mallocz(avctx->extradata_size + + FF_INPUT_BUFFER_PADDING_SIZE); + if (!avctx->extradata) + return AVERROR(ENOMEM); + + avctx->extradata[0] = 0x02 << 3 | index >> 1; + avctx->extradata[1] = (index & 0x01) << 7 | avctx->channels << 3; + } return 0; } |