diff --git a/go.mod b/go.mod index b811d16..036c97b 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/at-wat/ebml-go v0.11.0 github.com/gorilla/websocket v1.4.2 github.com/pion/ice/v2 v2.0.7 - github.com/pion/rtcp v1.2.4 + github.com/pion/rtcp v1.2.5 github.com/pion/rtp v1.6.1 github.com/pion/webrtc/v3 v3.0.0-beta.7 golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a diff --git a/go.sum b/go.sum index 30bec07..0cfaa93 100644 --- a/go.sum +++ b/go.sum @@ -124,6 +124,8 @@ github.com/pion/randutil v0.1.0 h1:CFG1UdESneORglEsnimhUjf33Rwjubwj6xfiOXBa3mA= github.com/pion/randutil v0.1.0/go.mod h1:XcJrSMMbbMRhASFVOlj/5hQial/Y8oH/HVo7TBZq+j8= github.com/pion/rtcp v1.2.4 h1:NT3H5LkUGgaEapvp0HGik+a+CpflRF7KTD7H+o7OWIM= github.com/pion/rtcp v1.2.4/go.mod h1:52rMNPWFsjr39z9B9MhnkqhPLoeHTv1aN63o/42bWE0= +github.com/pion/rtcp v1.2.5 h1:CbZu6JujwnFUkvpJHh/0ypzKla45KX3nPnvXBe4P0hQ= +github.com/pion/rtcp v1.2.5/go.mod h1:52rMNPWFsjr39z9B9MhnkqhPLoeHTv1aN63o/42bWE0= github.com/pion/rtp v1.6.1 h1:2Y2elcVBrahYnHKN2X7rMHX/r1R4TEBMP1LaVu/wNhk= github.com/pion/rtp v1.6.1/go.mod h1:bDb5n+BFZxXx0Ea7E5qe+klMuqiBrP+w8XSjiWtCUko= github.com/pion/sctp v1.7.10/go.mod h1:EhpTUQu1/lcK3xI+eriS6/96fWetHGCvBi9MSsnaBN0= diff --git a/packetcache/packetcache_test.go b/packetcache/packetcache_test.go index c6bd7f3..9fc4c50 100644 --- a/packetcache/packetcache_test.go +++ b/packetcache/packetcache_test.go @@ -350,15 +350,14 @@ func TestBitmapPacket(t *testing.T) { } p := rtcp.NackPair{first, rtcp.PacketBitmap(bitmap)} - pl := p.PacketList() - - for _, s := range pl { + p.Range(func (s uint16) bool { if s < 42 || s >= 42+64 { if (value & (1 << (s - 42))) != 0 { t.Errorf("Bit %v unexpectedly set", s-42) } } - } + return true + }) } func BenchmarkCachePutGet(b *testing.B) { diff --git a/rtpconn/rtpconn.go b/rtpconn/rtpconn.go index 7fead3a..e399e26 100644 --- a/rtpconn/rtpconn.go +++ b/rtpconn/rtpconn.go @@ -573,23 +573,24 @@ func gotNACK(conn *rtpDownConnection, track *rtpDownTrack, p *rtcp.TransportLaye var packet rtp.Packet buf := make([]byte, packetcache.BufSize) for _, nack := range p.Nacks { - for _, seqno := range nack.PacketList() { + nack.Range(func (seqno uint16) bool { l := track.remote.GetRTP(seqno, buf) if l == 0 { unhandled = append(unhandled, seqno) - continue + return true } err := packet.Unmarshal(buf[:l]) if err != nil { - continue + return true } err = track.track.WriteRTP(&packet) if err != nil { log.Printf("WriteRTP: %v", err) - continue + return false } track.rate.Accumulate(uint32(l)) - } + return true + }) } if len(unhandled) == 0 { return