From b88324063977615447dff4e8bd3a6c866f536e00 Mon Sep 17 00:00:00 2001 From: aler9 <46489434+aler9@users.noreply.github.com> Date: Mon, 30 Nov 2020 15:21:01 +0100 Subject: [PATCH] update gortsplib --- go.mod | 2 +- go.sum | 4 ++-- internal/client/client.go | 4 ++-- internal/sourcertmp/source.go | 16 ++++++++++------ 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index 58e03513..3f5eb037 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.15 require ( github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d // indirect - github.com/aler9/gortsplib v0.0.0-20201129151859-4e8fa2e4ab97 + github.com/aler9/gortsplib v0.0.0-20201130140921-6b4fe73270ee github.com/davecgh/go-spew v1.1.1 // indirect github.com/fsnotify/fsnotify v1.4.9 github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 diff --git a/go.sum b/go.sum index 4b736ef3..4ca65832 100644 --- a/go.sum +++ b/go.sum @@ -2,8 +2,8 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafo github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d h1:UQZhZ2O0vMHr2cI+DC1Mbh0TJxzA3RcLoMsFw+aXw7E= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/aler9/gortsplib v0.0.0-20201129151859-4e8fa2e4ab97 h1:OLxB4ehf7Y+boNtL8QxiH2egfsyeTWR/akVXSyPLMXM= -github.com/aler9/gortsplib v0.0.0-20201129151859-4e8fa2e4ab97/go.mod h1:8P09VjpiPJFyfkVosyF5/TY82jNwkMN165NS/7sc32I= +github.com/aler9/gortsplib v0.0.0-20201130140921-6b4fe73270ee h1:CpjcwYjyiHM/RT1wV1eYwjRCrA1O0EOuyiQk6DTocdQ= +github.com/aler9/gortsplib v0.0.0-20201130140921-6b4fe73270ee/go.mod h1:8P09VjpiPJFyfkVosyF5/TY82jNwkMN165NS/7sc32I= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= diff --git a/internal/client/client.go b/internal/client/client.go index 4a216ac0..b45f33fe 100644 --- a/internal/client/client.go +++ b/internal/client/client.go @@ -1411,7 +1411,7 @@ func (c *Client) runRecordTCP() bool { return } - c.rtcpReceivers[recvt.TrackId].OnFrame(time.Now(), recvt.StreamType, recvt.Content) + c.rtcpReceivers[recvt.TrackId].ProcessFrame(time.Now(), recvt.StreamType, recvt.Content) c.path.OnFrame(recvt.TrackId, recvt.StreamType, recvt.Content) case *base.Request: @@ -1491,7 +1491,7 @@ func (c *Client) runRecordTCP() bool { func (c *Client) OnUdpPublisherFrame(trackId int, streamType base.StreamType, buf []byte) { now := time.Now() atomic.StoreInt64(c.udpLastFrameTimes[trackId], now.Unix()) - c.rtcpReceivers[trackId].OnFrame(now, streamType, buf) + c.rtcpReceivers[trackId].ProcessFrame(now, streamType, buf) c.path.OnFrame(trackId, streamType, buf) } diff --git a/internal/sourcertmp/source.go b/internal/sourcertmp/source.go index 1a7ec60a..ca0efd79 100644 --- a/internal/sourcertmp/source.go +++ b/internal/sourcertmp/source.go @@ -195,7 +195,7 @@ func (s *Source) runInner() bool { var aacEncoder *rtpaac.Encoder if h264Sps != nil { - videoTrack, err = gortsplib.NewTrackH264(len(tracks), h264Sps, h264Pps) + videoTrack, err = gortsplib.NewTrackH264(96, h264Sps, h264Pps) if err != nil { s.parent.Log("rtmp source ERR: %s", err) return true @@ -204,7 +204,7 @@ func (s *Source) runInner() bool { clockRate, _ := videoTrack.ClockRate() videoRtcpSender = rtcpsender.New(clockRate) - h264Encoder, err = rtph264.NewEncoder(96 + uint8(len(tracks))) + h264Encoder, err = rtph264.NewEncoder(96) if err != nil { s.parent.Log("rtmp source ERR: %s", err) return true @@ -214,7 +214,7 @@ func (s *Source) runInner() bool { } if aacConfig != nil { - audioTrack, err = gortsplib.NewTrackAAC(len(tracks), aacConfig) + audioTrack, err = gortsplib.NewTrackAAC(96, aacConfig) if err != nil { s.parent.Log("rtmp source ERR: %s", err) return true @@ -223,7 +223,7 @@ func (s *Source) runInner() bool { clockRate, _ := audioTrack.ClockRate() audioRtcpSender = rtcpsender.New(clockRate) - aacEncoder, err = rtpaac.NewEncoder(96+uint8(len(tracks)), clockRate) + aacEncoder, err = rtpaac.NewEncoder(96, clockRate) if err != nil { s.parent.Log("rtmp source ERR: %s", err) return true @@ -237,6 +237,10 @@ func (s *Source) runInner() bool { return true } + for i, t := range tracks { + t.Id = i + } + s.parent.Log("rtmp source ready") s.parent.OnSourceSetReady(tracks) defer s.parent.OnSourceSetNotReady() @@ -305,7 +309,7 @@ func (s *Source) runInner() bool { } for _, f := range frames { - videoRtcpSender.OnFrame(time.Now(), gortsplib.StreamTypeRtp, f) + videoRtcpSender.ProcessFrame(time.Now(), gortsplib.StreamTypeRtp, f) s.parent.OnFrame(videoTrack.Id, gortsplib.StreamTypeRtp, f) } @@ -322,7 +326,7 @@ func (s *Source) runInner() bool { } for _, f := range frames { - audioRtcpSender.OnFrame(time.Now(), gortsplib.StreamTypeRtp, f) + audioRtcpSender.ProcessFrame(time.Now(), gortsplib.StreamTypeRtp, f) s.parent.OnFrame(audioTrack.Id, gortsplib.StreamTypeRtp, f) }