Skip to main content

RetransmissionRateLimit

Enum RetransmissionRateLimit 

Source
#[non_exhaustive]
pub enum RetransmissionRateLimit { WithinTarget, UpToTarget, Unlimited, }
Expand description

How the NACK responder holds its retransmissions to the congestion controller’s target (RFC 4588 section 7), read from Attribute::TargetBitrateChanged as it passes on the read leg. Until a target has passed, and in a chain without a congestion controller, nothing is held back.

The rate is counted over the last RETRANSMISSION_RATE_WINDOW. A NACKed packet that does not fit now waits, oldest request first, and leaves when the window has room for it (poll_timeout is that instant), for as long as the receiver keeps asking for it (PENDING_REQUEST_LIFETIME). Section 7 lets the sender “selectively retransmit only the packets that it deems important and ignore NACK messages for other packets in order to limit the bitrate”: a packet still asked for is the one deemed important, one the receiver stopped asking for is dropped.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

WithinTarget

RFC 4588 section 7, both halves: “the acceptable packet rate and bitrate include both the original and retransmitted data”, and “the sender SHOULD NOT send retransmission packets without reducing the packet rate and bitrate of the original stream (for example, by encoding the data at a lower rate)”.

Retransmissions take what the original packets of every local stream leave of the target. While retransmissions wait or were sent within the window, the target reported for the original media is the congestion controller’s less a retransmission reserve: on the read leg Attribute::TargetBitrateChanged is lowered by it on its way to the application, and RetransmissionReserve rides down the write leg to the congestion controller, whose handle (GccHandle::target_bitrate_bps, CongestionControlHandle::target_bitrate) reports the lowered target and keeps the estimate itself readable (estimate_bps, estimate_bitrate). An encoder that follows the target leaves the reserve free, so the repairs have room.

The reserve is what the waiting requests need to leave within about one round trip (their octets over the round-trip time the RTCP session measured, at most RETRANSMISSION_RATE_WINDOW), or the retransmission rate of the window when that is more, and never more than MAX_RETRANSMISSION_RESERVE of the target (NackResponderBuilder::with_max_reserve_fraction). It is released as the requests are served and the retransmissions leave the window: with nothing waiting and nothing retransmitted within the last window it is zero.

At the congestion controller’s floor. The controller’s minimum bit rate is this engine’s setting, not the RFC’s, and the controller announces it with its target (MinimumTarget). The original media is never told less than that minimum (the least the application set its media to need). When lowering the original media by the reserve would take it under that floor (target − reserve < minimum), it cannot make the room: an encoder at its own minimum already fills the floor (in the capacity-cap test, 30 kbit/s of video and 80 kbit/s of audio against a 100 kbit/s target), and the rule above would leave the repairs nothing for as long as the estimate stays near the floor. There the retransmissions of packets still asked for take the window’s room first: they may send up to the target within the window, whatever the original packets took, and the original media is told the target less the reserve. Section 7 lets the sender “selectively retransmit only the packets that it deems important”; a packet still asked for is the one deemed important. An application at its minimum adds its own excess over the floor; the retransmissions never go over the target.

What holds the sum on the wire when the application ignores the lowered target: with a pacer in the chain (the default interceptor set) the pacer sends at the controller’s target, retransmissions and media alike; without one (a chain of NACK, TWCC and GCC alone) it is this rule: above the floor the retransmissions take only what the original packets leave, so the engine never adds to an application’s excess; near the floor (target under the minimum plus the reserve, at most twice the minimum with the default reserve) they take at most the target.

§

UpToTarget

A rate limiter on the retransmissions alone, its maximum the target (the form of libwebrtc’s RtpSender when it is given a retransmission_rate_limiter, modules/rtp_rtcp/source/rtp_sender.cc): the retransmissions stay under the target whatever the original packets take, and the target reported for the original media is not lowered, so the sum may reach twice the target. A setting in no behaviour profile: libwebrtc gives its video senders no such limiter (call/rtp_video_sender.cc:292-354 at a222406d; rtp_rtcp_interface.h:92 defaults it to null) and lowers the encoder target by the protection share instead. Measured in tests/capacity_cap_video_rtc2rtc.rs against the default: longest freeze 0.84 to 1.29 s against 0.83 to 1.24 s, 17 to 27 retransmissions dropped at the capped link against 14 to 17.

§

Unlimited

No limit beyond the per-stream budget (one retransmission per original packet sent): the fork’s behaviour before. Retransmissions are then not congestion controlled.

Trait Implementations§

Source§

impl Clone for RetransmissionRateLimit

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for RetransmissionRateLimit

Source§

impl Debug for RetransmissionRateLimit

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for RetransmissionRateLimit

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for RetransmissionRateLimit

Source§

impl PartialEq for RetransmissionRateLimit

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RetransmissionRateLimit

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.