Struct interceptor::mock::mock_stream::MockStream
source · pub struct MockStream { /* private fields */ }
Expand description
MockStream is a helper struct for testing interceptors.
Implementations§
source§impl MockStream
impl MockStream
sourcepub async fn new(
info: &StreamInfo,
interceptor: Arc<dyn Interceptor + Send + Sync>
) -> Arc<Self>
pub async fn new( info: &StreamInfo, interceptor: Arc<dyn Interceptor + Send + Sync> ) -> Arc<Self>
new creates a new MockStream
sourcepub async fn write_rtcp(
&self,
pkt: &[Box<dyn Packet + Send + Sync>]
) -> Result<usize, Error>
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
sourcepub async fn write_rtp(&self, pkt: &Packet) -> Result<usize, Error>
pub async fn write_rtp(&self, pkt: &Packet) -> Result<usize, Error>
write_rtp writes an rtp packet to the stream, using the interceptor
sourcepub async fn receive_rtcp(&self, pkts: Vec<Box<dyn Packet + Send + Sync>>)
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
sourcepub async fn receive_rtp(&self, pkt: Packet)
pub async fn receive_rtp(&self, pkt: Packet)
receive_rtp schedules a rtp packet, so it can be read be the stream
sourcepub async fn written_rtcp(&self) -> Option<Vec<Box<dyn Packet + Send + Sync>>>
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
sourcepub async fn last_written_rtcp(
&self
) -> Option<Vec<Box<dyn Packet + Send + Sync>>>
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.
sourcepub async fn written_rtp(&self) -> Option<Packet>
pub async fn written_rtp(&self) -> Option<Packet>
written_rtp returns a channel containing rtp packets written, modified by the interceptor
sourcepub async fn read_rtcp(
&self
) -> Option<Result<Vec<Box<dyn Packet + Send + Sync>>, Error>>
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