RTMP(4):User Control Message

并不重要的一部分。FFmpeg 作为接收方时,只处理了 PingRequest(返回 PingResponse)。

User Control Message 的数据(message 的 payload) 包含两个字段:

  • Event Type (16 bits)
  • Event Data。变长,长度有 event type 决定。

两字段的具体使用方法如下表所述:

 +---------------+--------------------------------------------------+
 | Event         | Description                                      |
 +---------------+--------------------------------------------------+
 | Stream Begin  | The server sends this event to notify the client |
 | (=0)          | that a stream has become functional and can be   |
 |               | used for communication. By default, this event   |
 |               | is sent on ID 0 after the application connect    |
 |               | command is successfully received from the        |
 |               | client. The event data is 4-byte and represents  |
 |               | the stream ID of the stream that became          |
 |               | functional.                                      |
 +---------------+--------------------------------------------------+
 | Stream EOF    | The server sends this event to notify the client |
 | (=1)          | that the playback of data is over as requested   |
 |               | on this stream. No more data is sent without     |
 |               | issuing additional commands. The client discards |
 |               | the messages received for the stream. The        |
 |               | 4 bytes of event data represent the ID of the    |
 |               | stream on which playback has ended.              |
 +---------------+--------------------------------------------------+
 | StreamDry     | The server sends this event to notify the client |
 | (=2)          | that there is no more data on the stream. If the |
 |               | server does not detect any message for a time    |
 |               | period, it can notify the subscribed clients     |
 |               | that the stream is dry. The 4 bytes of event     |
 |               | data represent the stream ID of the dry stream.  |
 +---------------+--------------------------------------------------+
 | SetBuffer     | The client sends this event to inform the server |
 | Length (=3)   | of the buffer size (in milliseconds) that is     |
 |               | used to buffer any data coming over a stream.    |
 |               | This event is sent before the server starts      |
 |               | processing the stream. The first 4 bytes of the  |
 |               | event data represent the stream ID and the next  |
 |               | 4 bytes represent the buffer length, in          |
 |               | milliseconds.                                    |
 +---------------+--------------------------------------------------+
 | StreamIs      | The server sends this event to notify the client |
 | Recorded (=4) | that the stream is a recorded stream. The        |
 |               | 4 bytes event data represent the stream ID of    |
 |               | the recorded stream.                             |
 +---------------+--------------------------------------------------+
 | PingRequest   | The server sends this event to test whether the  |
 | (=6)          | client is reachable. Event data is a 4-byte      |
 |               | timestamp, representing the local server time    |
 |               | when the server dispatched the command. The      |
 |               | client responds with PingResponse on receiving   |
 |               | MsgPingRequest.                                  |
 +---------------+--------------------------------------------------+
 | PingResponse  | The client sends this event to the server in     |
 | (=7)          | response to the ping request. The event data is  |
 |               | a 4-byte timestamp, which was received with the  |
 |               | PingRequest request.                             |
 +---------------+--------------------------------------------------+
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值