rtp_parse/rtcp/
rtcp_report_block.rs

1use parsely_rs::*;
2
3/// https://datatracker.ietf.org/doc/html/rfc3550#section-6.4.1
4///         0                   1                   2                   3
5///         0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
6///        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
7/// header |V=2|P|    RC   |   PT=SR=200   |             length            |
8///        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
9///        |                         SSRC of sender                        |
10///        +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
11/// sender |              NTP timestamp, most significant word             |
12/// info   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
13///        |             NTP timestamp, least significant word             |
14///        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
15///        |                         RTP timestamp                         |
16///        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
17///        |                     sender's packet count                     |
18///        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
19///        |                      sender's octet count                     |
20///        +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
21/// report |                 SSRC_1 (SSRC of first source)                 |
22/// block  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
23///   1    | fraction lost |       cumulative number of packets lost       |
24///        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
25///        |           extended highest sequence number received           |
26///        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
27///        |                      interarrival jitter                      |
28///        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
29///        |                         last SR (LSR)                         |
30///        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
31///        |                   delay since last SR (DLSR)                  |
32///        +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
33/// report |                 SSRC_2 (SSRC of second source)                |
34/// block  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
35///   2    :                               ...                             :
36///        +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
37///        |                  profile-specific extensions                  |
38///        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
39#[derive(Debug, PartialEq, Eq, ParselyRead, ParselyWrite)]
40pub struct RtcpReportBlock {
41    pub ssrc: u32,
42    pub fraction_lost: u8,
43    pub cumulative_lost: u24,
44    pub extended_highest_seq_num: u32,
45    pub interarrival_jitter: u32,
46    pub last_sr_timestamp: u32,
47    pub delay_since_last_sr: u32,
48}
49
50impl RtcpReportBlock {
51    pub const SIZE_BYTES: usize = 24;
52}