Skip to main content

Attribute

Enum Attribute 

Source
#[non_exhaustive]
pub enum Attribute { RecoveredByFec, Retransmission, DeliverToApplication, TargetBitrateChanged { bits_per_second: f64, }, ForcePli { ssrcs: Option<Vec<u32>>, }, Custom(Arc<dyn Any + Send + Sync>), }
Expand description

A fact about a packet, attached by one interceptor and readable by the rest.

§Why it rides with the packet

Because it has to survive the journey. An interceptor that queues a packet and emits it later puts it back on the belt behind itself, where every interceptor ahead sees it again — so what was learned about that packet has to travel with it or be worked out twice. A side channel cannot manage that: it has no way to say which packet it refers to once the packet has been held, reordered or duplicated.

With Ein/Eout left as (), this is the only way information crosses interceptors.

§Cost

AttributedPacket holds a Vec, which does not allocate while empty — and most packets carry nothing. Lookup is a linear scan of a handful of words, cheaper than hashing.

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.
§

RecoveredByFec

Rebuilt by FEC rather than received: these bytes never arrived on the wire.

A NACK generator that sees this must not ask for the packet again.

§

Retransmission

A retransmission answering a NACK, not a first transmission.

Still new bytes on the wire, which is why a send history has to count it — counting it as an original tells a bandwidth estimator the path is carrying less than it is.

§

DeliverToApplication

Inbound RTCP an interceptor has decided the application should see.

NoopInterceptor ends the inbound RTCP path unless the packet carries this, which makes forwarding a per-packet judgement by whichever interceptor is qualified to make it, rather than a chain-wide setting.

§

TargetBitrateChanged

The congestion controller’s estimate, in bits per second.

Rides outbound so the pacer reads it on the way past. A bitrate is connection state rather than a property of the packet carrying it — it travels this way because with no event channel there is nowhere else for it to go.

Fields

§bits_per_second: f64

The new target, in bits per second.

§

ForcePli

Ask the keyframe generator to send a Picture Loss Indication now.

Fields

§ssrcs: Option<Vec<u32>>

Which streams to request a keyframe for, or None for all of them.

§

Custom(Arc<dyn Any + Send + Sync>)

Anything an application defines, so this enum is never a bottleneck on it.

Arc rather than Box so an attributed packet stays cheap to clone — the NACK responder clones into its send buffer and the FEC encoder into its block, and neither should deep-copy an application’s payload. Reached by type: AttributedPacket::custom.

Trait Implementations§

Source§

impl Clone for Attribute

Source§

fn clone(&self) -> Attribute

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 Debug for Attribute

Source§

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

Formats the value using the given formatter. 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> 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 = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.