H264 over RTP (RFC 6184, packetization mode 1), both directions.
Sending: payloads/2 turns an Annex-B access unit, as mob_screencast
delivers it (NAL units behind 00 00 01 or 00 00 00 01 start codes,
SPS/PPS ahead of a keyframe's slices), into RTP payloads: each NAL unit that
fits in max_payload bytes is one payload (single NAL unit packet), larger
ones are split into FU-A fragments.
Receiving: depayload/3 turns RTP payloads back into NAL units. ex_webrtc
0.18's H264 depayloader drops the header byte of single-NAL-unit packets, so
an SPS (type 7) comes out as a type 2 slice fragment and no decoder can
start; this one keeps whole NAL units.
Summary
Types
An FU-A unit being reassembled, and the sequence number expected next.
Functions
The whole NAL units (without start codes) that the RTP payload with
sequence_number completes. A fragmented NAL unit that misses a packet, or
whose start was never seen, is dropped rather than passed on corrupt.
The NAL units of an Annex-B access unit, without start codes.
The RTP payloads for access_unit, in order; the last one ends the frame (marker bit).
Types
@type depayloader() :: %{ fragments: [binary()] | nil, next_seq: non_neg_integer() | nil }
An FU-A unit being reassembled, and the sequence number expected next.
Functions
@spec depayload(depayloader(), binary(), non_neg_integer()) :: {[binary()], depayloader()}
The whole NAL units (without start codes) that the RTP payload with
sequence_number completes. A fragmented NAL unit that misses a packet, or
whose start was never seen, is dropped rather than passed on corrupt.
@spec depayloader() :: depayloader()
The NAL units of an Annex-B access unit, without start codes.
@spec payloads(binary(), pos_integer()) :: [binary()]
The RTP payloads for access_unit, in order; the last one ends the frame (marker bit).