Developer Referencewebrtc_mode
CongestionSteer
The steer of one display's CBR target over the congestion loop's one-second ticks. A tick whose loss fraction passes LOSS is a strike, and only two strikes in a row back the target off, by BACKOFF: one window is a few tens of packets, too few for its loss to mean anything on its own. A backoff then holds the target for HOLD_S, so the recovery does not climb straight back onto the loss that caused it. A clean tick clears the strikes and, outside a hold, raises the target by STEP, or to HEADROOM of the measured goodput where that is higher, never past the ceiling.
Attributes
attributeLOSS= 0.1attributeBACKOFF= 0.7attributeHOLD_S= 2.0attributeSTEP= 1.15attributeHEADROOM= 0.85attributestrikes= 0attributehold_until= 0.0Functions
constructor__init__() -> NoneSource Code
def __init__(self) -> None:
self.strikes = 0
self.hold_until = 0.0Returns
Nonefunctarget(current, ceiling, floor, goodput_bps, loss, now) -> floatThe next target in kbps for a tick that measured goodput_bps and loss.
Source Code
def target(self, current: float, ceiling: float, floor: float,
goodput_bps: float, loss: float, now: float) -> float:
"""The next target in kbps for a tick that measured `goodput_bps` and `loss`."""
if loss > self.LOSS:
self.strikes += 1
if self.strikes < 2:
return current
self.strikes = 0
self.hold_until = now + self.HOLD_S
return max(floor, min(ceiling, current * self.BACKOFF))
self.strikes = 0
if now < self.hold_until:
return current
return max(floor, min(ceiling, max(current * self.STEP, goodput_bps * self.HEADROOM / 1_000)))paramcurrentfloatparamceilingfloatparamfloorfloatparamgoodput_bpsfloatparamlossfloatparamnowfloatReturns
float