Skip to main content

Rtcp

Enum Rtcp 

Source
pub enum Rtcp {
    Sender(SenderReport),
    Receiver(ReceiverReport),
    Sdes(Sdes),
    Other {
        packet_type: u8,
        count: u8,
        padding: bool,
        payload: Bytes,
    },
}
Expand description

An RTCP packet.

Variants§

§

Sender(SenderReport)

A sender report.

§

Receiver(ReceiverReport)

A receiver report.

§

Sdes(Sdes)

A source description.

§

Other

Something else — goodbyes, application data.

Kept rather than dropped: RTCP arrives as compound packets, and an element that discards the types it does not model cannot forward one intact.

Fields

§packet_type: u8

The packet type.

§count: u8

The header’s five-bit count, verbatim. It is load-bearing for types this crate does not model — §6.5 reads it as the SDES chunk count, §6.6 as the BYE source count — so re-encoding it as zero empties the packet.

§padding: bool

Whether the padding bit was set. It decides where the payload ends, so it has to travel with the bytes it describes.

§payload: Bytes

Its body, verbatim.

Implementations§

Source§

impl Rtcp

Source

pub fn encode(&self) -> Bytes

Serialize one packet.

Source

pub fn encode_compound(packets: &[Self]) -> Bytes

Serialize several packets as one datagram.

RFC 3550 §6.1: every RTCP packet is sent in a compound of at least two, led by a report and carrying an SDES CNAME. The parts are plain concatenation — this exists so a caller sends one datagram rather than one per part.

Source

pub fn decode_compound(bytes: &Bytes) -> Result<Vec<Self>, RtcpError>

Parse a compound packet into its parts.

RTCP is sent compound — a report followed by a source description, usually — and a parser that reads only the first packet sees a fraction of what arrived.

Trait Implementations§

Source§

impl Clone for Rtcp

Source§

fn clone(&self) -> Rtcp

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 Rtcp

Source§

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

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

impl PartialEq for Rtcp

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Rtcp

Source§

impl StructuralPartialEq for Rtcp

Auto Trait Implementations§

§

impl !Freeze for Rtcp

§

impl RefUnwindSafe for Rtcp

§

impl Send for Rtcp

§

impl Sync for Rtcp

§

impl Unpin for Rtcp

§

impl UnsafeUnpin for Rtcp

§

impl UnwindSafe for Rtcp

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> Same for T

Source§

type Output = T

Should always be Self
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.