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.

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
Gyan Doshi 2018-01-14 17:30:23 +05:30 committed by James Almer
parent 02dba49dd3
commit 96f94624e0
1 changed files with 4 additions and 0 deletions

View File

@ -99,6 +99,10 @@ static int adts_init(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 (par->extradata_size > 0)
return adts_decode_extradata(s, adts, par->extradata,
par->extradata_size);