aac_adtstoasc_bsf: validate and forward extradata if the stream is already ASC

Fixes AAC AudioSpecificConfig passthrough.

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
James Almer 2016-11-24 21:10:47 -03:00 committed by Anton Khirnov
parent 1762a39e09
commit 45d199d5b0
1 changed files with 10 additions and 2 deletions

View File

@ -135,8 +135,16 @@ fail:
static int aac_adtstoasc_init(AVBSFContext *ctx) static int aac_adtstoasc_init(AVBSFContext *ctx)
{ {
av_freep(&ctx->par_out->extradata); /* Validate the extradata if the stream is already MPEG-4 AudioSpecificConfig */
ctx->par_out->extradata_size = 0; 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; return 0;
} }