MockStream

Struct MockStream 

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

MockStream is a helper struct for testing interceptors.

Implementations§

Source§

impl MockStream

Source

pub async fn new( info: &StreamInfo, interceptor: Arc<dyn Interceptor + Send + Sync>, ) -> Arc<Self>

new creates a new MockStream

Source

pub async fn write_rtcp( &self, pkt: &[Box<dyn Packet + Send + Sync>], ) -> Result<usize, Error>

write_rtcp writes a batch of rtcp packet to the stream, using the interceptor

Source

pub async fn write_rtp(&self, pkt: &Packet) -> Result<usize, Error>

write_rtp writes an rtp packet to the stream, using the interceptor

Source

pub async fn receive_rtcp(&self, pkts: Vec<Box<dyn Packet + Send + Sync>>)

receive_rtcp schedules a new rtcp batch, so it can be read be the stream

Source

pub async fn receive_rtp(&self, pkt: Packet)

receive_rtp schedules a rtp packet, so it can be read be the stream

Source

pub async fn written_rtcp(&self) -> Option<Vec<Box<dyn Packet + Send + Sync>>>

written_rtcp returns a channel containing the rtcp batches written, modified by the interceptor

Source

pub async fn last_written_rtcp( &self, ) -> Option<Vec<Box<dyn Packet + Send + Sync>>>

Returns the last rtcp packet bacth that was written, modified by the interceptor.

NB: This method discards all other previously recoreded packet batches.

Source

pub async fn written_rtp(&self) -> Option<Packet>

written_rtp returns a channel containing rtp packets written, modified by the interceptor

Source

pub async fn read_rtcp( &self, ) -> Option<Result<Vec<Box<dyn Packet + Send + Sync>>, Error>>

read_rtcp returns a channel containing the rtcp batched read, modified by the interceptor

Source

pub async fn read_rtp(&self) -> Option<Result<Packet, Error>>

read_rtp returns a channel containing the rtp packets read, modified by the interceptor

Source

pub async fn close(&self) -> Result<(), Error>

close closes the stream

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> Same for T

Source§

type Output = T

Should always be Self
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