From 717b3e0122cd63397d4d7a19c34806de4e4f7d4c Mon Sep 17 00:00:00 2001 From: Anton Baklanov Date: Sat, 4 Feb 2017 22:54:19 +0200 Subject: [PATCH] ATDS: add AOT validation MPEG 4 ADTS frame can not have AOT value greater than AAC_LTP. For HE AAC (both v1 and v2) AOT should be set to AAC_LC. Clients are supposed to use implicit SBR signaling to detect presence of SBR. Ref: https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/adtsenc.c#L65 https://developer.apple.com/library/content/technotes/tn2236/_index.html --- format/aac/aac.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/format/aac/aac.go b/format/aac/aac.go index 0ddce3b..5a65a87 100644 --- a/format/aac/aac.go +++ b/format/aac/aac.go @@ -30,6 +30,9 @@ func (self *Muxer) WriteHeader(streams []av.CodecData) (err error) { return } self.config = streams[0].(aacparser.CodecData).Config + if self.config.ObjectType > aacparser.AOT_AAC_LTP { + err = fmt.Errorf("aac: AOT %d is not allowed in ADTS", self.config.ObjectType) + } return }