RTMP协议与RTMP视频播放器的应用

2019-11-03 07:50:57于海丽

  Client → Server :向服务器发送连接包.
  Server → Client :服务器回应. ... .... 等等... ...

  RTMP 数据类型

  0×01 Chunk Size changes the chunk size for packets
  0×02 Unknown anyone know this one?
  0×03 Bytes Read send every x bytes read by both sides
  0×04 Ping ping is a stream control message, has subtypes
  0×05 Server BW the servers downstream bw
  0×06 Client BW the clients upstream bw
  0×07 Unknown anyone know this one?
  0×08 Audio Data packet containing audio
  0×09 Video Data packet containing video data
  0x0A - 0×11 Unknown anyone know?
  0×12 Notify an invoke which does not expect a reply
  0×13 Shared Object has subtypes
  0×14 Invoke like remoting call, used for stream actions too.
  Shared Object 数据类型
  0×01 Connect
  0×02 Disconnect
  0×03 Set Attribute
  0×04 Update Data
  0×05 Update Attribute
  0×06 Send Message
  0×07 Status
  0×08 Clear Data
  0×09 Delete Data
  0x0A Delete Attribute
  0x0B
  Initial Data

  RTMP包结构

  RTMP包包含一个固定长度的包头和一个最长为128字节的包体.包头可以是下面4种长度的任意一种:12, 8, 4, or 1 byte(s).
  第一个字节的前两个Bit很重要,它决定了包头的长度.它可以用掩码0xC0进行"与"计算.下面的表格罗列了可能的包头长度:Bits Header Length

  00 12 bytes
  01 8 bytes
  10 4 bytes
  11 1 byte
  我们在这里讨论关RTMP包结构的问题并不是非常的详细.我们在以后有时间会讨论关于AMF的问题(敬请期待...:loveliness:),其实RTMP包结构就是使用了AMF格式.

  流

  关于流的操作我们需要进一步研究,在论坛中的http://www.openred5.com/bbs/viewthread.php?tid=175&extra=page%3D1(被和谐)这篇文章研究的还是不错的,大家可以参考.不过下面可以列一个关于客户端向服务器端发送流的流程:

  Client→Server :发送一个创建流的请求.
  Server→Client :返回一个表示流的索引号.
  Client→Server :开始发送.
  Client→Server :发送视音频数据包(这些包在同一个频道(channel)并用流的索引号来唯一标识).

相关文章 大家在看