config: reject unknown send_side_bwe_pacer, warn on unwired fallback (#4804)
send_side_bwe_pacer accepted any string and silently ran no-queue. leaky-bucket is a defined PacerBehavior with a full LeakyBucket implementation, but the selection switch in NewPCTransport only handled pass-through and no-queue, so both leaky-bucket and outright typos fell through to the default with no diagnostic. leaky-bucket is deliberately left unwired here. LeakyBucket paces to a bitrate supplied via Pacer.SetBitrate, and no production code calls SetBitrate or SetInterval -- Base no-ops both and the only caller in the tree is the test-only capturingPacer. Wiring it as-is would pace at a static bitrate and ignore the bandwidth estimate, which is worse than the fallback. Instead, make the existing behaviour visible: CongestionControlConfig.Validate rejects unrecognised values at startup, the fallback logs a warning naming the requested pacer, and config-sample.yaml documents send_side_bwe_pacer and use_send_side_bwe for the first time. Refs #4724 Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
ad54223d1b
commit
aa08becc6a
@@ -220,6 +220,22 @@ type CongestionControlConfig struct {
|
||||
SendSideBWE sendsidebwe.SendSideBWEConfig `yaml:"send_side_bwe,omitempty"`
|
||||
}
|
||||
|
||||
// Validate reports configuration that would otherwise be ignored at runtime.
|
||||
func (c CongestionControlConfig) Validate() error {
|
||||
switch pacer.PacerBehavior(c.SendSideBWEPacer) {
|
||||
case "", pacer.PacerBehaviorPassThrough, pacer.PacerBehaviorNoQueue, pacer.PacerBehaviorLeakybucket:
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf(
|
||||
"invalid send_side_bwe_pacer %q, must be one of %q, %q, %q",
|
||||
c.SendSideBWEPacer,
|
||||
pacer.PacerBehaviorPassThrough,
|
||||
pacer.PacerBehaviorNoQueue,
|
||||
pacer.PacerBehaviorLeakybucket,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
type PlayoutDelayConfig struct {
|
||||
Enabled bool `yaml:"enabled,omitempty"`
|
||||
Min int `yaml:"min,omitempty"`
|
||||
@@ -671,6 +687,10 @@ func NewConfig(confString string, strictMode bool, c *cli.Command, baseFlags []c
|
||||
return nil, fmt.Errorf("could not validate RTC config: %v", err)
|
||||
}
|
||||
|
||||
if err := conf.RTC.CongestionControl.Validate(); err != nil {
|
||||
return nil, fmt.Errorf("could not validate congestion control config: %v", err)
|
||||
}
|
||||
|
||||
conf.NormalizeTURNTTLs()
|
||||
|
||||
// expand env vars in filenames
|
||||
|
||||
Reference in New Issue
Block a user