ReorderingMultiBuffer

Struct ReorderingMultiBuffer 

Source
pub struct ReorderingMultiBuffer { /* private fields */ }
Expand description

Reordering buffer for RTP packets from multiple synchronization sources.

The buffer can be used the same way as ReorderingBuffer in cases where RTP packets with multiple SSRCs are expected. The buffer reorder packets from each SSRC independently but the global reordering depth will be still limited to make sure that no packet is delayed for too long.

Implementations§

Source§

impl ReorderingMultiBuffer

Source

pub fn new(depth: usize, max_ssrcs: Option<usize>) -> Self

Create a new reordering buffer.

§Arguments
  • depth: maximum number of buffered packets across all SSRCs and also the maximum distance between sequence numbers of any pair of packets within a single SSRC
  • max_ssrcs: maximum number of SSRCs to track; if the number of SSRCs exceeds this limit, the least recently used SSRCs will be dropped

Using unlimited number of SSRCs (i.e. max_ssrcs == None) is not recommended as the memory usage would not be limited in this case.

Source

pub fn estimate_index(&self, ssrc: u32, sequence_nr: u16) -> u64

Estimate packet index from a given sequence number.

Source

pub fn is_duplicate(&self, ssrc: u32, index: u64) -> bool

Check if a packet with a given index would be a duplicate.

Source

pub fn push( &mut self, packet: IncomingRtpPacket, ) -> Result<u64, ReorderingError>

Push a given packet into the buffer and return index of the inserted packet.

The method returns an error if the packet cannot be inserted into the buffer because it is either a duplicate or the buffer would exceed its capacity.

Source

pub fn next(&mut self) -> Option<OrderedRtpPacket>

Take the next packet from the buffer.

This method will return a packet only if it is in-order (i.e. no packets would be skipped for the corresponding SSRC) or if the corresponding SSRC has been dropped from the buffer.

Source

pub fn take(&mut self) -> Option<OrderedRtpPacket>

Take the next packet from the buffer.

This method will either return the next in-order packet or contents of the first slot of a SSRC sub-buffer containing the oldest packet. The method will always advance the buffer state. Calling this method repeatedly will eventually drain the buffer.

Note that this method may return None even if the buffer is not empty. It only indicates a missing packet.

Source

pub fn is_empty(&self) -> bool

Check if the underlying buffer is empty.

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V