Skip to main content

Module h264

Module h264 

Source
Expand description

H264 SDP and payload-format helpers derived from RFC 6184.

Packet helpers in this module receive the H264 RTP payload slice. The first byte of that slice identifies the packetization mode used by the packet. Decoder-refresh detection needs to recognize IDR access units in all packet shapes that browsers commonly send.

Single NAL unit packet

+-------------+----------------------+
| NAL header  | NAL payload          |
+-------------+----------------------+
| F NRI Type  | ...                  |
+-------------+----------------------+

STAP-A aggregation packet

+---------------+----------+-------------+----------+-------------+
| STAP-A header | NAL size | NAL bytes   | NAL size | NAL bytes   |
+---------------+----------+-------------+----------+-------------+
| Type=24       | 16 bits  | starts with | 16 bits  | starts with |
|               |          | NAL header  |          | NAL header  |
+---------------+----------+-------------+----------+-------------+

FU-A fragmentation packet

+---------------+-------------+----------------------+
| FU indicator  | FU header   | fragment payload     |
+---------------+-------------+----------------------+
| Type=28       | S E R Type  | first fragment if S=1 |
+---------------+-------------+----------------------+

rfc 6184 maps profile-level-id to three bytes:

profile_idc | profile-iop | level_idc

profile-iop bit layout:
 7   6   5   4   3   2   1   0
+---+---+---+---+---+---+---+---+
|c0 |c1 |c2 |c3 |c4 |c5 | r | r |
+---+---+---+---+---+---+---+---+

cN = constraint_setN_flag
r  = reserved_zero bit

Structsยง

ProfileIopPattern ๐Ÿ”’
masked profile-iop matcher for profile-equivalence wildcard bits
ProfileLevelId
parsed H264 profile-level-id capability
ProfilePattern ๐Ÿ”’
one accepted RFC 6184 profile-equivalence row

Enumsยง

LevelIdc
H264 decoder capability level
PacketizationMode
H264 RTP packetization mode.
Profile
H264 sub-profile after equivalent RFC 6184 encodings are normalized

Constantsยง

BASELINE_IDC ๐Ÿ”’
CAVLC_444_IDC ๐Ÿ”’
EXTENDED_IDC ๐Ÿ”’
FU_END_BIT
FU-A end bit in the FU header.
FU_START_BIT
FU-A start bit in the FU header.
HIGH_10_IDC ๐Ÿ”’
HIGH_422_IDC ๐Ÿ”’
HIGH_444_IDC ๐Ÿ”’
HIGH_IDC ๐Ÿ”’
IOP_CONSTRAINED_BASELINE ๐Ÿ”’
IOP_CONSTRAINT_SET0 ๐Ÿ”’
IOP_CONSTRAINT_SET1 ๐Ÿ”’
IOP_CONSTRAINT_SET2 ๐Ÿ”’
IOP_CONSTRAINT_SET3 ๐Ÿ”’
IOP_NONE ๐Ÿ”’
IOP_PROFILE_PATTERN_LOW_ZERO_MASK ๐Ÿ”’
LEVEL_1B_IDCS ๐Ÿ”’
LEVEL_1B_OTHER_IDC ๐Ÿ”’
LEVEL_1_1_IDC ๐Ÿ”’
MAIN_IDC ๐Ÿ”’
NAL_REF_IDC_HIGH
Highest NRI value for reference NAL units.
NAL_UNIT_TYPE_FU_A
H264 FU-A fragmentation packet type.
NAL_UNIT_TYPE_IDR
H264 IDR slice NAL unit type.
NAL_UNIT_TYPE_MASK
Mask for the H264 NAL unit type field.
NAL_UNIT_TYPE_STAP_A
H264 STAP-A aggregation packet type.
PROFILE_PATTERNS ๐Ÿ”’

Functionsยง

decode_hex_byte ๐Ÿ”’
decode_hex_nibble ๐Ÿ”’
fu_a_starts_idr ๐Ÿ”’
Detects whether a FU-A packet is the first fragment of an IDR NAL unit.
level_1b_profile_level_id_bytes ๐Ÿ”’
level_idc_value ๐Ÿ”’
normalized_level_idc ๐Ÿ”’
pack_profile_level_id ๐Ÿ”’
parse_profile_level_id_bytes ๐Ÿ”’
payload_starts_idr
Detects an H264 RTP packet that starts an IDR access unit.
profile_bytes ๐Ÿ”’
profile_from_bytes ๐Ÿ”’
profile_level_id_bytes ๐Ÿ”’
stap_a_contains_idr ๐Ÿ”’
Scans a STAP-A payload for any contained IDR NAL unit.