Skip to main content

Vp8Payloader

Struct Vp8Payloader 

Source
pub struct Vp8Payloader {
    pub enable_picture_id: bool,
    pub ignore_partitions: bool,
    /* private fields */
}
Expand description

Vp8Payloader payloads VP8 packets

Payloader::payload sends a frame of a stream without temporal layers. Vp8Payloader::payload_frame takes the frame’s layer information from the encoder and writes N, TID, Y, TL0PICIDX and KEYIDX (RFC 7741 section 4.2), which is what lets a forwarder drop temporal layers.

Fields§

§enable_picture_id: bool

Whether to include the optional picture id in the payload descriptor.

Lets a receiver detect loss within a frame, at one or two bytes per packet.

§ignore_partitions: bool

Cut each frame at MTU boundaries without regard to its partitions, with PID 0 on every packet and S on the first only (RFC 7741 section 4.4 allows it; libwebrtc’s packetizer does this). By default each partition starts a packet of its own, labelled with its PID and S (sections 3, 4.2 and 4.4).

Implementations§

Source§

impl Vp8Payloader

Source

pub fn set_initial_picture_id(&mut self, picture_id: u16)

Sets the PictureID of the next frame (15 bits). RFC 7741 section 4.2 lets it start at a random value; the default is 0.

Source

pub fn set_initial_tl0_pic_idx(&mut self, tl0_pic_idx: u8)

Sets TL0PICIDX so that the next base layer frame carries tl0_pic_idx. RFC 7741 section 4.2 lets it start at a random value; by default the first base layer frame carries 1.

Source

pub fn picture_id(&self) -> u16

The PictureID the next frame is sent with.

Source

pub fn payload_frame( &mut self, mtu: usize, payload: &Bytes, info: &Vp8FrameInfo, ) -> Result<Vec<Bytes>>

Fragments one VP8 frame, describing it with info.

The descriptor carries the PictureID when enable_picture_id is set, TL0PICIDX, TID and Y when info.temporal is, KEYIDX when info.key_idx is, and N from info.non_reference. TL0PICIDX is incremented for every frame with TID 0 and repeated on the frames above it.

Each partition of the frame (the first partition with the frame header and the token partition sizes, then each DCT token partition: RFC 6386 section 9) starts a packet of its own, as RFC 7741 section 3 recommends: the packet’s PID is the partition’s index (the eighth and ninth of a frame with eight token partitions share PID 7, the field’s largest value) and S is set on the first packet of each partition (sections 4.2, 4.4). A partition larger than the MTU allows is cut over several packets. A frame whose partition sizes cannot be read, or every frame with ignore_partitions, is cut at MTU boundaries without regard to its partitions, S on the first packet only and PID 0 (section 4.4).

§Errors

TID above 3 or KEYIDX above 31, which the fields cannot carry.

Trait Implementations§

Source§

impl Clone for Vp8Payloader

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 Vp8Payloader

Source§

impl Debug for Vp8Payloader

Source§

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

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

impl Default for Vp8Payloader

Source§

fn default() -> Self

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

impl Payloader for Vp8Payloader

Source§

fn payload(&mut self, mtu: usize, payload: &Bytes) -> Result<Vec<Bytes>>

Payload fragments a VP8 packet across one or more byte arrays

Source§

fn clone_to(&self) -> Box<dyn Payloader>

Clones this payloader behind a trait object.
Source§

fn marker_rule(&self) -> MarkerRule

Which packets carry the marker bit. Video unless the payloader says otherwise.
Source§

fn payload_duration(&self, _payload: &Bytes) -> Option<u32>

For a sample-based format, the RTP timestamp units one payload of payload covers, so that a frame split over several packets gets a timestamp per packet (RFC 3551 section 4.3: the timestamp is the sampling instant of the packet’s first sample). None, the default, is a frame-based format: every packet of the frame carries the frame’s timestamp.
Source§

fn set_next_frame_info(&mut self, _info: &dyn Any)

What the encoder says about the next frame payload is given, for a format whose payload describes more than the frame’s bytes (VP9’s layer indices, Vp9FrameInfo); a type the payloader does not use is ignored, as is the call by a payloader that uses none (the default).

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.