RTP及RTP Header Extension

https://www.rfc-editor.org/rfc/rfc3550.txt

译文: http://www.gpssoft.cn/download/protocol/RFC-3550-%E4%B8%AD%E6%96%87%E7%89%88.pdf

RTP:real-time transport protocol,实时传输协议

每一个 RTP 包中都有前 12 个字节,而 CSRC identifier 列表仅在 Mixer 插入时才有。

padding (P):1 bit,如果设定 padding,在报文的末端就会包含一个或者多个 padding 字节,这不属于 payload。最后一个字节的 padding 是个计数,标识需要忽略多少个 padding 字节(包括自己)。如:

extension (X):1 bit,如果设定了 extension 位,定长头字段后面会有一个扩展头。扩展头放在CSRC之后。

CSRC count (CC):4 bits, CSRC count 标识了定长头字段中包含的 CSRC identifier 的数量

Marker(M ): 1bit, 对于视频标记一帧的结束(indicate the last packet of a video frame),对于音频标记会话的开始(indicate the first packet sent after a period silence)。

payload type (PT):7 bits,  111表示音频opus编码, 126表示视频H.264编码。一个 RTP 源有可能在会话中改变 payload type, 接收者必须忽略它不识别的 payload type。

扫描二维码关注公众号,回复: 15745413 查看本文章

sequence number:16 bits,每发送一个 RTP 数据报文序列号值加一。接收者也可用来检测丢失的包或者重建报文序列。初始的值是随机的。RTP 中的序列号允许接收器重建发送器发来的报文。

timestamp:32 bits,初始随机值,相邻帧按照时钟频率/帧率增长。

          同一个帧的不同分片的timestamp是相同的,这样就省去了起始标记和结束标记。

SSRC:32 bits,同步信源,即产生媒体流的信源,随机值,一个会话中不能重复。

CSRC: 贡献信源,混合器接收到一个或者多个同步信源的RTP报文,经过混合器处理产生一个新的组合RTP报文,并把混合器作为组合报文的SSRC,而将原来的所有的SSRC都作为CSRC,发送给接收者,使接收者知道组成组合报文的各个SSRC。

Transport address:网 络 地 址 与 端 口 的组 合 , 用 来 识 别 传 输 级 的 终 点(endpoint),例如一个 IP 地址和一个 UDP 端口。

RTP Header Extension -5285

RFC 8285 - A General Mechanism for RTP Header Extensions

Old: RFC 5285 - A General Mechanism for RTP Header Extensions

参考:https://blog.csdn.net/aggresss/article/details/106436703

Each extension element has a local identifier and a length.  The local identifiers may be mapped to a larger namespace in the negotiation (e.g., session signaling).  

Each extension element in a packet has a local identifier (ID) and a length.  The local identifiers present in the stream MUST have been negotiated or defined out-of-band.  There are no static allocations of local identifiers.  Each distinct extension MUST have a unique ID. The value 0 is reserved for padding and MUST NOT be used as a local identifier.

There are two variants of the extension: one-byte and two-byte headers.

希望RTP扩展头尽量的小,能用one-byte header 就用one-byte header, 所有的接收端需要支持one-byte header . 当one-byte header足够用时,发送端不应该使用two-byte header.

 

length单位是32bit

猜你喜欢

转载自blog.csdn.net/luyumiao1990/article/details/131723096
RTP