Browse Source

update gortsplib

pull/169/head
aler9 5 years ago
parent
commit
b883240639
  1. 2
      go.mod
  2. 4
      go.sum
  3. 4
      internal/client/client.go
  4. 16
      internal/sourcertmp/source.go

2
go.mod

@ -5,7 +5,7 @@ go 1.15 @@ -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

4
go.sum

@ -2,8 +2,8 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafo @@ -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=

4
internal/client/client.go

@ -1411,7 +1411,7 @@ func (c *Client) runRecordTCP() bool { @@ -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 { @@ -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)
}

16
internal/sourcertmp/source.go

@ -195,7 +195,7 @@ func (s *Source) runInner() bool { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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)
}

Loading…
Cancel
Save