Skip to main content

Module chunk

Module chunk 

Source
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§

BasicHeader
Chunk Basic Header (§5.3.1.1): 1 to 3 bytes encoding the 2-bit fmt and the chunk stream id (csid). Length depends only on the csid value; the implementation SHOULD (and this Serialize impl does) use the smallest form that holds the id.
ChunkAssembler
Stateful inbound chunk reassembler (§5.3): feed inbound bytes, get back each complete Message as soon as its last chunk arrives.
ChunkLimits
The four bounds ChunkAssembler holds a peer to, all chosen by the caller: the crate supplies none of them.
ChunkWriter
Stateless-per-message outbound chunk writer (§5.3): serializes a Message into 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::push and consumed by ChunkWriter::write.

Enums§

Fmt
The 2-bit fmt field selecting one of the 4 Chunk Message Header formats (§5.3.1.1, §5.3.1.2).
MessageHeader
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_VALUE as 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 delta field, 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_MARKER is encoded this way.