diff --git a/go.mod b/go.mod index 8b878b0f..cfc5dc6e 100644 --- a/go.mod +++ b/go.mod @@ -10,8 +10,8 @@ require ( github.com/alecthomas/kong v1.12.1 github.com/asticode/go-astits v1.13.0 github.com/bluenviron/gohlslib/v2 v2.2.2 - github.com/bluenviron/gortsplib/v4 v4.16.0 - github.com/bluenviron/mediacommon/v2 v2.4.0 + github.com/bluenviron/gortsplib/v4 v4.16.1 + github.com/bluenviron/mediacommon/v2 v2.4.1 github.com/datarhei/gosrt v0.9.0 github.com/fsnotify/fsnotify v1.9.0 github.com/gin-contrib/pprof v1.5.3 @@ -87,7 +87,7 @@ require ( github.com/xanzy/ssh-agent v0.3.3 // indirect github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect golang.org/x/arch v0.16.0 // indirect - golang.org/x/net v0.42.0 // indirect + golang.org/x/net v0.43.0 // indirect golang.org/x/text v0.28.0 // indirect golang.org/x/time v0.9.0 // indirect google.golang.org/protobuf v1.36.6 // indirect diff --git a/go.sum b/go.sum index a30ba1de..7fc1b9f8 100644 --- a/go.sum +++ b/go.sum @@ -35,10 +35,10 @@ github.com/benburkert/openpgp v0.0.0-20160410205803-c2471f86866c h1:8XZeJrs4+ZYh github.com/benburkert/openpgp v0.0.0-20160410205803-c2471f86866c/go.mod h1:x1vxHcL/9AVzuk5HOloOEPrtJY0MaalYr78afXZ+pWI= github.com/bluenviron/gohlslib/v2 v2.2.2 h1:Q86VloPjwONKF8pu6jSEh9ENm4UzdMl5SzYvtjneL5k= github.com/bluenviron/gohlslib/v2 v2.2.2/go.mod h1:3Lby/VMDD/cN0B3uJPd3bEEiJZ34LqXs71FEvN/fq2k= -github.com/bluenviron/gortsplib/v4 v4.16.0 h1:qzJxlZXCv11oxNkNTAFMaeX0uEXJE0L6lDv3CKUYT/k= -github.com/bluenviron/gortsplib/v4 v4.16.0/go.mod h1:pcSNf/GToNEwdWy74moR4Tp5JWIEDJ0d9CzCSUPkiwM= -github.com/bluenviron/mediacommon/v2 v2.4.0 h1:Ss1T7AMxTrICJ+a/N5urS/1lp1ZpsF+3iJq3B/RLDMw= -github.com/bluenviron/mediacommon/v2 v2.4.0/go.mod h1:a6MbPmXtYda9mKibKVMZlW20GYLLrX2R7ZkUE+1pwV0= +github.com/bluenviron/gortsplib/v4 v4.16.1 h1:1uqWp+0we2OKp/fWaWXhBSpqdhEtZSk7g96nAA3iayk= +github.com/bluenviron/gortsplib/v4 v4.16.1/go.mod h1:Vm07yUMys9XKnuZJLfTT8zluAN2n9ZOtz40Xb8RKh+8= +github.com/bluenviron/mediacommon/v2 v2.4.1 h1:PsKrO/c7hDjXxiOGRUBsYtMGNb4lKWIFea6zcOchoVs= +github.com/bluenviron/mediacommon/v2 v2.4.1/go.mod h1:a6MbPmXtYda9mKibKVMZlW20GYLLrX2R7ZkUE+1pwV0= github.com/bytedance/sonic v1.13.2 h1:8/H1FempDZqC4VqjptGo14QQlJx8VdZJegxs6wwfqpQ= github.com/bytedance/sonic v1.13.2/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4= github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= @@ -228,8 +228,8 @@ golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4= golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= -golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= +golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= +golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/internal/protocols/webrtc/incoming_track.go b/internal/protocols/webrtc/incoming_track.go index d391fb5f..2a9ac384 100644 --- a/internal/protocols/webrtc/incoming_track.go +++ b/internal/protocols/webrtc/incoming_track.go @@ -5,7 +5,6 @@ import ( "time" "github.com/bluenviron/gortsplib/v4/pkg/rtcpreceiver" - "github.com/bluenviron/gortsplib/v4/pkg/rtpreorderer" "github.com/pion/rtcp" "github.com/pion/rtp" "github.com/pion/webrtc/v4" @@ -287,8 +286,9 @@ func (t *IncomingTrack) start() { t.packetsLost.Start() t.rtcpReceiver = &rtcpreceiver.RTCPReceiver{ - ClockRate: int(t.track.SSRC()), - Period: 1 * time.Second, + ClockRate: int(t.track.SSRC()), + UnrealiableTransport: true, + Period: 1 * time.Second, WritePacketRTCP: func(p rtcp.Packet) { t.writeRTCP([]rtcp.Packet{p}) //nolint:errcheck }, @@ -342,29 +342,24 @@ func (t *IncomingTrack) start() { // read incoming RTP packets. go func() { - reorderer := &rtpreorderer.Reorderer{} - reorderer.Initialize() - for { pkt, _, err2 := t.track.ReadRTP() if err2 != nil { return } - packets, lost := reorderer.Process(pkt) - if lost != 0 { - atomic.AddUint64(t.rtpPacketsLost, uint64(lost)) - t.packetsLost.Add(uint64(lost)) - // do not return - } - - atomic.AddUint64(t.rtpPacketsReceived, uint64(len(packets))) - - err2 = t.rtcpReceiver.ProcessPacket(pkt, time.Now(), true) + packets, lost, err2 := t.rtcpReceiver.ProcessPacket2(pkt, time.Now(), true) if err2 != nil { t.log.Log(logger.Warn, err2.Error()) continue } + if lost != 0 { + atomic.AddUint64(t.rtpPacketsLost, lost) + t.packetsLost.Add(lost) + // do not return + } + + atomic.AddUint64(t.rtpPacketsReceived, uint64(len(packets))) var ntp time.Time if t.useAbsoluteTimestamp {