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: boolWhether 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: boolCut 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
impl Vp8Payloader
Sourcepub fn set_initial_picture_id(&mut self, picture_id: u16)
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.
Sourcepub fn set_initial_tl0_pic_idx(&mut self, tl0_pic_idx: u8)
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.
Sourcepub fn picture_id(&self) -> u16
pub fn picture_id(&self) -> u16
The PictureID the next frame is sent with.
Sourcepub fn payload_frame(
&mut self,
mtu: usize,
payload: &Bytes,
info: &Vp8FrameInfo,
) -> Result<Vec<Bytes>>
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
impl Clone for Vp8Payloader
impl Copy for Vp8Payloader
Source§impl Debug for Vp8Payloader
impl Debug for Vp8Payloader
Source§impl Default for Vp8Payloader
impl Default for Vp8Payloader
Source§impl Payloader for Vp8Payloader
impl Payloader for Vp8Payloader
Source§fn payload(&mut self, mtu: usize, payload: &Bytes) -> Result<Vec<Bytes>>
fn payload(&mut self, mtu: usize, payload: &Bytes) -> Result<Vec<Bytes>>
Payload fragments a VP8 packet across one or more byte arrays
Source§fn marker_rule(&self) -> MarkerRule
fn marker_rule(&self) -> MarkerRule
Source§fn payload_duration(&self, _payload: &Bytes) -> Option<u32>
fn payload_duration(&self, _payload: &Bytes) -> Option<u32>
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)
fn set_next_frame_info(&mut self, _info: &dyn Any)
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).