Update deque and friends. (#3276)

This commit is contained in:
Raja Subramanian
2024-12-20 07:16:14 +05:30
committed by GitHub
parent 36338bab5c
commit c8b644934f
9 changed files with 61 additions and 49 deletions
+1 -1
View File
@@ -153,7 +153,7 @@ func NewBuffer(ssrc uint32, maxVideoPkts, maxAudioPkts int) *Buffer {
logger: l.WithComponent(sutils.ComponentPub).WithComponent(sutils.ComponentSFU),
}
b.readCond = sync.NewCond(&b.RWMutex)
b.extPackets.SetMinCapacity(7)
b.extPackets.SetBaseCap(128)
return b
}
+1 -1
View File
@@ -157,7 +157,7 @@ func NewProber(params ProberParams) *Prober {
p := &Prober{
params: params,
}
p.clusters.SetMinCapacity(2)
p.clusters.SetBaseCap(2)
return p
}
+2 -2
View File
@@ -20,7 +20,7 @@ type BitrateCalculator struct {
windowDuration time.Duration
duration time.Duration
windows *deque.Deque[bitrateWindow]
windows deque.Deque[bitrateWindow]
active bitrateWindow
bytes int
@@ -37,10 +37,10 @@ func NewBitrateCalculator(duration time.Duration, window time.Duration) *Bitrate
c := &BitrateCalculator{
duration: duration,
windowDuration: window,
windows: deque.New[bitrateWindow](windowCnt+1, windowCnt+1),
start: now,
active: bitrateWindow{start: now},
}
c.windows.SetBaseCap(windowCnt + 1)
return c
}
+1 -1
View File
@@ -47,7 +47,7 @@ func NewLeakyBucket(logger logger.Logger, bwe bwe.BWE, interval time.Duration, b
interval: interval,
bitrate: bitrate,
}
l.packets.SetMinCapacity(9)
l.packets.SetBaseCap(512)
go l.sendWorker()
return l
+1 -1
View File
@@ -40,7 +40,7 @@ func NewNoQueue(logger logger.Logger, bwe bwe.BWE) *NoQueue {
logger: logger,
wake: make(chan struct{}, 1),
}
n.packets.SetMinCapacity(9)
n.packets.SetBaseCap(512)
go n.sendWorker()
return n