diff options
author | James Almer <jamrial@gmail.com> | 2016-11-24 21:10:47 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2016-11-25 18:24:56 -0300 |
commit | 6e1902bab4349a79c45807af18ebf5b50f7b436b (patch) | |
tree | 23ee4c84f9ea5255d59fdbff6ad44ce364080412 /libavcodec | |
parent | 2566ad98b01538ea589e5ee07b69fc566aadc348 (diff) | |
download | ffmpeg-6e1902bab4349a79c45807af18ebf5b50f7b436b.tar.gz |
avcodec/aac_adtstoasc_bsf: validate and forward extradata if the stream is already ASC
Fixes ticket #5973
Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/aac_adtstoasc_bsf.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libavcodec/aac_adtstoasc_bsf.c b/libavcodec/aac_adtstoasc_bsf.c index 48889fc48e..1067160559 100644 --- a/libavcodec/aac_adtstoasc_bsf.c +++ b/libavcodec/aac_adtstoasc_bsf.c @@ -136,8 +136,16 @@ fail: static int aac_adtstoasc_init(AVBSFContext *ctx) { - av_freep(&ctx->par_out->extradata); - ctx->par_out->extradata_size = 0; + /* Validate the extradata if the stream is already MPEG-4 AudioSpecificConfig */ + if (ctx->par_in->extradata) { + MPEG4AudioConfig mp4ac; + int ret = avpriv_mpeg4audio_get_config(&mp4ac, ctx->par_in->extradata, + ctx->par_in->extradata_size * 8, 1); + if (ret < 0) { + av_log(ctx, AV_LOG_ERROR, "Error parsing AudioSpecificConfig extradata!\n"); + return ret; + } + } return 0; } |