[FFmpeg-devel] [PATCH] avformat/adtsenc - allow only AAC streams

Gyan Doshi gyandoshi at gmail.com
Sun Jan 14 14:06:34 EET 2018


From c3da268449ca4677958856d99b0d1ce4695f0924 Mon Sep 17 00:00:00 2001
From: Gyan Doshi <gyandoshi at gmail.com>
Date: Sun, 14 Jan 2018 17:30:23 +0530
Subject: [PATCH] avformat/adtsenc - allow only AAC streams

The ADTS muxer will silently (attempt to) mux any audio stream passed to it.
Patch adds a codec check.
---
 libavformat/adtsenc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c
index a24f99c447..cb20d789c8 100644
--- a/libavformat/adtsenc.c
+++ b/libavformat/adtsenc.c
@@ -99,6 +99,11 @@ static int adts_write_header(AVFormatContext *s)
     ADTSContext *adts = s->priv_data;
     AVCodecParameters *par = s->streams[0]->codecpar;
 
+    if (par->codec_id != AV_CODEC_ID_AAC) {
+        av_log(s, AV_LOG_ERROR, "Only AAC streams can be muxed by the ADTS muxer\n");
+        return AVERROR(EINVAL);
+    }
+
     if (adts->id3v2tag)
         ff_id3v2_write_simple(s, 4, ID3v2_DEFAULT_MAGIC);
     if (par->extradata_size > 0)
-- 
2.11.1.windows.1


More information about the ffmpeg-devel mailing list