mirror of
https://github.com/livekit/livekit.git
synced 2026-10-22 17:32:23 +00:00
A minimum channel capacity config (#549)
This commit is contained in:
1 parent
825d3cdbea
commit
0a88dee95e
2 files changed
+25
-6
No files matched your search
@@ -87,10 +87,11 @@ type PLIThrottleConfig struct {
|
||||
}
|
||||
|
||||
type CongestionControlConfig struct {
|
||||
Enabled bool `yaml:"enabled"`
|
||||
AllowPause bool `yaml:"allow_pause"`
|
||||
UseSendSideBWE bool `yaml:"send_side_bandwidth_estimation,omitempty"`
|
||||
ProbeMode CongestionControlProbeMode `yaml:"padding_mode,omitempty"`
|
||||
Enabled bool `yaml:"enabled"`
|
||||
AllowPause bool `yaml:"allow_pause"`
|
||||
UseSendSideBWE bool `yaml:"send_side_bandwidth_estimation,omitempty"`
|
||||
ProbeMode CongestionControlProbeMode `yaml:"padding_mode,omitempty"`
|
||||
MinChannelCapacity int64 `yaml:"min_channel_capacity,omitempty"`
|
||||
}
|
||||
|
||||
type InterfacesConfig struct {
|
||||
|
||||
@@ -850,7 +850,16 @@ func (s *StreamAllocator) finalizeProbe() {
|
||||
}
|
||||
|
||||
func (s *StreamAllocator) maybeBoostDeficientTracks() {
|
||||
availableChannelCapacity := s.committedChannelCapacity - s.getExpectedBandwidthUsage()
|
||||
committedChannelCapacity := s.committedChannelCapacity
|
||||
if s.params.Config.MinChannelCapacity > committedChannelCapacity {
|
||||
committedChannelCapacity = s.params.Config.MinChannelCapacity
|
||||
s.params.Logger.Debugw(
|
||||
"overriding channel capacity",
|
||||
"actual", s.committedChannelCapacity,
|
||||
"override", committedChannelCapacity,
|
||||
)
|
||||
}
|
||||
availableChannelCapacity := committedChannelCapacity - s.getExpectedBandwidthUsage()
|
||||
if availableChannelCapacity <= 0 {
|
||||
return
|
||||
}
|
||||
@@ -897,6 +906,14 @@ func (s *StreamAllocator) allocateAllTracks() {
|
||||
update := NewStreamStateUpdate()
|
||||
|
||||
availableChannelCapacity := s.committedChannelCapacity
|
||||
if s.params.Config.MinChannelCapacity > availableChannelCapacity {
|
||||
availableChannelCapacity = s.params.Config.MinChannelCapacity
|
||||
s.params.Logger.Debugw(
|
||||
"overriding channel capacity",
|
||||
"actual", s.committedChannelCapacity,
|
||||
"override", availableChannelCapacity,
|
||||
)
|
||||
}
|
||||
|
||||
//
|
||||
// This pass is find out if there is any leftover channel capacity after allocating exempt tracks.
|
||||
@@ -1011,8 +1028,9 @@ func (s *StreamAllocator) initProbe(probeRateBps int64) {
|
||||
s.probeChannelObserver = NewChannelObserver("probe", s.params.Logger, NumRequiredEstimatesProbe, NackRatioThresholdProbe)
|
||||
s.probeChannelObserver.SeedEstimate(s.lastReceivedEstimate)
|
||||
|
||||
desiredRateBps := int(probeRateBps) + int(math.Max(float64(s.committedChannelCapacity), float64(expectedBandwidthUsage)))
|
||||
s.probeClusterId = s.prober.AddCluster(
|
||||
int(s.committedChannelCapacity+probeRateBps),
|
||||
desiredRateBps,
|
||||
int(expectedBandwidthUsage),
|
||||
ProbeMinDuration,
|
||||
ProbeMaxDuration,
|
||||
|
||||
Reference in new issue
Block a user