Update deque and friends. (#3276)
This commit is contained in:
@@ -62,7 +62,7 @@ func NewPublicationMonitor(params PublicationMonitorParams) *PublicationMonitor
|
||||
params: params,
|
||||
isConnected: params.IsPeerConnectionConnected,
|
||||
}
|
||||
p.desiredPublishes.SetMinCapacity(2)
|
||||
p.desiredPublishes.SetBaseCap(4)
|
||||
return p
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ func NewProber(params ProberParams) *Prober {
|
||||
p := &Prober{
|
||||
params: params,
|
||||
}
|
||||
p.clusters.SetMinCapacity(2)
|
||||
p.clusters.SetBaseCap(2)
|
||||
return p
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"math/bits"
|
||||
"sync"
|
||||
|
||||
"github.com/gammazero/deque"
|
||||
@@ -81,12 +80,13 @@ type opsQueueBase[T opsQueueItem] struct {
|
||||
}
|
||||
|
||||
func newOpsQueueBase[T opsQueueItem](params OpsQueueParams) *opsQueueBase[T] {
|
||||
return &opsQueueBase[T]{
|
||||
o := &opsQueueBase[T]{
|
||||
params: params,
|
||||
ops: *deque.New[T](min(bits.Len64(uint64(params.MinSize-1)), 7)),
|
||||
wake: make(chan struct{}, 1),
|
||||
doneChan: make(chan struct{}),
|
||||
}
|
||||
o.ops.SetBaseCap(int(min(params.MinSize, 128)))
|
||||
return o
|
||||
}
|
||||
|
||||
func (oq *opsQueueBase[T]) Start() {
|
||||
|
||||
Reference in New Issue
Block a user