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
This commit is contained in:
Anton Baklanov 2017-02-04 22:54:19 +02:00
parent 4b82a8ce74
commit 717b3e0122

View File

@ -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
}