]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/aac_adtstoasc_bsf.c
lavc: Remove deprecated XvMC support hacks
[ffmpeg] / libavcodec / aac_adtstoasc_bsf.c
index 9168e2b0f3236695089159be3539fd60ffcabb55..08d60eb06ffcb843a0e723945ad81b9e08edd49a 100644 (file)
@@ -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;
 }