rtp_parser/
rtp.rs

1use crate::rtp_header_extension::RtpPacketHeaderExtension;
2
3/// An RTP packet, https://tools.ietf.org/html/rfc3550#section-5.1
4#[derive(Debug)]
5pub struct RtpPacket<'a> {
6    /// version -- 2 bits
7    pub version: u8,
8
9    /// padding flag -- 1 bit
10    pub padding: u8,
11
12    /// extension flag -- 1 bit
13    pub extension: u8,
14
15    /// csrc count -- 4 bits
16    pub csrc_count: u8,
17
18    /// marker flag -- 1 bit
19    pub marker: u8,
20
21    /// payload type -- 7 bits
22    pub payload_type: u8,
23
24    /// sequence number -- 2 bytes
25    pub sequence_number: u16,
26
27    /// timestamp -- 4 bytes
28    pub timestamp: u32,
29
30    /// synchronization source identifier
31    pub ssrc: u32,
32
33    /// contributing source identifiers (0 to 15)
34    pub csrc: Vec<u32>,
35
36    /// optional header extension
37    pub header_extension: Option<RtpPacketHeaderExtension<'a>>,
38
39    /// payload
40    pub payload: &'a [u8],
41
42    /// padding
43    pub padding_bytes: &'a [u8],
44}