pub struct RtpPacket<'a> {
pub marker: bool,
pub payload_type: u8,
pub sequence_number: u16,
pub timestamp: u32,
pub ssrc: u32,
pub csrc: Vec<u32>,
pub extension: Option<HeaderExtension<'a>>,
pub padding: Option<&'a [u8]>,
pub payload: &'a [u8],
}Expand description
A parsed (or to-be-serialized) RTP packet: the §5.1 fixed header, the CSRC list, the optional §5.3.1 header extension, an optional padding region, and the payload.
version is not a stored field: RFC 3550 fixes it at 2, so parse
rejects any other value and serialize_into always writes 2 — storing a
field that can only ever legally hold one value would just be another way
for caller state to disagree with the wire (see RTP_VERSION).
P (padding) and X (extension) are likewise never stored directly: they
are derived from padding.is_some() / extension.is_some() on serialize,
and CC is derived from csrc.len() — the same “derive from the typed
data, never trust an independent flag” discipline used throughout this
project (see the module doc’s citation of docs/rtp-header.md).
Fields§
§marker: boolmarker (M) — profile-specific, opaque at this layer (§5.1).
payload_type: u8payload type (PT), 7 bits (§5.1).
sequence_number: u16sequence number, 16 bits (§5.1).
timestamp: u32timestamp, 32 bits (§5.1).
ssrc: u32SSRC — synchronization source identifier, 32 bits (§5.1).
csrc: Vec<u32>The CSRC identifier list, 0–15 entries (§5.1 CC/CSRC list). CC is
always csrc.len() — there is no separate stored count.
extension: Option<HeaderExtension<'a>>The §5.3.1 header extension, if X=1.
padding: Option<&'a [u8]>The trailing padding region, if P=1: the raw octets as they appear on
the wire, whose last byte is the padding count “including itself”
(§5.1). Storing the whole slice (rather than just a count) preserves
whatever content precedes the count byte byte-exactly on round-trip,
since RFC 3550 does not constrain it.
payload: &'a [u8]The payload: whatever bytes remain after the fixed header, CSRC list,
and extension, with the trailing padding (if any) already excluded.
Implementations§
Trait Implementations§
impl<'a> Eq for RtpPacket<'a>
Source§impl Serialize for RtpPacket<'_>
impl Serialize for RtpPacket<'_>
Source§type Error = Error
type Error = Error
Parse impl, but need not be).Source§fn serialized_len(&self) -> usize
fn serialized_len(&self) -> usize
serialize_into will write.