12 #ifndef ROC_RTP_HEADERS_H_
13 #define ROC_RTP_HEADERS_H_
60 Flag_VersionShift = 6,
61 Flag_VersionMask = 0x3,
69 Flag_PaddingShift = 5,
70 Flag_PaddingMask = 0x1,
78 Flag_ExtensionShift = 4,
79 Flag_ExtensionMask = 0x1,
98 MPT_PayloadTypeShift = 0,
99 MPT_PayloadTypeMask = 0x7f
122 return (uint32_t)
sizeof(*this) +
num_csrc() * (uint32_t)
sizeof(uint32_t);
127 memset(
this, 0,
sizeof(*
this));
132 return ((flags_ >> Flag_VersionShift) & Flag_VersionMask);
138 flags_ &= (uint8_t) ~(Flag_VersionMask << Flag_VersionShift);
139 flags_ |= ((uint8_t)v << Flag_VersionShift);
144 return (flags_ & (Flag_PaddingMask << Flag_PaddingShift));
149 flags_ &= (uint8_t) ~(Flag_PaddingMask << Flag_PaddingShift);
150 flags_ |= ((v ? 1 : 0) << Flag_PaddingShift);
155 return (flags_ & (Flag_ExtensionMask << Flag_ExtensionShift));
160 return ((mpt_ >> MPT_PayloadTypeShift) & MPT_PayloadTypeMask);
166 mpt_ &= (uint8_t) ~(MPT_PayloadTypeMask << MPT_PayloadTypeShift);
167 mpt_ |= (pt << MPT_PayloadTypeShift);
172 return (mpt_ & (MPT_MarkerMask << MPT_MarkerShift));
177 mpt_ &= (uint8_t) ~(MPT_MarkerMask << MPT_MarkerShift);
178 mpt_ |= ((!!m) << MPT_MarkerShift);
213 return ((flags_ >> Flag_CSRCShift) & Flag_CSRCMask);
#define ROC_ATTR_PACKED_BEGIN
Pack structure fields. Place these before class or struct keyword.
#define ROC_ATTR_PACKED_END
Pack structure fields. Place these between '}' and ';'.
Endian conversion functions.
uint16_t hton16u(uint16_t v)
Host to network byte order (unsigned 16-bit).
uint16_t ntoh16u(uint16_t v)
Network to host byte order (unsigned 16-bit).
uint32_t hton32u(uint32_t v)
Host to network byte order (unsigned 32-bit).
uint32_t ntoh32u(uint32_t v)
Network to host byte order (unsigned 32-bit).
uint32_t stream_source_t
Packet stream identifier.
uint16_t seqnum_t
Packet sequence number.
uint32_t stream_timestamp_t
Packet stream timestamp.
Version
RTP protocol version.
PayloadType
RTP payload type.
@ PayloadType_L16_Mono
Audio, 16-bit PCM, 1 channel, 44100 Hz.
@ PayloadType_L16_Stereo
Audio, 16-bit PCM, 2 channels, 44100 Hz.
#define roc_panic_if(x)
Panic if condition is true.
Commonly used types and functions.
Various units used in packets.