Expand description
RFC references covered:
- RTP base protocol: https://www.rfc-editor.org/rfc/rfc3550
- RTP A/V profile payload assignments: https://www.rfc-editor.org/rfc/rfc3551
- RTP header extension framework: https://www.rfc-editor.org/rfc/rfc8285
- RTCP feedback profile: https://www.rfc-editor.org/rfc/rfc4585
- RTP retransmission payload format: https://www.rfc-editor.org/rfc/rfc4588
- RTP stream identifier SDES items: https://www.rfc-editor.org/rfc/rfc8852
- Video frame marking RTP header extension: https://www.rfc-editor.org/rfc/rfc9626
- Layer Refresh Request feedback: https://www.rfc-editor.org/rfc/rfc9627
- RTP payload format for VP8: https://www.rfc-editor.org/rfc/rfc7741
- RTP payload format for H264: https://www.rfc-editor.org/rfc/rfc6184
A complete RTP packet has this outer shape:
0 1 2 3
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|V=2|P|X| CC |M| PT | sequence number |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| timestamp |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| SSRC |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| CSRC list ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| extension block if X=1 ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| codec payload ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+Generic NACK is RTCP feedback rather than a field in an RTP packet. One
RTPFB packet can carry multiple PID/BLP entries:
0 1 2 3
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|V=2|P| FMT=1 | PT=205 | length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| SSRC of feedback sender |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| SSRC of primary media |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| PID | BLP |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| more PID/BLP entries ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+PID names one missing primary RTP sequence number. Zero-based BLP bit i
reports (PID + i + 1) mod 2^16 as missing. See
RFC 4585 section 6.1
and
RFC 4585 section 6.2.1.
RTX is a new RTP packet in the repair stream. Its RTP header has the repair payload type, repair SSRC and an independent repair sequence number. The payload begins with the original sequence number:
0 1 2 3
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|V=2|P|X| CC |M| RTX PT | repair sequence number |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| original RTP timestamp |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| repair SSRC |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| optional CSRC list and RTP header extension ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| OSN | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| original RTP packet payload ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+apt binds the RTX payload type to the primary payload type in SDP. It is
not carried in either packet. See
RFC 4588 section 4
and
RFC 4588 section 8.1.
Modulesยง
- codec_
name - RTP payload-format MIME subtype names commonly used by WebRTC endpoints.
- fmtp
- Codec
fmtpparameter names and canonical valuse - frame_
marking - Video Frame Marking RTP header-extension payload values.
- g711
- G.711 RTP payload-format constants
- h264
- H264 SDP and payload-format helpers derived from RFC 6184.
- header_
extension - RTP header-extension profile IDs from RFC 8285.
- opus
- Opus RTP payload-format constants.
- rtcp_
feedback_ format - RTCP feedback FMT values.
- rtcp_
packet_ type - rtcp common-header
PTvalue namespace - rtcp_
sdes_ item - rtcp SDES item
typevalue namespace - vp8
- VP8 RTP payload helpers.
Structsยง
- Header
Extension Id - Local 4-bit identifier for a header extension (RFC 8285).
- Invalid
Payload Type - Mid
- Media identification (RFC 9143).
- Payload
Type - 7-bit RTP payload type value usable in RTP/RTCP muxed sessions
- Rid
- Restriction identifier (RFC 8851).
- RtpFixed
Header - Parsed fields from an RTP fixed header in an RTP/RTCP muxed session.
- Ssrc
- Synchronization source identifier for a media stream (RFC 3550).
- Vp9Profile
Id - VP9 profile identifier defined by RFC 9628 section 6
Enumsยง
- AvpStatic
Payload Type - Common static RTP/AVP payload type assignments.
- Codec
Name - RTP payload-format MIME subtype names commonly used by WebRTC endpoints.
- RtpRtcp
MuxPacket Kind - RTP or RTCP candidate selected by the RFC 5761 second-octet split.
Constantsยง
- GENERIC_
NACK_ ๐BITMASK_ BITS - Number of sequence numbers represented by the Generic NACK BLP field after its PID.
- RTCP_
COMMON_ ๐HEADER_ BYTES - RTCP common-header length in bytes.
- RTCP_
RECEIVER_ REPORT_ WITHOUT_ BLOCKS_ BYTES - Length of an RTCP Receiver Report with no report blocks.
- RTCP_
RECEIVER_ ๐REPORT_ WITHOUT_ BLOCKS_ LENGTH_ WORDS_ MINUS_ ONE - RTCP_
SSRC_ ๐BYTES - SSRC field length in an RTCP packet.
- RTP_
CSRC_ ๐BYTES - RTP_
CSRC_ ๐COUNT_ MASK - RTP_
DYNAMIC_ PAYLOAD_ TYPE_ END - RTP_
DYNAMIC_ PAYLOAD_ TYPE_ START - Dynamic RTP payload type range in RTP/AVP.
- RTP_
EXTENSION_ ๐MASK - RTP_
FIXED_ HEADER_ BYTES - Fixed RTP header length in bytes with no CSRC and no extension.
- RTP_
MARKER_ ๐MASK - RTP_
MAX_ CSRC_ COUNT - Maximum number of CSRC identifiers in the RTP fixed header.
- RTP_
PADDING_ ๐MASK - RTP_
PAYLOAD_ ๐TYPE_ BITS - RTP_
PAYLOAD_ TYPE_ COUNT - Number of values representable by the 7-bit RTP payload type field.
- RTP_
PAYLOAD_ ๐TYPE_ MASK - RTP_
PAYLOAD_ TYPE_ MAX - Maximum value representable by the 7-bit RTP payload type field.
- RTP_
RTCP_ MUX_ FORBIDDEN_ PAYLOAD_ TYPE_ END - RTP_
RTCP_ MUX_ FORBIDDEN_ PAYLOAD_ TYPE_ START - Payload type range disallowed when RTP and RTCP share one port.
- RTP_
SEQUENCE_ NUMBER_ MODULUS - Sequence number rollover modulus for the 16-bit RTP sequence number.
- RTP_
SEQUENCE_ ๐NUMBER_ OFFSET - RTP_
SSRC_ ๐OFFSET - RTP_
TIMESTAMP_ MODULUS - Timestamp rollover modulus for the 32-bit RTP timestamp field.
- RTP_
TIMESTAMP_ ๐OFFSET - RTP_
VERSION - RTP version defined by RFC 3550 section 5.1.
- RTP_
VERSION_ ๐HEADER_ BITS - RTP version bits in the first octet of RTP and RTCP packets.
- RTP_
VERSION_ ๐MASK - RTP_
VERSION_ ๐SHIFT - RTP_
VIDEO_ CLOCK_ RATE_ HZ - RTP clock rate used by the supported video payload formats
- RTX_
ORIGINAL_ SEQUENCE_ NUMBER_ BYTES - Number of octets prepended to an RTX payload for the original sequence number.
Functionsยง
- classify_
rtp_ rtcp_ mux - Classifies an RTP or RTCP candidate in an RTP/RTCP muxed datagram.
- generic_
nack_ sequence_ numbers - Expands one Generic NACK PID and bitmask into requested RTP sequence numbers.
- is_
dynamic_ payload_ type - Returns
trueifpayload_typeis an RTP/AVP dynamic payload type. - is_
payload_ type - Returns
trueifpayload_typefits in the RTP fixed-header PT field. - is_
rtcp_ mux_ dynamic_ payload_ type - Returns whether
payload_typecan be assigned dynamically in an RTP/RTCP muxed RTP/AVP session. - is_
rtcp_ mux_ payload_ type - Returns
trueifpayload_typecan be used with RTP/RTCP mux. - parse_
muxed_ rtp_ fixed_ header - Parses the fixed RTP header of an RTP candidate in a muxed session.
- read_
u16 ๐ - read_
u32 ๐ - rtcp_
receiver_ report_ without_ report_ blocks - Builds an RTCP Receiver Report with no reception report blocks.
- rtx_
original_ sequence_ number - Extracts the original RTP sequence number from an RTX payload.