aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2016-11-24 21:10:47 -0300
committerAnton Khirnov <anton@khirnov.net>2016-11-29 10:39:20 +0100
commit45d199d5b0b7f09eb9baa29929a3bd07ed46223b (patch)
tree5152b21b578dcfaaaee07c57b8792054aa373947 /libavcodec
parent1762a39e09a3edc27d1ef7bc50070f496b893aa4 (diff)
downloadffmpeg-45d199d5b0b7f09eb9baa29929a3bd07ed46223b.tar.gz
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>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/aac_adtstoasc_bsf.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/libavcodec/aac_adtstoasc_bsf.c b/libavcodec/aac_adtstoasc_bsf.c
index 9168e2b0f3..08d60eb06f 100644
--- a/libavcodec/aac_adtstoasc_bsf.c
+++ b/libavcodec/aac_adtstoasc_bsf.c
@@ -135,8 +135,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;
}