pub struct CongestionControlBuilder<E: BandwidthEstimator> { /* private fields */ }Expand description
Builder for CongestionControlInterceptor.
§Example
use rtci_interceptor::{Slot, CongestionControlBuilder, ConstantBitrate, Registry};
let chain = Registry::new()
.with(Slot::CongestionControl, CongestionControlBuilder::new(ConstantBitrate::new(1_000_000.0)).build())
.build();Implementations§
Source§impl<E: BandwidthEstimator> CongestionControlBuilder<E>
impl<E: BandwidthEstimator> CongestionControlBuilder<E>
Sourcepub fn with_send_rate_told_to_rtcp(self, told: bool) -> Self
pub fn with_send_rate_told_to_rtcp(self, told: bool) -> Self
Whether the estimate is told to the RTCP session of the same chain
(RtcpSessionControl::SendRate, written
wire-ward whenever the estimate has moved by a twentieth), for
RtcpSessionBuilder::with_share_following_send_rate.
Off by default; it needs an RTCP session wire-ward of this interceptor, which takes
the control out of the chain.
Sourcepub fn with_prune_horizon(self, prune_horizon: Duration) -> Self
pub fn with_prune_horizon(self, prune_horizon: Duration) -> Self
How long an unacknowledged packet is kept before it is written off.
Sourcepub fn with_circuit_breaker(self, handle: CircuitBreakerHandle) -> Self
pub fn with_circuit_breaker(self, handle: CircuitBreakerHandle) -> Self
The circuit breaker of the same chain. When its congestion breaker asks for a tenth of the rate (RFC 8083 section 4.3) the limit becomes an upper bound of the estimator.
Sourcepub fn with_unnegotiated_tmmbr(self, honoured: bool) -> Self
pub fn with_unnegotiated_tmmbr(self, honoured: bool) -> Self
Whether a TMMBR is honoured for a stream that did not negotiate ccm tmmbr.
Off by default: RFC 5104 section 7.1 has a codec control message used only when the
session description names it (a=rtcp-fb:<pt> ccm tmmbr), and section 7.2 has the
answerer remove what it does not support, so a TMMBR for a stream without it is a
message the session never agreed to and is ignored, unanswered. true is the lenient
behaviour: every TMMBR that names one of this endpoint’s streams limits it and is
answered with a TMMBN.
Sourcepub fn with_bandwidth_probing(self, bandwidth_probing: bool) -> Self
pub fn with_bandwidth_probing(self, bandwidth_probing: bool) -> Self
Whether the path is probed for capacity above the target: short clusters of packets
at a multiple of the target, whose arrival shows at once whether the path carries
that rate. Off for a builder (it needs the pacer and the NACK responder of the same
chain); on in the peer connection’s default interceptor set
(DefaultInterceptorOptions::bandwidth_probing).
Without it the estimate climbs as fast as the delay-based controller raises it, 8% a
second in Gcc: from 300 kbit/s to 2.5 Mbit/s takes most of half a
minute. With it, two clusters at the start (three and six times the starting rate),
further ones at twice the result while the path keeps carrying what is asked, and one
every five seconds while the application sends less than the target allows; a path
with 2.5 Mbit/s is found in well under a second.
RFC 8836 section 2 (requirement 4, a SHOULD) asks for quick adaptation to the initial
conditions and names “probing during setup” as one way; draft-ietf-rmcat-gcc-02 has
none. It is libwebrtc’s behaviour, in outline, and adds traffic the application did
not write: padding-only packets on the RTX stream fill a cluster the application’s own
media does not (they carry no media, and receivers drop them), so it needs RTX
negotiated to probe a sender with little to send. After a large drop of the target
(a third or more), the rate before it is probed for a few seconds
(ProbeController::with_probe_after_drop).
What it costs: an application sending a fifth of what the path carries spends about
4% of its octets on probes, one cluster every five seconds. The pacer
(PacerInterceptor) and the NACK responder
(NackResponderInterceptor) of the same chain do
the sending; the estimator hears the result through
BandwidthEstimator::on_probe_result.
Sourcepub fn with_after_drop_probe(self, after_drop_probe: AfterDropProbe) -> Self
pub fn with_after_drop_probe(self, after_drop_probe: AfterDropProbe) -> Self
With bandwidth probing on, what is probed for after a large drop of the target:
AfterDropProbe (the engine’s repeated probe by default, libwebrtc’s single one, or
none).
Sourcepub fn with_recovery_probing(self, recovery_probing: bool) -> Self
pub fn with_recovery_probing(self, recovery_probing: bool) -> Self
Whether, with bandwidth probing on, the path is probed back towards the rate it
carried before a large drop of the target for as long as that rate is remembered (a
minute): a cluster at twice the target every five seconds while the target is below
85% of it and the estimator does not read the path as over-used
(BandwidthEstimator::usage), with further clusters while the path carries what is
asked. Off by default, in every behaviour profile
(DefaultInterceptorOptions::recovery_probing): it is tuning, with no specification
behind it, and Chrome does not do it.
Without it a sender that keeps up with its target climbs back from a limit that has
gone at the delay-based controller’s 8% a second (about 17 s from 250 kbit/s to
1 Mbit/s); with it the next cluster finds the path, within five seconds. Measured
(capacity instrument, 200 calls a cell, a 20 s limit of 300 kbit/s on a 2.5 Mbit/s
path): 1 Mbit/s 4.9 s after the limit went against 17.3 s, and the full rate from
then on; it costs 3% of the target under the limit (238 against 246 kbit/s) and,
behind a 100 ms queue, 11 more audio packets lost a call (52 against 41); it gains
nothing after a limit longer than the minute the rate is remembered. All the
figures, why no specification asks for it and what libwebrtc does instead:
ProbeController::with_recovery_probing.
It needs the pacer of the same chain: a chain whose clusters leave as bursts is not
probed this way.
Sourcepub fn build(self) -> CongestionControlInterceptor<E>
pub fn build(self) -> CongestionControlInterceptor<E>
Build the interceptor.
Sourcepub fn build_with_handle(
self,
) -> (CongestionControlInterceptor<E>, CongestionControlHandle)
pub fn build_with_handle( self, ) -> (CongestionControlInterceptor<E>, CongestionControlHandle)
Build the interceptor and the handle the application reads the estimate from and gives the negotiated limits to.