Chunk Stream ID
After handshaking, the connection multiplexes one or more chunk streams.
Each chunk stream carries messages of one type from one message stream.
Each chunk that is created has a unique(唯一的) ID associated with it called chunk stream ID.
The chunks are transmitted over the network. While transmitting, each chunk must be sent in full before the next chunk.
At the receiver end, the chunks are assembled into messages based on the chunk stream ID
RTMP
流中视频和音频拥有单独的Chunk Stream ID
(后续简称cs id
)。
比如音频的cs id=20
,视频的cs id=21
。
接收端接收到Chunk
之后,根据cs id
分别将音频和视频“拼成消息”。
Chunk Stream ID 2
Chunk Stream ID with value 2 is reserved for low-level protocol control messages and commands.
Chunk Stream ID 2
用于发送优先级比较低的协议控制信息和命令。
在RTMP协议中, 以下内容通过stream ID 0和chunk stream ID 2来发送:
- 协议控制信息(protocol control messages)
message type IDs 为 1, 2, 3, 5, and 6 - 用户控制信息(User Control messages)
message type ID等于 4
protocol control messages
RTMP Chunk Stream uses message type IDs 1, 2, 3, 5, and 6 for
protocol control messages.
These messages contain information needed by the RTMP Chunk Stream protocol.
These protocol control messages MUST have message stream ID 0 (known as the control stream) and be sent in chunk stream ID 2.
User Control messages
RTMP uses message type ID 4 for User Control messages.
These messages contain information used by the RTMP streaming layer.
Protocol messages with IDs 1, 2, 3, 5, and 6 are used by the RTMP
Chunk Stream protocol (Section 5.4).
User Control messages SHOULD use message stream ID 0 (known as the control stream) and, when sent over RTMP Chunk Stream, be sent on chunk stream ID 2.
References:
https://groups.google.com/forum/#!topic/c-rtmp-server/tboRR4cWVIc
http://osflash.osflash.narkive.com/xm6iDh9S/rtmp-how-to-associate-responses-and-requests
http://blog.rongpmcu.com/rtmpfu-wu-duan-shi-xian/