Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
tyohan committed Oct 21, 2024
1 parent 7f5123a commit 23203f8
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 23 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ require (
require (
github.com/jaevor/go-nanoid v1.3.0
github.com/pion/ice/v3 v3.0.16
github.com/pion/ice/v4 v4.0.2
github.com/pion/turn/v3 v3.0.3
github.com/pion/webrtc/v4 v4.0.0-beta.34
golang.org/x/exp v0.0.0-20230905200255-921286631fa9
Expand All @@ -22,7 +23,6 @@ require (

require (
github.com/pion/dtls/v3 v3.0.3 // indirect
github.com/pion/ice/v4 v4.0.2 // indirect
github.com/pion/mdns/v2 v2.0.7 // indirect
github.com/pion/srtp/v3 v3.0.4 // indirect
github.com/pion/stun/v2 v2.0.0 // indirect
Expand Down
6 changes: 0 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@ 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/ice/v4 v4.0.1 h1:2d3tPoTR90F3TcGYeXUwucGlXI3hds96cwv4kjZmb9s=
github.com/pion/ice/v4 v4.0.1/go.mod h1:2dpakjpd7+74L5j3TAe6gvkbI5UIzOgAnkimm9SuHvA=
github.com/pion/ice/v4 v4.0.2 h1:1JhBRX8iQLi0+TfcavTjPjI6GO41MFn4CeTBX+Y9h5s=
github.com/pion/ice/v4 v4.0.2/go.mod h1:DCdqyzgtsDNYN6/3U8044j3U7qsJ9KFJC92VnOWHvXg=
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/interceptor v0.1.37 h1:aRA8Zpab/wE7/c0O3fh1PqY0AJI3fCSEM5lRWJVorwI=
github.com/pion/interceptor v0.1.37/go.mod h1:JzxbJ4umVTlZAf+/utHzNesY8tmRkM2lVmkS82TTj8Y=
github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY=
Expand Down Expand Up @@ -59,8 +55,6 @@ 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/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/pion/webrtc/v4 v4.0.0-beta.34 h1:C5GPomCKm5Xc3iGUsoMGq1oEmv9GYIeadDsel7Qw8B0=
github.com/pion/webrtc/v4 v4.0.0-beta.34/go.mod h1:SfNn8CcFxR6OUVjLXVslAQ3a3994JhyE3Hw1jAuqEto=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down
20 changes: 10 additions & 10 deletions packetbuffers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func TestAdd(t *testing.T) {
caches := NewPacketBuffers(ctx, minLatency, maxLatency, false, logging.NewDefaultLoggerFactory().NewLogger("sfu"))

for i, pkt := range packets {
rp := pool.NewPacket(&pkt.Header, pkt.Payload)
rp := pool.NewPacket(&pkt.Header, pkt.Payload, nil)
err := caches.Add(rp)
if i != 2 && i != 3 {
require.NoError(t, err)
Expand Down Expand Up @@ -84,7 +84,7 @@ func TestAddLost(t *testing.T) {
// drop packet 65533
continue
}
rp := pool.NewPacket(&pkt.Header, pkt.Payload)
rp := pool.NewPacket(&pkt.Header, pkt.Payload, nil)
err := caches.Add(rp)

if i != 2 && i != 3 {
Expand Down Expand Up @@ -133,7 +133,7 @@ func TestDuplicateAdd(t *testing.T) {
t.Log("packet sequence ", pkt.Header.SequenceNumber)
}

rp := pool.NewPacket(&pkt.Header, pkt.Payload)
rp := pool.NewPacket(&pkt.Header, pkt.Payload, nil)
err := caches.Add(rp)
if i == 2 || i == 3 {
require.EqualError(t, err, ErrPacketTooLate.Error())
Expand Down Expand Up @@ -179,7 +179,7 @@ func TestFlush(t *testing.T) {
caches := NewPacketBuffers(ctx, minLatency, maxLatency, false, logging.NewDefaultLoggerFactory().NewLogger("sfu"))

for i, pkt := range packets {
rp := pool.NewPacket(&pkt.Header, pkt.Payload)
rp := pool.NewPacket(&pkt.Header, pkt.Payload, nil)
err := caches.Add(rp)
if i != 2 && i != 3 {
require.NoError(t, err)
Expand Down Expand Up @@ -223,7 +223,7 @@ func TestFlushBetweenAdded(t *testing.T) {
sorted := make([]*Packet, 0)

for i, pkt := range packets {
rp := pool.NewPacket(&pkt.Header, pkt.Payload)
rp := pool.NewPacket(&pkt.Header, pkt.Payload, nil)
err := caches.Add(rp)
if i != 2 && i != 3 {
require.NoError(t, err)
Expand Down Expand Up @@ -280,7 +280,7 @@ func TestLatency(t *testing.T) {
// last sort call should return immediately
t.Log("packet sequence ", pkt.Header.SequenceNumber)
time.Sleep(2 * maxLatency)
rp := pool.NewPacket(&pkt.Header, pkt.Payload)
rp := pool.NewPacket(&pkt.Header, pkt.Payload, nil)
err := caches.Add(rp)
sortedPackets := caches.Flush()
sorted = append(sorted, sortedPackets...)
Expand All @@ -294,7 +294,7 @@ func TestLatency(t *testing.T) {
} else if pkt.Header.SequenceNumber == 0 {
// last sort call should return immediately
time.Sleep(2 * maxLatency)
rp := pool.NewPacket(&pkt.Header, pkt.Payload)
rp := pool.NewPacket(&pkt.Header, pkt.Payload, nil)
err := caches.Add(rp)
sortedPackets := caches.Flush()
sorted = append(sorted, sortedPackets...)
Expand All @@ -307,7 +307,7 @@ func TestLatency(t *testing.T) {
// 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)
} else {
rp := pool.NewPacket(&pkt.Header, pkt.Payload)
rp := pool.NewPacket(&pkt.Header, pkt.Payload, nil)
err := caches.Add(rp)
sortedPackets := caches.Flush()
sorted = append(sorted, sortedPackets...)
Expand Down Expand Up @@ -344,7 +344,7 @@ func BenchmarkPushPool(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
pkt := testPackets[i]
rp := pool.NewPacket(&pkt.Header, pkt.Payload)
rp := pool.NewPacket(&pkt.Header, pkt.Payload, nil)
_ = packetBuffers.Add(rp)
}

Expand All @@ -356,7 +356,7 @@ func BenchmarkPopPool(b *testing.B) {
packetBuffers := NewPacketBuffers(ctx, 10*time.Millisecond, 100*time.Millisecond, false, logging.NewDefaultLoggerFactory().NewLogger("sfu"))

for i := 0; i < b.N; i++ {
rp := pool.NewPacket(&rtp.Header{}, make([]byte, 1400))
rp := pool.NewPacket(&rtp.Header{}, make([]byte, 1400), nil)
packetBuffers.Add(rp)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/pacer/leakybucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func (p *LeakyBucketPacer) getQueue(ssrc uint32) *queue {
// Write sends a packet with header and payload the a previously registered
// stream.
func (p *LeakyBucketPacer) Write(header *rtp.Header, payload []byte, attributes interceptor.Attributes) (int, error) {
pkt := p.rtppool.NewPacket(header, payload)
pkt := p.rtppool.NewPacket(header, payload, attributes)

queue := p.getQueue(header.SSRC)
if queue == nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/rtppool/rtppool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func BenchmarkPacketManager(b *testing.B) {
var pool = New()
b.ResetTimer()
for i := 0; i < b.N; i++ {
p, _ := pool.PacketManager.NewPacket(header, payload)
p, _ := pool.PacketManager.NewPacket(header, payload, nil)

p.Release()
}
Expand Down
8 changes: 4 additions & 4 deletions track.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func newTrack(ctx context.Context, client *Client, trackRemote IRemoteTrack, min

for _, track := range tracks {
//nolint:ineffassign,staticcheck // packet is from the pool
packet := pool.NewPacket(&p.Header, p.Payload)
packet := pool.NewPacket(&p.Header, p.Payload, attrs)

copyPacket := pool.GetPacket()
copyPacket.Header = *packet.Header()
Expand All @@ -124,7 +124,7 @@ func newTrack(ctx context.Context, client *Client, trackRemote IRemoteTrack, min
}

//nolint:ineffassign // this is required
packet := pool.NewPacket(&p.Header, p.Payload)
packet := pool.NewPacket(&p.Header, p.Payload, attrs)

copyPacket := pool.GetPacket()
copyPacket.Header = *packet.Header()
Expand Down Expand Up @@ -574,7 +574,7 @@ func (t *SimulcastTrack) AddRemoteTrack(track IRemoteTrack, minWait, maxWait tim
tracks := t.base.clientTracks.GetTracks()
for _, track := range tracks {
//nolint:ineffassign,staticcheck // packet is from the pool
packet := t.base.pool.NewPacket(&p.Header, p.Payload)
packet := t.base.pool.NewPacket(&p.Header, p.Payload, attrs)

copyPacket := t.base.pool.GetPacket()
copyPacket.Header = *packet.Header()
Expand All @@ -588,7 +588,7 @@ func (t *SimulcastTrack) AddRemoteTrack(track IRemoteTrack, minWait, maxWait tim
}

//nolint:ineffassign // this is required
packet := t.base.pool.NewPacket(&p.Header, p.Payload)
packet := t.base.pool.NewPacket(&p.Header, p.Payload, attrs)

copyPacket := t.base.pool.GetPacket()
copyPacket.Header = *packet.Header()
Expand Down

0 comments on commit 23203f8

Please sign in to comment.