fix: use engine's aac format

This commit is contained in:
langhuihui
2024-09-27 10:05:32 +08:00
parent c943c2a0ec
commit 4dc893e9fb
2 changed files with 9 additions and 4 deletions

View File

@@ -72,6 +72,7 @@ func (p *RTSPPublisher) SetTracks() error {
conf = f.StreamMuxConfig.Programs[0].Layers[0].AudioSpecificConfig
}
at := p.CreateAudioTrack(codec.CodecID_AAC, byte(f.PayloadType()), uint32(conf.SampleRate)).(*AAC)
at.AACFormat = f
at.AACDecoder.LATM = f.LATM
at.AACDecoder.IndexDeltaLength = f.IndexDeltaLength
at.AACDecoder.IndexLength = f.IndexLength

View File

@@ -69,9 +69,9 @@ func (s *RTSPSubscriber) OnEvent(event any) {
}
switch v.CodecID {
case codec.CodecID_AAC:
s.audioTrack = &description.Media{
Type: description.MediaTypeAudio,
Formats: []format.Format{&format.MPEG4Audio{
f := v.AACFormat
if f == nil {
f = &format.MPEG4Audio{
PayloadTyp: v.PayloadType,
Config: &mpeg4audio.Config{
Type: mpeg4audio.ObjectTypeAACLC,
@@ -81,7 +81,11 @@ func (s *RTSPSubscriber) OnEvent(event any) {
SizeLength: v.AACDecoder.SizeLength,
IndexLength: v.AACDecoder.IndexLength,
IndexDeltaLength: v.AACDecoder.IndexDeltaLength,
}},
}
}
s.audioTrack = &description.Media{
Type: description.MediaTypeAudio,
Formats: []format.Format{f},
}
case codec.CodecID_PCMA:
s.audioTrack = &description.Media{