Depacketizer

Trait Depacketizer 

Source
pub trait Depacketizer {
    type Frame;
    type Error;

    // Required methods
    fn push(&mut self, packet: RtpPacket) -> Result<(), Self::Error>;
    fn flush(&mut self) -> Result<(), Self::Error>;
    fn take(&mut self) -> Result<Option<Self::Frame>, Self::Error>;

    // Provided methods
    fn map_frame<F, T>(self, f: F) -> MapFrame<Self, F>
       where F: FnMut(Self::Frame) -> T,
             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 de-packetizers.

Depacketizers are responsible for converting RTP packets into media frames.

§Usage

  1. Push an RTP packet into the depacketizer.
  2. Take all media frames from the depacketizer.
  3. Repeat from (1) if needed.
  4. Flush the depacketizer.
  5. Take all media frames from the depacketizer.

Required Associated Types§

Required Methods§

Source

fn push(&mut self, packet: RtpPacket) -> Result<(), Self::Error>

Process a given RTP packet.

§Panics

The method may panic if calling the take method would not return None.

Source

fn flush(&mut self) -> Result<(), Self::Error>

Flush the depacketizer.

§Panics

The method may panic if calling the take method would not return None.

Source

fn take(&mut self) -> Result<Option<Self::Frame>, Self::Error>

Take the next available media frame.

Note that only after this method returns None, it is allowed to call the push method or the flush method again.

Provided Methods§

Source

fn map_frame<F, T>(self, f: F) -> MapFrame<Self, F>
where F: FnMut(Self::Frame) -> T, Self: Sized,

Map the media frame into a different type.

Source

fn map_err<F, E>(self, f: F) -> MapErr<Self, F>
where F: FnMut(Self::Error) -> E, Self: Sized,

Map the depacketizer error into a different one.

Implementations on Foreign Types§

Source§

impl<T> Depacketizer for Box<T>
where T: Depacketizer + ?Sized,

Source§

type Frame = <T as Depacketizer>::Frame

Source§

type Error = <T as Depacketizer>::Error

Source§

fn push(&mut self, packet: RtpPacket) -> Result<(), Self::Error>

Source§

fn flush(&mut self) -> Result<(), Self::Error>

Source§

fn take(&mut self) -> Result<Option<Self::Frame>, Self::Error>

Implementors§

Source§

impl<D, F, E> Depacketizer for MapErr<D, F>
where D: Depacketizer, F: FnMut(D::Error) -> E,

Source§

impl<D, F, T> Depacketizer for MapFrame<D, F>
where D: Depacketizer, F: FnMut(D::Frame) -> T,