pub trait Packetizer {
type Frame;
type Error;
// Required methods
fn push(&mut self, frame: Self::Frame) -> Result<(), Self::Error>;
fn flush(&mut self) -> Result<(), Self::Error>;
fn take(&mut self) -> Result<Option<RtpPacket>, Self::Error>;
// Provided methods
fn with_frame<F, T>(self, f: F) -> WithFrame<Self, F, T>
where F: FnMut(T) -> Self::Frame,
Self: Sized { ... }
fn map_err<F, E>(self, f: F) -> MapErr<Self, F>
where F: FnMut(Self::Error) -> E,
Self: Sized { ... }
}Expand description
Common trait for packetizers.
Packetizers are responsible for converting media frames into RTP packets.
§Usage
- Push a media frame into the packetizer.
- Take all RTP packets from the packetizer.
- Repeat from (1) if needed.
- Flush the packetizer.
- Take all RTP packets from the packetizer.
Required Associated Types§
Required Methods§
Sourcefn push(&mut self, frame: Self::Frame) -> Result<(), Self::Error>
fn push(&mut self, frame: Self::Frame) -> Result<(), Self::Error>
Process a given media frame.
§Panics
The method may panic if calling the take method would not return
None.
Provided Methods§
Sourcefn with_frame<F, T>(self, f: F) -> WithFrame<Self, F, T>
fn with_frame<F, T>(self, f: F) -> WithFrame<Self, F, T>
Convert this packetizer into a new one accepting media frames of a given type.