[FFmpeg-cvslog] avcodec/aac_adtstoasc_bsf: validate and forward extradata if the stream is already ASC

James Almer git at videolan.org
Fri Nov 25 23:53:22 EET 2016


ffmpeg | branch: release/3.2 | James Almer <jamrial at gmail.com> | Thu Nov 24 21:10:47 2016 -0300| [c269c43a83166003ab6649263bc60634a6b7866f] | committer: James Almer

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

Fixes ticket #5973

Reviewed-by: Hendrik Leppkes <h.leppkes at gmail.com>
Signed-off-by: James Almer <jamrial at gmail.com>
(cherry picked from commit 6e1902bab4349a79c45807af18ebf5b50f7b436b)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c269c43a83166003ab6649263bc60634a6b7866f
---

 Changelog                      |  1 +
 libavcodec/aac_adtstoasc_bsf.c | 12 ++++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/Changelog b/Changelog
index 94f652e..82d38e5 100644
--- a/Changelog
+++ b/Changelog
@@ -2,6 +2,7 @@ Entries are sorted chronologically from oldest to youngest within each release,
 releases are sorted from youngest to oldest.
 
 version 3.2.1:
+- avcodec/aac_adtstoasc_bsf: validate and forward extradata if the stream is already ASC
 - mss2: only use error correction for matching block counts
 - softfloat: decrease MIN_EXP to cover full float range
 - libopusdec: default to stereo for invalid number of channels
diff --git a/libavcodec/aac_adtstoasc_bsf.c b/libavcodec/aac_adtstoasc_bsf.c
index 48889fc..1067160 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;
 }



More information about the ffmpeg-cvslog mailing list