Skip to main content

ProbeController

Struct ProbeController 

Source
pub struct ProbeController { /* private fields */ }
Expand description

Decides when a probe cluster is sent and at what rate.

Implementations§

Source§

impl ProbeController

Source

pub fn new(initial_bitrate: f64, max_bitrate: f64) -> Self

A controller for an estimator that starts at initial_bitrate and never goes above max_bitrate.

Source

pub fn with_recovery_probing(self, enabled: bool) -> Self

Whether the path is probed back towards the rate it carried before a large drop for as long as that rate is remembered: recovery probing. Off by default.

A capacity that fell and comes back (a cellular link out of a tunnel, a competing transfer that ends after half a minute) leaves a sender that keeps up with its target at the bottom of the delay-based controller’s climb: 8% a second, about 18 s from 250 kbit/s to 1 Mbit/s. Nothing else asks: the probes after a drop (with_after_drop_probe) end five seconds after it, and the periodic ones are for a sender that sends less than its target. With this, the target before a large drop (below two thirds of its high of the last two seconds) is remembered for PROBE_DROP_MEMORY (the highest such rate, through the smaller drops of the time under the limit), and while the target is below 85% of it and the estimator does not read the path as over-used (set_usage), a cluster at twice the target is asked for every PROBE_RECOVERY_INTERVAL, with further ones at twice the result while results confirm the rate probed. A cluster the path does not carry changes nothing (a probe only ever raises the estimate).

No specification asks for it (RFC 8836 section 2 names probing at the start only; draft-ietf-rmcat-gcc-02 has no probing), and libwebrtc does not do it: its periodic probes are for an application-limited sender, its probe after a drop is one cluster within five seconds. It is a performance choice: it puts a cluster above the target into a path that may still be limited, every five seconds for up to a minute. Not for a chain whose clusters leave as bursts (set_unpaced).

Measured on the capacity instrument (tests/capacity_instrument.rs; the default chain, a 2.5 Mbit/s path that drops to 300 kbit/s for 20 s, 200 calls a cell, without the setting against with it). WHAT IT GAINS: the target is back at 1 Mbit/s 4.9 s after the limit went (5.4 s at most) instead of 17.3 s, and at the 2.5 Mbit/s maximum through the window 15 to 25 s after it instead of 1283 kbit/s on average; the same behind a 100 ms queue (17.6 -> 5.0 s) and with both directions limited (16.2 -> 4.8 s); behind a 1000 ms queue in nine calls of ten (median 17.6 -> 5.0 s, the slowest tenth 17.5 s: the deep queue is still draining when the first clusters come). The five seconds are the interval: the wait is anywhere up to it. WHAT IT COSTS: under the limit the target is 238 kbit/s against 246 (3%), behind a 100 ms queue 52 audio packets are lost a call against 41 and 201 packets dropped at the queue against 159; the counts of calls with an old picture, a freeze or an audio gap do not move in any cell. WHERE IT GAINS NOTHING: a limit that outlasts the minute the rate is remembered (held 60 s: 17.6 s against 16.9 s, and the rate not back within 20 s in 33 of 200 calls against 14). As bursts in a chain without a pacer the gain was the same and the calls with an old picture rose in every cell that had any (both directions limited 25 -> 31 of 200), which is why it is the paced chain’s only.

Source

pub fn with_after_drop_probe(self, after_drop: AfterDropProbe) -> Self

What is probed for after a large drop of the target: AfterDropProbe.

Source

pub fn set_usage(&mut self, usage: Usage)

The estimator’s reading of the path now (BandwidthEstimator::usage). AfterDropProbe::Libwebrtc asks for its cluster when the reading returns from under-use to normal: the queue an over-use left has drained (libwebrtc DelayBasedBwe: recovered_from_overuse).

Source

pub fn with_probe_after_drop(self, enabled: bool) -> Self

Whether the rate the target had before a large drop is probed for, for a few seconds after it: true is AfterDropProbe::Repeated (the default), false AfterDropProbe::Off; with_after_drop_probe names libwebrtc’s form too.

