diff --git a/clienttracksimulcast.go b/clienttracksimulcast.go index 642878d..4591d67 100644 --- a/clienttracksimulcast.go +++ b/clienttracksimulcast.go @@ -141,7 +141,7 @@ func (t *simulcastClientTrack) push(p *rtp.Packet, quality QualityLevel) { var canSwitch bool - if isKeyframe && quality == targetQuality && t.lastQuality.Load() != uint32(targetQuality) { + if isKeyframe && quality == targetQuality && currentQuality != targetQuality { switch quality { case QualityHigh: canSwitch = t.packetmapHigh.Drop(p.SequenceNumber, 0) @@ -152,24 +152,29 @@ func (t *simulcastClientTrack) push(p *rtp.Packet, quality QualityLevel) { } } + var ok bool + // var newSeqNo uint16 + if !canSwitch { switch quality { case QualityHigh: - ok, _, _ := t.packetmapHigh.Map(p.SequenceNumber, 0) + ok, _, _ = t.packetmapHigh.Map(p.SequenceNumber, 0) if !ok { return } case QualityMid: - ok, _, _ := t.packetmapMid.Map(p.SequenceNumber, 0) + ok, _, _ = t.packetmapMid.Map(p.SequenceNumber, 0) if !ok { return } case QualityLow: - ok, _, _ := t.packetmapLow.Map(p.SequenceNumber, 0) + ok, _, _ = t.packetmapLow.Map(p.SequenceNumber, 0) if !ok { return } } + + // p.SequenceNumber = newSeqNo } // check if it's a first packet to send @@ -194,13 +199,13 @@ func (t *simulcastClientTrack) push(p *rtp.Packet, quality QualityLevel) { }) } else if isKeyframe && canSwitch && quality == targetQuality && t.lastQuality.Load() != uint32(targetQuality) { // change quality to target quality if it's a keyframe - t.client.log.Infof("track: ", t.id, " keyframe ", isKeyframe, " change quality from ", t.lastQuality.Load(), " to ", targetQuality) + t.client.log.Tracef("track: %s keyframe %v change quality from %d to %d ", t.id, isKeyframe, t.lastQuality.Load(), targetQuality) currentQuality = targetQuality t.lastQuality.Store(uint32(currentQuality)) } else if quality == targetQuality && !isKeyframe && t.lastQuality.Load() != uint32(targetQuality) { // request PLI to allow us switch quality to target quality - t.client.log.Infof("track: ", t.id, " keyframe ", isKeyframe, " send keyframe and sequence number ", p.SequenceNumber) + t.client.log.Tracef("track: %s keyframe %v send keyframe and sequence number %d and can switch %v ", t.id, isKeyframe, p.SequenceNumber, canSwitch) t.remoteTrack.sendPLI() } diff --git a/codec.go b/codec.go index 7daa5a2..452e354 100644 --- a/codec.go +++ b/codec.go @@ -2,7 +2,9 @@ package sfu import ( "encoding/binary" + "log" "strings" + "time" "github.com/pion/rtp" "github.com/pion/rtp/codecs" @@ -209,7 +211,7 @@ func getH264BlankFrame() []byte { } // reuse from pion media engine and media sample -func payloaderForCodec(codec webrtc.RTPCodecCapability) (rtp.Payloader, error) { +func PayloaderForCodec(codec webrtc.RTPCodecCapability) (rtp.Payloader, error) { switch strings.ToLower(codec.MimeType) { case strings.ToLower(webrtc.MimeTypeH264): return &codecs.H264Payloader{}, nil @@ -232,25 +234,12 @@ func payloaderForCodec(codec webrtc.RTPCodecCapability) (rtp.Payloader, error) { } } -func SendBlackImageFrames(startSequence uint16, localRTP *webrtc.TrackLocalStaticRTP, sample *media.Sample) (uint16, error) { - sequencer := rtp.NewFixedSequencer(startSequence) - payloader, _ := payloaderForCodec(localRTP.Codec()) - p := rtp.NewPacketizer( - 1450, - 0, // Value is handled when writing - 0, // Value is handled when writing - payloader, - sequencer, - localRTP.Codec().ClockRate, - ) - +func SendMediaSamples(p rtp.Packetizer, sequencer rtp.Sequencer, localRTP *webrtc.TrackLocalStaticRTP, sample media.Sample) error { clockRate := localRTP.Codec().ClockRate - lastSequenceNumber := startSequence - // skip packets by the number of previously dropped packets for i := uint16(0); i < sample.PrevDroppedPackets; i++ { - lastSequenceNumber = sequencer.NextSequenceNumber() + sequencer.NextSequenceNumber() } samples := uint32(sample.Duration.Seconds()) * clockRate @@ -261,13 +250,27 @@ func SendBlackImageFrames(startSequence uint16, localRTP *webrtc.TrackLocalStati packets := p.Packetize(sample.Data, samples) writeErrs := []error{} + + framerate := 30 + + if localRTP.Kind() == webrtc.RTPCodecTypeAudio { + framerate = 50 + } + + frameDuration := time.Duration(1000/framerate) * time.Millisecond + + ticker := time.NewTicker(frameDuration) + defer ticker.Stop() + for _, p := range packets { if err := localRTP.WriteRTP(p); err != nil { + log.Println("send packet size: ", len(p.Payload)) writeErrs = append(writeErrs, err) } + <-ticker.C } - return lastSequenceNumber + uint16(len(packets)), FlattenErrors(writeErrs) + return FlattenErrors(writeErrs) } func getPayloadType(mimeType string) webrtc.PayloadType { diff --git a/go.mod b/go.mod index 9d53f51..1ad5b95 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ go 1.21 // replace github.com/pion/interceptor => ../../pion/pion-interceptor require ( - github.com/pion/interceptor v0.1.29 + github.com/pion/interceptor v0.1.36 github.com/pion/rtcp v1.2.14 github.com/stretchr/testify v1.9.0 ) @@ -15,17 +15,20 @@ require ( github.com/jaevor/go-nanoid v1.3.0 github.com/pion/ice/v3 v3.0.16 github.com/pion/turn/v3 v3.0.3 - github.com/pion/webrtc/v4 v4.0.0-beta.27 + github.com/pion/webrtc/v4 v4.0.0-beta.32 golang.org/x/exp v0.0.0-20230905200255-921286631fa9 - golang.org/x/text v0.16.0 + golang.org/x/text v0.19.0 ) require ( - github.com/pion/dtls/v3 v3.0.0 // indirect + github.com/pion/dtls/v3 v3.0.3 // indirect + github.com/pion/ice/v4 v4.0.1 // indirect github.com/pion/mdns/v2 v2.0.7 // indirect - github.com/pion/srtp/v3 v3.0.3 // indirect + github.com/pion/srtp/v3 v3.0.4 // indirect github.com/pion/stun/v2 v2.0.0 // indirect + github.com/pion/stun/v3 v3.0.0 // indirect github.com/pion/transport/v3 v3.0.7 // indirect + github.com/pion/turn/v4 v4.0.0 // indirect github.com/wlynxg/anet v0.0.3 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect ) @@ -33,17 +36,17 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/google/uuid v1.6.0 - github.com/pion/datachannel v1.5.8 // indirect + github.com/pion/datachannel v1.5.9 // indirect github.com/pion/dtls/v2 v2.2.12 // indirect github.com/pion/logging v0.2.2 github.com/pion/randutil v0.1.0 // indirect - github.com/pion/rtp v1.8.8 - github.com/pion/sctp v1.8.20 // indirect + github.com/pion/rtp v1.8.9 + github.com/pion/sctp v1.8.33 // indirect github.com/pion/sdp/v3 v3.0.9 github.com/pion/transport/v2 v2.2.8 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/crypto v0.25.0 // indirect - golang.org/x/net v0.27.0 // direct - golang.org/x/sys v0.22.0 + golang.org/x/crypto v0.28.0 // indirect + golang.org/x/net v0.29.0 // direct + golang.org/x/sys v0.26.0 gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 3b597a4..d78ae70 100644 --- a/go.sum +++ b/go.sum @@ -11,17 +11,19 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pion/datachannel v1.5.8 h1:ph1P1NsGkazkjrvyMfhRBUAWMxugJjq2HfQifaOoSNo= -github.com/pion/datachannel v1.5.8/go.mod h1:PgmdpoaNBLX9HNzNClmdki4DYW5JtI7Yibu8QzbL3tI= +github.com/pion/datachannel v1.5.9 h1:LpIWAOYPyDrXtU+BW7X0Yt/vGtYxtXQ8ql7dFfYUVZA= +github.com/pion/datachannel v1.5.9/go.mod h1:kDUuk4CU4Uxp82NH4LQZbISULkX/HtzKa4P7ldf9izE= github.com/pion/dtls/v2 v2.2.7/go.mod h1:8WiMkebSHFD0T+dIU+UeBaoV7kDhOW5oDCzZ7WZ/F9s= github.com/pion/dtls/v2 v2.2.12 h1:KP7H5/c1EiVAAKUmXyCzPiQe5+bCJrpOeKg/L05dunk= github.com/pion/dtls/v2 v2.2.12/go.mod h1:d9SYc9fch0CqK90mRk1dC7AkzzpwJj6u2GU3u+9pqFE= -github.com/pion/dtls/v3 v3.0.0 h1:m2hzwPkzqoBjVKXm5ymNuX01OAjht82TdFL6LoTzgi4= -github.com/pion/dtls/v3 v3.0.0/go.mod h1:tiX7NaneB0wNoRaUpaMVP7igAlkMCTQkbpiY+OfeIi0= +github.com/pion/dtls/v3 v3.0.3 h1:j5ajZbQwff7Z8k3pE3S+rQ4STvKvXUdKsi/07ka+OWM= +github.com/pion/dtls/v3 v3.0.3/go.mod h1:weOTUyIV4z0bQaVzKe8kpaP17+us3yAuiQsEAG1STMU= github.com/pion/ice/v3 v3.0.16 h1:YoPlNg3jU1UT/DDTa9v/g1vH6A2/pAzehevI1o66H8E= github.com/pion/ice/v3 v3.0.16/go.mod h1:SdmubtIsCcvdb1ZInrTUz7Iaqi90/rYd1pzbzlMxsZg= -github.com/pion/interceptor v0.1.29 h1:39fsnlP1U8gw2JzOFWdfCU82vHvhW9o0rZnZF56wF+M= -github.com/pion/interceptor v0.1.29/go.mod h1:ri+LGNjRUc5xUNtDEPzfdkmSqISixVTBF/z/Zms/6T4= +github.com/pion/ice/v4 v4.0.1 h1:2d3tPoTR90F3TcGYeXUwucGlXI3hds96cwv4kjZmb9s= +github.com/pion/ice/v4 v4.0.1/go.mod h1:2dpakjpd7+74L5j3TAe6gvkbI5UIzOgAnkimm9SuHvA= +github.com/pion/interceptor v0.1.36 h1:WNOZUs5Vec3+NHeY6uGo4nvbxCcRglrI//DlUwLnl/M= +github.com/pion/interceptor v0.1.36/go.mod h1:JzxbJ4umVTlZAf+/utHzNesY8tmRkM2lVmkS82TTj8Y= github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY= github.com/pion/logging v0.2.2/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms= github.com/pion/mdns/v2 v2.0.7 h1:c9kM8ewCgjslaAmicYMFQIde2H9/lrZpjBkN8VwoVtM= @@ -30,16 +32,18 @@ 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.14 h1:KCkGV3vJ+4DAJmvP0vaQShsb0xkRfWkO540Gy102KyE= github.com/pion/rtcp v1.2.14/go.mod h1:sn6qjxvnwyAkkPzPULIbVqSKI5Dv54Rv7VG0kNxh9L4= -github.com/pion/rtp v1.8.8 h1:EtYFHI0rpUEjT/RMnGfb1vdJhbYmPG77szD72uUnSxs= -github.com/pion/rtp v1.8.8/go.mod h1:pBGHaFt/yW7bf1jjWAoUjpSNoDnw98KTMg+jWWvziqU= -github.com/pion/sctp v1.8.20 h1:sOc3lkV/tQaP57ZUEXIMdM2V92IIB2ia5v/ygnBxaEg= -github.com/pion/sctp v1.8.20/go.mod h1:oTxw8i5m+WbDHZJL/xUpe6CPIn1Y0GIKKwTLF4h53H8= +github.com/pion/rtp v1.8.9 h1:E2HX740TZKaqdcPmf4pw6ZZuG8u5RlMMt+l3dxeu6Wk= +github.com/pion/rtp v1.8.9/go.mod h1:pBGHaFt/yW7bf1jjWAoUjpSNoDnw98KTMg+jWWvziqU= +github.com/pion/sctp v1.8.33 h1:dSE4wX6uTJBcNm8+YlMg7lw1wqyKHggsP5uKbdj+NZw= +github.com/pion/sctp v1.8.33/go.mod h1:beTnqSzewI53KWoG3nqB282oDMGrhNxBdb+JZnkCwRM= github.com/pion/sdp/v3 v3.0.9 h1:pX++dCHoHUwq43kuwf3PyJfHlwIj4hXA7Vrifiq0IJY= github.com/pion/sdp/v3 v3.0.9/go.mod h1:B5xmvENq5IXJimIO4zfp6LAe1fD9N+kFv+V/1lOdz8M= -github.com/pion/srtp/v3 v3.0.3 h1:tRtEOpmR8NtsB/KndlKXFOj/AIIs6aPrCq4TlAatC4M= -github.com/pion/srtp/v3 v3.0.3/go.mod h1:Bp9ztzPCoE0ETca/R+bTVTO5kBgaQMiQkTmZWwazDTc= +github.com/pion/srtp/v3 v3.0.4 h1:2Z6vDVxzrX3UHEgrUyIGM4rRouoC7v+NiF1IHtp9B5M= +github.com/pion/srtp/v3 v3.0.4/go.mod h1:1Jx3FwDoxpRaTh1oRV8A/6G1BnFL+QI82eK4ms8EEJQ= github.com/pion/stun/v2 v2.0.0 h1:A5+wXKLAypxQri59+tmQKVs7+l6mMM+3d+eER9ifRU0= github.com/pion/stun/v2 v2.0.0/go.mod h1:22qRSh08fSEttYUmJZGlriq9+03jtVmXNODgLccj8GQ= +github.com/pion/stun/v3 v3.0.0 h1:4h1gwhWLWuZWOJIJR9s2ferRO+W3zA/b6ijOI6mKzUw= +github.com/pion/stun/v3 v3.0.0/go.mod h1:HvCN8txt8mwi4FBvS3EmDghW6aQJ24T+y+1TKjB5jyU= github.com/pion/transport/v2 v2.2.1/go.mod h1:cXXWavvCnFF6McHTft3DWS9iic2Mftcz1Aq29pGcU5g= github.com/pion/transport/v2 v2.2.4/go.mod h1:q2U/tf9FEfnSBGSW6w5Qp5PFWRLRj3NjLhCCgpRK4p0= github.com/pion/transport/v2 v2.2.8 h1:HzsqGBChgtF4Cj47gu51l5hONuK/NwgbZL17CMSuwS0= @@ -49,8 +53,10 @@ github.com/pion/transport/v3 v3.0.7 h1:iRbMH05BzSNwhILHoBoAPxoB9xQgOaJk+591KC9P1 github.com/pion/transport/v3 v3.0.7/go.mod h1:YleKiTZ4vqNxVwh77Z0zytYi7rXHl7j6uPLGhhz9rwo= github.com/pion/turn/v3 v3.0.3 h1:1e3GVk8gHZLPBA5LqadWYV60lmaKUaHCkm9DX9CkGcE= github.com/pion/turn/v3 v3.0.3/go.mod h1:vw0Dz420q7VYAF3J4wJKzReLHIo2LGp4ev8nXQexYsc= -github.com/pion/webrtc/v4 v4.0.0-beta.27 h1:dp5xUnzbNSI8VN0yADjrstHI+YBIgSLek28sv03MQzQ= -github.com/pion/webrtc/v4 v4.0.0-beta.27/go.mod h1:EOEk3QX1N2YmCsntm7aMFgqvUfkUyB9NK7PjfXlFBJY= +github.com/pion/turn/v4 v4.0.0 h1:qxplo3Rxa9Yg1xXDxxH8xaqcyGUtbHYw4QSCvmFWvhM= +github.com/pion/turn/v4 v4.0.0/go.mod h1:MuPDkm15nYSklKpN8vWJ9W2M0PlyQZqYt1McGuxG7mA= +github.com/pion/webrtc/v4 v4.0.0-beta.32 h1:SzNCX9zQXc/h67pZM+MysIKuDbo4nfWPj2ZVfIQkGFQ= +github.com/pion/webrtc/v4 v4.0.0-beta.32/go.mod h1:fvvgzjapV3O0Sb5+9QLs1pKdazJotFROycN4yJLfufU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -71,8 +77,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= +golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= +golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= @@ -85,8 +91,8 @@ golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -100,8 +106,8 @@ golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= @@ -116,8 +122,8 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= diff --git a/packetbuffers_test.go b/packetbuffers_test.go index f470b94..2c71544 100644 --- a/packetbuffers_test.go +++ b/packetbuffers_test.go @@ -195,7 +195,7 @@ func TestFlush(t *testing.T) { require.Equal(t, len(sortedNumbers), len(sorted), "sorted length should be equal to sortedNumbers length") for i, pkt := range sorted { - require.Equal(t, pkt.packet.Header().SequenceNumber, sortedNumbers[i], fmt.Sprintf("packet sequence number %d should be equal to sortedNumbers sequence number %d", pkt.packet.Header().SequenceNumber, sortedNumbers[i])) + require.Equal(t, pkt.Packet.Header().SequenceNumber, sortedNumbers[i], fmt.Sprintf("packet sequence number %d should be equal to sortedNumbers sequence number %d", pkt.Packet.Header().SequenceNumber, sortedNumbers[i])) } } @@ -243,7 +243,7 @@ func TestFlushBetweenAdded(t *testing.T) { require.Equal(t, len(sortedNumbers), len(sorted), "sorted length should be equal to sortedNumbers length") for i, pkt := range sorted { - require.Equal(t, pkt.packet.Header().SequenceNumber, sortedNumbers[i], fmt.Sprintf("packet sequence number %d should be equal to sortedNumbers sequence number %d", pkt.packet.Header().SequenceNumber, sortedNumbers[i])) + require.Equal(t, pkt.Packet.Header().SequenceNumber, sortedNumbers[i], fmt.Sprintf("packet sequence number %d should be equal to sortedNumbers sequence number %d", pkt.Packet.Header().SequenceNumber, sortedNumbers[i])) } } @@ -288,7 +288,7 @@ func TestLatency(t *testing.T) { dropped++ } for _, pkt := range sorted { - resultsSeqs = append(resultsSeqs, pkt.packet.Header().SequenceNumber) + resultsSeqs = append(resultsSeqs, pkt.Packet.Header().SequenceNumber) } require.Equal(t, 6, len(sorted), "sorted length should be equal to 6, result ", resultsSeqs, seqs) } else if pkt.Header.SequenceNumber == 0 { @@ -302,7 +302,7 @@ func TestLatency(t *testing.T) { dropped++ } for _, pkt := range sorted { - resultsSeqs = append(resultsSeqs, pkt.packet.Header().SequenceNumber) + resultsSeqs = append(resultsSeqs, pkt.Packet.Header().SequenceNumber) } // from 15 packets added, 3 packets will be dropped because it's too late require.Equal(t, 13, len(sorted), "sorted length should be equal to 13, result ", resultsSeqs, seqs) @@ -366,11 +366,11 @@ func BenchmarkPopPool(b *testing.B) { p := packetBuffers.Pop() if p != nil { rtp := pool.GetPacket() - rtp.Header = *p.packet.Header() - rtp.Payload = p.packet.Payload() + rtp.Header = *p.Packet.Header() + rtp.Payload = p.Packet.Payload() // b.Logf("packet sequence %d", rtpPacket.SequenceNumber) - p.packet.Release() + p.Packet.Release() pool.PutPacket(rtp) } diff --git a/testhelper.go b/testhelper.go index 986ec8f..d3ae89e 100644 --- a/testhelper.go +++ b/testhelper.go @@ -13,7 +13,7 @@ import ( "github.com/google/uuid" "github.com/inlivedev/sfu/pkg/interceptors/simulcast" - "github.com/pion/ice/v3" + "github.com/pion/ice/v4" "github.com/pion/interceptor" "github.com/pion/interceptor/pkg/stats" "github.com/pion/logging"