aboutsummaryrefslogtreecommitdiff
path: root/rtp/src/rtcp.rs
blob: 0ae8ea7dfddd8adcf7beb2ffc8eff93f9fe0a609 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#[derive(Debug, thiserror::Error)]
pub enum Error {
    #[error("packet truncated")]
    Truncated,
}

pub struct RtcpPacket<'a> {
    a: &'a [u8],
}

pub enum RtcpPart {
    SenderReport {},
    ReceiverReport {},
    SourceDescription {},
    Bye {},
    Application {},
}

impl<'a> RtcpPacket<'a> {
    pub fn parse(packet: &'a [u8]) -> Result<RtcpPacket<'a>, Error> {
        Ok(Self { a: packet })
    }
    pub fn write(&self, out: &mut Vec<u8>) {
        out.extend(self.a);
    }
}