A minimum channel capacity config (#549)
This commit is contained in:
@@ -87,10 +87,11 @@ type PLIThrottleConfig struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type CongestionControlConfig struct {
|
type CongestionControlConfig struct {
|
||||||
Enabled bool `yaml:"enabled"`
|
Enabled bool `yaml:"enabled"`
|
||||||
AllowPause bool `yaml:"allow_pause"`
|
AllowPause bool `yaml:"allow_pause"`
|
||||||
UseSendSideBWE bool `yaml:"send_side_bandwidth_estimation,omitempty"`
|
UseSendSideBWE bool `yaml:"send_side_bandwidth_estimation,omitempty"`
|
||||||
ProbeMode CongestionControlProbeMode `yaml:"padding_mode,omitempty"`
|
ProbeMode CongestionControlProbeMode `yaml:"padding_mode,omitempty"`
|
||||||
|
MinChannelCapacity int64 `yaml:"min_channel_capacity,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type InterfacesConfig struct {
|
type InterfacesConfig struct {
|
||||||
|
|||||||
@@ -850,7 +850,16 @@ func (s *StreamAllocator) finalizeProbe() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *StreamAllocator) maybeBoostDeficientTracks() {
|
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 {
|
if availableChannelCapacity <= 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -897,6 +906,14 @@ func (s *StreamAllocator) allocateAllTracks() {
|
|||||||
update := NewStreamStateUpdate()
|
update := NewStreamStateUpdate()
|
||||||
|
|
||||||
availableChannelCapacity := s.committedChannelCapacity
|
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.
|
// 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 = NewChannelObserver("probe", s.params.Logger, NumRequiredEstimatesProbe, NackRatioThresholdProbe)
|
||||||
s.probeChannelObserver.SeedEstimate(s.lastReceivedEstimate)
|
s.probeChannelObserver.SeedEstimate(s.lastReceivedEstimate)
|
||||||
|
|
||||||
|
desiredRateBps := int(probeRateBps) + int(math.Max(float64(s.committedChannelCapacity), float64(expectedBandwidthUsage)))
|
||||||
s.probeClusterId = s.prober.AddCluster(
|
s.probeClusterId = s.prober.AddCluster(
|
||||||
int(s.committedChannelCapacity+probeRateBps),
|
desiredRateBps,
|
||||||
int(expectedBandwidthUsage),
|
int(expectedBandwidthUsage),
|
||||||
ProbeMinDuration,
|
ProbeMinDuration,
|
||||||
ProbeMaxDuration,
|
ProbeMaxDuration,
|
||||||
|
|||||||
Reference in New Issue
Block a user