Skip to main content

CongestionControlBuilder

Struct CongestionControlBuilder 

Source
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>

Source

pub fn new(estimator: E) -> Self

A builder driving estimator.

Source

pub fn with_prune_horizon(self, prune_horizon: Duration) -> Self

How long an unacknowledged packet is kept before it is written off.

Source

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.

Source

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.

Source

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.

Source

pub fn build(self) -> CongestionControlInterceptor<E>

Build the interceptor.

Source

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.

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.