new track system

This commit is contained in:
aler9
2022-01-28 17:42:20 +01:00
committed by Alessandro Ros
parent cd0db96a5d
commit 6d5bf0c1bb
31 changed files with 1523 additions and 1432 deletions

View File

@@ -43,9 +43,11 @@ func main() {
}
// find the AAC track
var clockRate int
aacTrack := func() int {
for i, track := range tracks {
if track.IsAAC() {
if _, ok := track.(*gortsplib.TrackAAC); ok {
clockRate = track.ClockRate()
return i
}
}
@@ -55,14 +57,8 @@ func main() {
panic("AAC track not found")
}
// get track config
aacConf, err := tracks[aacTrack].ExtractConfigAAC()
if err != nil {
panic(err)
}
// setup decoder
dec := rtpaac.NewDecoder(aacConf.SampleRate)
dec := rtpaac.NewDecoder(clockRate)
// called when a RTP packet arrives
c.OnPacketRTP = func(trackID int, payload []byte) {