A short burst of competing traffic, or a moment of loss, makes the delay-based controller back off by a third or more; once it has passed, the climb back is the controller’s additive increase near the old operating point, half a packet per response time, and takes tens of seconds (23 s after a 2 s burst at half the capacity, in rtci-interceptor/tests/rfc8836_multi_flow.rs), against RFC 8836 section 2 (requirement 1f: the flow “regains its share quickly”). With this, a drop of the target below two thirds of its high of the last two seconds is followed, from a second on and once a second for five seconds, by a cluster at 85% of the rate before the drop while the target is still below that. A result above the target raises it (as every probe does); one below it changes nothing: the competing traffic is still there.

Source

pub fn set_unpaced(&mut self, unpaced: bool)

Whether this chain’s clusters leave as one burst of padding (no pacer: the congestion controller says so when it measures a cluster whose packets left in one instant).

Then the rate before a large drop is not probed for. A paced cluster is the media already waiting, released faster for a few milliseconds, with padding only for what is missing; a burst is five packets of padding on top of the media, at once. After a drop that is 160 ms of a 300 kbit/s link put into the queue that caused the drop, once a second. Measured on the capacity instrument (200 calls a cell, a 2.5 Mbit/s path that drops to 300 kbit/s): with such bursts 7 of 200 calls of ParolNet’s chain were over 2 s without a new picture against 3 without them, 172 retransmissions a call against 142, and behind a 1000 ms queue the audio paused for over a second in 72 of 200 calls against 21. The start-up clusters and those of an application-limited sender are still asked for.

Source

pub fn on_path_change(&mut self, now: Instant, start_bitrate: f64)

The path changed and the estimator started over at start_bitrate: probing starts over too, as at the beginning of the call, and what was noted of the old path is dropped.

The start-up clusters are owed again, at three and six times start_bitrate and on while the new path carries what is asked (RFC 8836 section 2, requirement 4: the conditions of a new path are initial conditions). The target’s recent high, the drop below it and the cluster awaiting its result belong to the path that was left: the estimator’s fall back to its starting rate is not a drop of the path’s capacity, and the rate “before” it is the old path’s.

Without this an outage ended by an ICE restart left the call at the estimator’s 8% a second on the new path (traced on the capacity instrument’s outage cell, the default chain: 1 Mbit/s 15.1 s after the new pair). While nothing is acknowledged the estimator halves at every feedback timeout, each halving a large drop, and the probe for the rate before the last of them (133 kbit/s, asked into the dead path half a second before the new pair) was still awaiting its result when the path changed. It held the controller’s one slot for the half second in which the sender, still sending at the old path’s floor, counted as application limited against the new starting rate; after it nothing was due. Without the probe after a drop that application-limited cluster did find the path (1.0 s), but only in the calls where one happened to be due (134 of 200; 12 to 13 s in the others).

libwebrtc does the same on a network route change: ProbeController::Reset (goog_cc probe_controller.cc) returns to its initial state and forgets the rate before the last large drop, and the constraints set next start the exponential probes again (GoogCcNetworkController::OnNetworkRouteChange).

Source

pub fn set_max_bitrate(&mut self, max_bitrate: f64)

The ceiling of what is probed for: the estimator’s own maximum, or a limit from outside it (REMB, TMMBR, the session bit rate).

Source

pub fn poll( &mut self, now: Instant, target: f64, sending: f64, media_flowing: bool, ) -> Option<ProbeRequest>

The cluster to send now, if one is due.

target is the current target bit rate and sending the rate the application is sending at; media_flowing is whether a packet has left yet (a probe before the first one would measure nothing the receiver reports).

Source

pub fn outstanding(&self) -> Option<u32>

The number of the cluster whose result is awaited.

Source

pub fn asked_rate(&self, cluster: u32) -> Option<f64>

The rate cluster was asked for at, while its result is awaited.

Source

pub fn on_result(&mut self, cluster: u32, estimate: f64) -> Option<f64>

The result of cluster: estimate bits per second. Returns the estimate when it is the outstanding cluster’s, for the estimator to take.

Source

pub fn poll_timeout(&self) -> Option<Instant>

When poll next has something to say without anything else happening.

Never an instant poll has already been called at or after: a deadline that passed with nothing to send (no media flowing, a sender that is no longer application limited, a target that recovered by itself) waits for the next write instead of asking to be woken again at once.

Trait Implementations§

Source§

impl Debug for ProbeController

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.