xref: /webrtc/interceptor/src/stream_reader.rs (revision ffe74184)
1 use crate::error::Result;
2 use crate::{Attributes, RTCPReader, RTPReader};
3 
4 use async_trait::async_trait;
5 use srtp::stream::Stream;
6 
7 #[async_trait]
8 impl RTPReader for Stream {
read(&self, buf: &mut [u8], a: &Attributes) -> Result<(usize, Attributes)>9     async fn read(&self, buf: &mut [u8], a: &Attributes) -> Result<(usize, Attributes)> {
10         Ok((self.read(buf).await?, a.clone()))
11     }
12 }
13 
14 #[async_trait]
15 impl RTCPReader for Stream {
read(&self, buf: &mut [u8], a: &Attributes) -> Result<(usize, Attributes)>16     async fn read(&self, buf: &mut [u8], a: &Attributes) -> Result<(usize, Attributes)> {
17         Ok((self.read(buf).await?, a.clone()))
18     }
19 }
20