Skip to main content

Module header

Module header 

Source
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.