Selkies
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.1
attributeBACKOFF
= 0.7
attributeHOLD_S
= 2.0
attributeSTEP
= 1.15
attributeHEADROOM
= 0.85
attributestrikes
= 0
attributehold_until
= 0.0

Functions

constructor__init__() -> None
Source Code
def __init__(self) -> None:
    self.strikes = 0
    self.hold_until = 0.0

Returns

None
functarget(current, ceiling, floor, goodput_bps, loss, now) -> float

The 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)))
paramcurrentfloat
paramceilingfloat
paramfloorfloat
paramgoodput_bpsfloat
paramlossfloat
paramnowfloat

Returns

float

On this page

Edit on GitHub