1
Fork 0

Upgrade pion/rtcp, use nack.Range instead of PacketList.

This commit is contained in:
Juliusz Chroboczek 2020-12-03 23:46:19 +01:00
parent f0cbe9c0c1
commit 120bfc92c7
4 changed files with 12 additions and 10 deletions

2
go.mod
View File

@ -6,7 +6,7 @@ require (
github.com/at-wat/ebml-go v0.11.0 github.com/at-wat/ebml-go v0.11.0
github.com/gorilla/websocket v1.4.2 github.com/gorilla/websocket v1.4.2
github.com/pion/ice/v2 v2.0.7 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/rtp v1.6.1
github.com/pion/webrtc/v3 v3.0.0-beta.7 github.com/pion/webrtc/v3 v3.0.0-beta.7
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a

2
go.sum
View File

@ -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/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 h1:NT3H5LkUGgaEapvp0HGik+a+CpflRF7KTD7H+o7OWIM=
github.com/pion/rtcp v1.2.4/go.mod h1:52rMNPWFsjr39z9B9MhnkqhPLoeHTv1aN63o/42bWE0= 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 h1:2Y2elcVBrahYnHKN2X7rMHX/r1R4TEBMP1LaVu/wNhk=
github.com/pion/rtp v1.6.1/go.mod h1:bDb5n+BFZxXx0Ea7E5qe+klMuqiBrP+w8XSjiWtCUko= 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= github.com/pion/sctp v1.7.10/go.mod h1:EhpTUQu1/lcK3xI+eriS6/96fWetHGCvBi9MSsnaBN0=

View File

@ -350,15 +350,14 @@ func TestBitmapPacket(t *testing.T) {
} }
p := rtcp.NackPair{first, rtcp.PacketBitmap(bitmap)} p := rtcp.NackPair{first, rtcp.PacketBitmap(bitmap)}
pl := p.PacketList() p.Range(func (s uint16) bool {
for _, s := range pl {
if s < 42 || s >= 42+64 { if s < 42 || s >= 42+64 {
if (value & (1 << (s - 42))) != 0 { if (value & (1 << (s - 42))) != 0 {
t.Errorf("Bit %v unexpectedly set", s-42) t.Errorf("Bit %v unexpectedly set", s-42)
} }
} }
} return true
})
} }
func BenchmarkCachePutGet(b *testing.B) { func BenchmarkCachePutGet(b *testing.B) {

View File

@ -573,23 +573,24 @@ func gotNACK(conn *rtpDownConnection, track *rtpDownTrack, p *rtcp.TransportLaye
var packet rtp.Packet var packet rtp.Packet
buf := make([]byte, packetcache.BufSize) buf := make([]byte, packetcache.BufSize)
for _, nack := range p.Nacks { for _, nack := range p.Nacks {
for _, seqno := range nack.PacketList() { nack.Range(func (seqno uint16) bool {
l := track.remote.GetRTP(seqno, buf) l := track.remote.GetRTP(seqno, buf)
if l == 0 { if l == 0 {
unhandled = append(unhandled, seqno) unhandled = append(unhandled, seqno)
continue return true
} }
err := packet.Unmarshal(buf[:l]) err := packet.Unmarshal(buf[:l])
if err != nil { if err != nil {
continue return true
} }
err = track.track.WriteRTP(&packet) err = track.track.WriteRTP(&packet)
if err != nil { if err != nil {
log.Printf("WriteRTP: %v", err) log.Printf("WriteRTP: %v", err)
continue return false
} }
track.rate.Accumulate(uint32(l)) track.rate.Accumulate(uint32(l))
} return true
})
} }
if len(unhandled) == 0 { if len(unhandled) == 0 {
return return