Skip to main content

Rfc8888Builder

Struct Rfc8888Builder 

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

Builder for Rfc8888Interceptor.

§Example

use rtci_interceptor::{Slot, Registry, Rfc8888Builder};
use std::time::Duration;

let chain = Registry::new()
    .with(Slot::Rfc8888, Rfc8888Builder::new().with_interval(Duration::from_millis(50)).build())
    .build();

Implementations§

Source§

impl Rfc8888Builder

Source

pub fn new() -> Self

Create a builder with the default interval and report size.

Source

pub fn with_interval(self, interval: Duration) -> Self

How often feedback is sent.

Congestion control wants this often — the estimate is only as fresh as the feedback driving it — traded against the RTCP bandwidth it costs.

Source

pub fn with_adaptive_interval(self, adaptive_interval: bool) -> Self

Whether the interval stretches to what the RTCP bandwidth holds one report in. On by default.

“RTCP bandwidth and transmission rules put some upper limits on how frequently the RTCP feedback messages can be sent” (RFC 8888 section 4), and the RTCP session applies them: 5% of the session bandwidth unless b=RS / b=RR say otherwise (RFC 3550 section 6.2). Reports built more often than that queue in the session and reach the sender late or not at all. With this on, the interval is the configured one where the bandwidth allows it and longer where it does not, up to half a second: one report for every RTCP packet the session may send, each covering everything since the last. false keeps the interval fixed.

Source

pub fn with_feedback_share(self, share: f64) -> Self

The share of the media received that the feedback may take while the interval is adaptive: the interval is the time in which this share holds one feedback packet (with its lower layers, and the minimal compound packet around it without reduced-size RTCP). Default 0.05, RFC 3550 section 6.2’s 5% for all of RTCP. A smaller share leaves room in the 5% for the regular reports (the Performance behaviour profile: 0.025).

Source

pub fn with_max_adaptive_interval(self, max_interval: Duration) -> Self

The longest the adaptive interval stretches to while media flows. Default 250 ms. draft-holmer-rmcat-transport-wide-cc-extensions-01 section 3: “in cases of low uplink bandwidth it is acceptable to send them less frequently, e.g., for instance once per RTT”; RFC 8888 section 4 leaves the interval to the application (“Applications need to negotiate an appropriate congestion control feedback interval … based on … the acceptable feedback overhead”). The Performance behaviour profile takes 500 ms.

Source

pub fn with_max_report_size(self, max_report_size: usize) -> Self

Byte budget for one report.

A report larger than the path MTU is fragmented or dropped, and feedback that does not arrive is worth nothing, so feedback that exceeds the budget is split into several reports (RFC 8888 section 3.1).

Source

pub fn with_sender_ssrc(self, sender_ssrc: u32) -> Self

The SSRC these reports are sent from.

Left unset, the interceptor uses the SSRC of the first local stream bound to it (the RTCP packet sender is then the endpoint’s own media source), and while there is none, a random non-zero SSRC chosen when it is built, as a receive-only RTP participant has (RFC 3550 section 8). It is never 0.

Source

pub fn with_wall_clock(self, anchor: SystemInstant) -> Self

The wall-clock anchor the reports’ timestamps derive from (RFC 8888 section 3.1: the clock of the RTCP sender reports’ NTP timestamps, so give the RTCP session the same). Default: the process-wide SystemInstant::shared. Give one per peer connection for reproducible virtual-time runs: two runs in one process otherwise map the same instants to NTP times as far apart as the real time between them.

Source

pub fn build(self) -> Rfc8888Interceptor

Build the interceptor.

Trait Implementations§

Source§

impl Default for Rfc8888Builder

Source§

fn default() -> Self

Returns the “default value” for a type. 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.