pub trait Packetizer:
Send
+ Sync
+ Debug {
// Required methods
fn enable_abs_send_time(&mut self, value: u8);
fn packetize(
&mut self,
now: Instant,
payload: &Bytes,
samples: u32,
) -> Result<Vec<Packet>>;
fn skip_samples(&mut self, skipped_samples: u32);
fn clone_to(&self) -> Box<dyn Packetizer>;
// Provided method
fn set_next_frame_info(&mut self, _info: &dyn Any) { ... }
}Expand description
Packetizer packetizes a payload
Required Methods§
Sourcefn enable_abs_send_time(&mut self, value: u8)
fn enable_abs_send_time(&mut self, value: u8)
Attaches the absolute-send-time header extension under id value.
Sourcefn packetize(
&mut self,
now: Instant,
payload: &Bytes,
samples: u32,
) -> Result<Vec<Packet>>
fn packetize( &mut self, now: Instant, payload: &Bytes, samples: u32, ) -> Result<Vec<Packet>>
Packetizes one frame, advancing the timestamp by samples.
Assigns sequence numbers, sets the marker bit as the payload format has it (see
MarkerRule: the final packet of a video frame, the first packet of an audio
talkspurt) and applies any enabled header extensions. now is the instant the frame is being sent at; it is what
the absolute-send-time extension is derived from, so the caller supplies it rather than
the packetizer sampling a clock of its own.
§Errors
Propagates payloader failures, and fails when the MTU leaves no room for a payload after the 12-byte RTP header.
Sourcefn skip_samples(&mut self, skipped_samples: u32)
fn skip_samples(&mut self, skipped_samples: u32)
Advances the timestamp without sending anything, for dropped or silent frames. For an audio format this is a silence period: the next packet starts a talkspurt and carries the marker bit (RFC 3551 section 4.1; Opus DTX, RFC 7587 section 3.1.3).
Sourcefn clone_to(&self) -> Box<dyn Packetizer>
fn clone_to(&self) -> Box<dyn Packetizer>
Clones this packetizer behind a trait object.
Provided Methods§
Sourcefn set_next_frame_info(&mut self, _info: &dyn Any)
fn set_next_frame_info(&mut self, _info: &dyn Any)
Describes the next frame packetize is given to the
payloader (Payloader::set_next_frame_info): for VP9 a
Vp9FrameInfo, so that the frames of a picture
with spatial layers carry their layer indices and only the picture’s last packet the
marker (RFC 9628 section 4.1). The default ignores it.
Trait Implementations§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".