pub enum Rtcp {
Sender(SenderReport),
Receiver(ReceiverReport),
Sdes(Sdes),
Other {
packet_type: u8,
count: u8,
padding: bool,
payload: Bytes,
},
}Expand description
An RTCP packet.
Variants§
Sender(SenderReport)
A sender report.
Receiver(ReceiverReport)
A receiver report.
Sdes(Sdes)
A source description.
Other
Something else — goodbyes, application data.
Kept rather than dropped: RTCP arrives as compound packets, and an element that discards the types it does not model cannot forward one intact.
Fields
count: u8The header’s five-bit count, verbatim. It is load-bearing for types this crate does not model — §6.5 reads it as the SDES chunk count, §6.6 as the BYE source count — so re-encoding it as zero empties the packet.
padding: boolWhether the padding bit was set. It decides where the payload ends, so it has to travel with the bytes it describes.
payload: BytesIts body, verbatim.
Implementations§
Source§impl Rtcp
impl Rtcp
Sourcepub fn encode_compound(packets: &[Self]) -> Bytes
pub fn encode_compound(packets: &[Self]) -> Bytes
Serialize several packets as one datagram.
RFC 3550 §6.1: every RTCP packet is sent in a compound of at least two, led by a report and carrying an SDES CNAME. The parts are plain concatenation — this exists so a caller sends one datagram rather than one per part.
Sourcepub fn decode_compound(bytes: &Bytes) -> Result<Vec<Self>, RtcpError>
pub fn decode_compound(bytes: &Bytes) -> Result<Vec<Self>, RtcpError>
Parse a compound packet into its parts.
RTCP is sent compound — a report followed by a source description, usually — and a parser that reads only the first packet sees a fraction of what arrived.