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
+14
-1
@@ -582,12 +582,25 @@ func NewPCTransport(params TransportParams) (*PCTransport, error) {
|
||||
Config: params.CongestionControlConfig.SendSideBWE,
|
||||
Logger: params.Logger,
|
||||
})
|
||||
switch pacer.PacerBehavior(params.CongestionControlConfig.SendSideBWEPacer) {
|
||||
switch behavior := pacer.PacerBehavior(params.CongestionControlConfig.SendSideBWEPacer); behavior {
|
||||
case pacer.PacerBehaviorPassThrough:
|
||||
t.pacer = pacer.NewPassThrough(params.Logger, t.bwe)
|
||||
case pacer.PacerBehaviorNoQueue:
|
||||
t.pacer = pacer.NewNoQueue(params.Logger, t.bwe)
|
||||
default:
|
||||
// leaky-bucket lands here: it is a recognized value, but LeakyBucket paces
|
||||
// to a bitrate set through Pacer.SetBitrate and nothing drives that from
|
||||
// the bandwidth estimate, so it would pace at a fixed rate and ignore
|
||||
// congestion. Unknown values are rejected by CongestionControlConfig.
|
||||
// Validate, so they only reach here from callers building TransportParams
|
||||
// directly.
|
||||
if behavior != "" {
|
||||
params.Logger.Warnw(
|
||||
"send side BWE pacer unavailable, falling back", nil,
|
||||
"pacerBehavior", behavior,
|
||||
"fallback", pacer.PacerBehaviorNoQueue,
|
||||
)
|
||||
}
|
||||
t.pacer = pacer.NewNoQueue(params.Logger, t.bwe)
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user