Expand description
RTMP chunk stream — basic header, message header, extended timestamp (Adobe RTMP 1.0 §5.3).
See private/specs-verified/rtmp/rtmp-runtime/rtmp.md §3 (RTMP Chunk Stream) for the wire
layout: chunk format (§5.3.1), basic header (§5.3.1.1), the four message
header fmt variants (§5.3.1.2), and extended timestamp (§5.3.1.3).
This module implements the chunk header wire types (BasicHeader,
MessageHeader) and the stateful reassembly engine built on top of them:
ChunkAssembler (inbound, tracks prior-chunk state per csid so fmt
1/2/3 headers can inherit the fields they omit, and reassembles chunked
payload back into whole Messages) and ChunkWriter (outbound,
splits a Message into fmt 0 + 3 chunks at the configured chunk
size).
Structs§
- Basic
Header - Chunk Basic Header (§5.3.1.1): 1 to 3 bytes encoding the 2-bit
fmtand the chunk stream id (csid). Length depends only on the csid value; the implementation SHOULD (and thisSerializeimpl does) use the smallest form that holds the id. - Chunk
Assembler - Stateful inbound chunk reassembler (§5.3): feed inbound bytes, get back
each complete
Messageas soon as its last chunk arrives. - Chunk
Limits - The four bounds
ChunkAssemblerholds a peer to, all chosen by the caller: the crate supplies none of them. - Chunk
Writer - Stateless-per-message outbound chunk writer (§5.3): serializes a
Messageinto chunk bytes at the current chunk size. - Message
- One fully reassembled RTMP message: the payload of a single message
stream at a single (resolved, absolute) timestamp (§6.1). Produced by
ChunkAssembler::pushand consumed byChunkWriter::write.
Enums§
- Fmt
- The 2-bit
fmtfield selecting one of the 4 Chunk Message Header formats (§5.3.1.1, §5.3.1.2). - Message
Header - Chunk Message Header: one of 4 formats selected by
Fmt(§5.3.1.2), carrying decreasing field sets — each format after Type 0 inherits the fields it omits from the preceding chunk on the same chunk stream.
Constants§
- DEFAULT_
CHUNK_ SIZE DEFAULT_CHUNK_SIZE_VALUEas an adopted size.- DEFAULT_
CHUNK_ SIZE_ VALUE - Default chunk size (§5.3, §5.4.1): 128 bytes, in effect until a Set Chunk Size protocol control message changes it.
- EXTENDED_
TIMESTAMP_ MARKER - The 24-bit sentinel value that, in a Type 0/1/2 message header’s
timestamp/timestamp deltafield, signals that the field does not carry the real value: the full 32-bit value instead follows in a 4-byte Extended Timestamp (§5.3.1.3). Per §5.3.1.2.1, any real timestamp/delta>= EXTENDED_TIMESTAMP_MARKERis encoded this way.