1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
use crate::error::Result;
use crate::{Attributes, RTCPReader, RTPReader};

use async_trait::async_trait;
use srtp::stream::Stream;

#[async_trait]
impl RTPReader for Stream {
    async fn read(&self, buf: &mut [u8], a: &Attributes) -> Result<(usize, Attributes)> {
        Ok((self.read(buf).await?, a.clone()))
    }
}

#[async_trait]
impl RTCPReader for Stream {
    async fn read(&self, buf: &mut [u8], a: &Attributes) -> Result<(usize, Attributes)> {
        Ok((self.read(buf).await?, a.clone()))
    }
}