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 follows the cadence (Self::with_cadence) or stays fixed at Self::with_interval (false). On by default.

Source

pub fn with_cadence(self, cadence: CongestionFeedbackCadence) -> Self

When a report is built while the interval is not fixed: see CongestionFeedbackCadence. Default CongestionFeedbackCadence::ReceivedMedia, the engine’s own form, which no specification has (RFC 8888 section 4 leaves the interval to the application: “Applications need to negotiate an appropriate congestion control feedback interval”). CongestionFeedbackCadence::PerFrame is the form of the texts (RFC 8888 section 4, “sending feedback once per frame is an upper bound before the reporting overhead becomes excessive”, and “Specifications for RTP congestion control algorithms can also provide guidance”: draft-ietf-rmcat-gcc-02 section 3, “once per received video frame or at least once every 30 ms if audio-only or multi-stream”, up to 100 ms where the overhead needs to be limited): measured worse as the default, it is the StrictRfc behaviour profile’s.

Source

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

The share of the rate it is sized to that the feedback may take with CongestionFeedbackCadence::SendEstimate and CongestionFeedbackCadence::ReceivedMedia. Default 0.05; the Performance behaviour profile takes 0.025. CongestionFeedbackCadence::PerFrame does not use it.

Source

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

The longest interval of CongestionFeedbackCadence::SendEstimate and CongestionFeedbackCadence::ReceivedMedia while media flows. Default 250 ms; 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). The interval is cut short when the packets waiting fill one report, so the report leaves whole instead (section 3.1: the interval “SHOULD be chosen such that feedback packets … fit within the path MTU”).

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 with_leap_second_window(self, avoided: bool) -> Self

RFC 7164 section 5’s form for the report timestamp: “generating or using NTP timestamps during the entire last second of a day on which a positive leap second has been scheduled SHOULD be avoided”, one assumed at the end of every month (section 5.1). With true no report is generated in the two seconds around a month end; what arrived meanwhile is reported in the first report after them. Default false: reports go on, stamped, because they are congestion control’s input and two seconds without them cut the sender’s rate (RFC 8836 requirement 10; measured: audit row RFC7164-5-3). The StrictRfc behaviour profile turns it on (DefaultInterceptorOptions::rfc8888_leap_second_window).

Source

pub fn with_stability_stretch(self, stretch: bool) -> Self

RFC 8836 section 2, requirement 8c: the adaptive interval doubles (up to 500 ms) while the path reads stable, and comes back at once when it does not; see TwccReceiverBuilder::with_stability_stretch. Off by default.

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.