Expand description
The RTP header, its extensions, and the bit masks that encode it. The RTP header and its extensions.
Header is the fixed 12-byte header plus the optional CSRC list and header-extension
block. The *_SHIFT/*_MASK constants describe how the flag fields pack into the first two
octets, and the *_OFFSET/*_LENGTH constants give the byte positions a caller can patch in
place without re-encoding.
Header extensions (RFC 8285) come in two forms, selected by
Header::extension_profile: one-byte ids (EXTENSION_PROFILE_ONE_BYTE) or two-byte ids
(EXTENSION_PROFILE_TWO_BYTE) when an id above 14 is needed. Use
Header::set_extension and Header::get_extension rather than touching
Header::extensions directly — they keep Header::extensions_padding and the extension
flag consistent, which marshalling depends on.
Structs§
- Extension
- One RTP header extension: an id and its payload bytes.
- Header
- Header represents an RTP packet header NOTE: PayloadOffset is populated by Marshal/Unmarshal and should not be modified
Constants§
- CC_MASK
- Bit mask of the CSRC count field.
- CSRC_
LENGTH - Length of each CSRC in bytes.
- CSRC_
OFFSET - Byte offset of the first CSRC within the header.
- EXTENSION_
ID_ RESERVED - Extension id 15, reserved by the RFC and never assigned.
- EXTENSION_
MASK - Bit mask of the extension flag once shifted.
- EXTENSION_
PROFILE_ ONE_ BYTE - Extension profile
0xBEDE, which selects one-byte header extension ids ([RFC 8285]). - EXTENSION_
PROFILE_ TWO_ BYTE - Extension profile
0x1000, which selects two-byte header extension ids, allowing ids above 14. - EXTENSION_
SHIFT - Bit offset of the extension flag.
- HEADER_
LENGTH - The length of the extension-profile and length fields that precede header extensions.
- MARKER_
MASK - Bit mask of the marker bit once shifted.
- MARKER_
SHIFT - Bit offset of the marker bit.
- PADDING_
MASK - Bit mask of the padding flag once shifted.
- PADDING_
SHIFT - Bit offset of the padding flag.
- PT_MASK
- Bit mask of the payload-type field.
- SEQ_
NUM_ LENGTH - Length of the sequence number in bytes.
- SEQ_
NUM_ OFFSET - Byte offset of the sequence number within the header.
- SSRC_
LENGTH - Length of the SSRC in bytes.
- SSRC_
OFFSET - Byte offset of the SSRC within the header.
- TIMESTAMP_
LENGTH - Length of the timestamp in bytes.
- TIMESTAMP_
OFFSET - Byte offset of the timestamp within the header.
- VERSION_
MASK - Bit mask of the version field once shifted.
- VERSION_
SHIFT - Bit offset of the version field in the first header octet.