2,RTP扩展头(RFC5285)

链接:https://pan.baidu.com/s/1lwwwfJH2bKCoG2AHOcf1rQ?pwd=3yta 
提取码:3yta 
我做的一个音视频相关的学习笔记,欢迎一起学习
1.2,RTP扩展头(RFC5285)

扩展头由三部分组成,分别为profile、length、header extension。RFC5285规定两种格式的profile,分别以{0xBE, 0xDE}和{0x10, 0x0X}开头。

1.2.1,One-Byte Header:

0xBEDE开头,后面用两个字节标识扩展头的个数(注:扩展头最后以4字节对齐)。后续每个扩展头都有一个起始字节,格式如下:

 0
 0 1 2 3 4 5 6 7 
+-+-+-+-+-+-+-+-+
|  ID   |  len  |
+-+-+-+-+-+-+-+-+

4位ID是该元素的本地标识符,取值范围为1-14。在信令部分,这被称为有效范围。本地标识符值15是为将来的扩展保留的,绝对不能用作标识符。如果遇到ID值15,则应该忽略其长度字段,整个扩展的处理应该在该点终止,并且只考虑ID为15的元素之前出现的扩展元素。len代表该扩展头后续字节的长度,所以len为0时,后面会有 1 个字节,为15时,后面会有16个字节。即:至少带 1 个字节至多带16个字节。

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|       0xBE    |    0xDE       |           length=3            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  ID   | L=0   |     data      |  ID   |  L=1  |   data...     |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      ...data   |  ID   | L=3   |            data...            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|         ...data               |      0(pad)   |    0(pad)     |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

需要注意的是,在RFC5285文档中,onebyte-header示例填充位的位置有误,关于这一点,读者可以阅读WebRTC中的RtpPacket.c或RtpPacket.h代码---《WebRTC音视频实时互动技术(原理、实战与源码分析) 李超》

1.2.2,Two-Byte Header
 0                   1
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|         0x100         |appbits|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

这种格式和One-Byte Header开头不一样,开头以0x100X(X为appbit,占4bit)。RFC5285并未规定appbits的意义。后面同样跟两个字节标识扩展头的个数。

扩展头的起始字节和One-Byte Header也不一样,ID和L分别用了一个字节来表示,且L表示的就是扩展头的长度(One-Byte Header中的L表示扩展头长度减1)。例子如下:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|       0x10    |    0x00       |           length=3            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      ID       |     L=0       |     ID        |     L=1       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|       data    |       ID      |      L=4      |    data...    |      
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                   ...data                     |     0(pad)    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

在这两种形式中,填充字节的值都是0(零)。如果需要对齐,它们可以放在扩展元素之间;如果需要填充,它们可以放在最后一个扩展元素之后。填充字节不提供元素的ID,也不提供长度字段。当找到填充字节时,它将被忽略,解析器继续解释下一个字节。

  • 24
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
目录(Table of Contents) 1. 引言 (Introduction) 1 1 术语(Terminology) 2 RTP使用场景(RTP Use Scenarios) 2 1 简单多播音频会议( Simple Multicast Audio Conference) 2 2 音频和视频会议(Audio and Video Conference) 2 3 混频器和转换器(Mixers and Translators) 2 4 分层编码(Layered Encodings) 3 定义(Definitions) 4 字节序,校正和时间格式(Byte Order, Alignment, and Time Format) 5 RTP数据传输协议(RTP Data Transfer Protocol) 5 1 RTP固定域(RTP Fixed Header Fields) 5 2 多路复用RTP会话(Multiplexing RTP Sessions) 5 3 RTP的配置文件详细变更(Profile-Specific Modifications to the RTP Header) 5 3 1 RTP扩展RTP Header Extension) 6 RTP控制协议(RTP Control Protocol) -- RTCP 6 1 RTCP包格式(RTCP Packet Format) 6 2 RTCP传输间隔(RTCP Transmission Interval) 6 2 1 维护会话成员数目(Maintaining the number of session members) 6 3 RTCP包的发送与接收规则(RTCP Packet Send and Receive Rules) 6 3 1 计算RTCP传输间隔(Computing the RTCP Transmission Interval) 6 3 2 初始化(Initialization) 6 3 3 接收RTP或RTCP(非BYE)包(Receiving an RTP or Non-BYE RTCP Packet) 6 3 4 接收RTCP(BYE)包(Receiving an RTCP BYE Packet) 6 3 5 SSRC计时失效(Timing Out an SSRC) 6 3 6 关于传输计时器的到期(Expiration of Transmission Timer) 6 3 7 传输一个 BYE 包(Transmitting a BYE Packet) 6 3 8 更新we_sent(Updating we_sent) 6 3 9 分配源描述带宽(Allocation of Source Description Bandwidth) 6 4 发送方和接收方报告(Sender and Receiver Reports) 6 4 1 SR:发送方报告的RTCP包(SR: Sender report RTCP packet) 6 4 2 RR:接收方报告的RTCP包(RR: Receiver Report RTCP Packet) 6 4 3 扩展发送方和接收方报告(Extending the Sender and Receiver Reports ) 6 4 4 分析发送方和接收方报告(Analyzing Sender and Receiver Reports ) 6 5 SDES:源描述RTCP包(SDES: Source description RTCP packet) 6 5 1 CNAME:规范终端标识符的SDES数据项(CNAME: Canonical End-Point Identifier SDES Item)
目录(Table of Contents) 1. 引言 (Introduction) 1 1 术语(Terminology) 2 RTP使用场景(RTP Use Scenarios) 2 1 简单多播音频会议( Simple Multicast Audio Conference) 2 2 音频和视频会议(Audio and Video Conference) 2 3 混频器和转换器(Mixers and Translators) 2 4 分层编码(Layered Encodings) 3 定义(Definitions) 4 字节序,校正和时间格式(Byte Order, Alignment, and Time Format) 5 RTP数据传输协议(RTP Data Transfer Protocol) 5 1 RTP固定域(RTP Fixed Header Fields) 5 2 多路复用RTP会话(Multiplexing RTP Sessions) 5 3 RTP的配置文件详细变更(Profile-Specific Modifications to the RTP Header) 5 3 1 RTP扩展RTP Header Extension) 6 RTP控制协议(RTP Control Protocol) -- RTCP 6 1 RTCP包格式(RTCP Packet Format) 6 2 RTCP传输间隔(RTCP Transmission Interval) 6 2 1 维护会话成员数目(Maintaining the number of session members) 6 3 RTCP包的发送与接收规则(RTCP Packet Send and Receive Rules) 6 3 1 计算RTCP传输间隔(Computing the RTCP Transmission Interval) 6 3 2 初始化(Initialization) 6 3 3 接收RTP或RTCP(非BYE)包(Receiving an RTP or Non-BYE RTCP Packet) 6 3 4 接收RTCP(BYE)包(Receiving an RTCP BYE Packet) 6 3 5 SSRC计时失效(Timing Out an SSRC) 6 3 6 关于传输计时器的到期(Expiration of Transmission Timer) 6 3 7 传输一个 BYE 包(Transmitting a BYE Packet) 6 3 8 更新we_sent(Updating we_sent) 6 3 9 分配源描述带宽(Allocation of Source Description Bandwidth) 6 4 发送方和接收方报告(Sender and Receiver Reports) 6 4 1 SR:发送方报告的RTCP包(SR: Sender report RTCP packet) 6 4 2 RR:接收方报告的RTCP包(RR: Receiver Report RTCP Packet) 6 4 3 扩展发送方和接收方报告(Extending the Sender and Receiver Reports ) 6 4 4 分析发送方和接收方报告(Analyzing Sender and Receiver Reports ) 6 5 SDES:源描述RTCP包(SDES: Source description RTCP packet) 6 5 1 CNAME:规范终端标识符的SDES数据项(CNAME: Canonical End-Point Identifier SDES Item) 6 5 2 NAME:用户名的SDES数据项(NAME: User name SDES item) 6 5 3 EMAIL:电子邮件地址的SDES数据项(EMAIL: Electronic Mail Address SDES Item) 6 5 4 PHONE:电话号码的SDES数据项(PHONE: Phone Number SDES Item) 6 5 5 LOC:地理用户地址的SDES数据项(LOC: Geographic User Location SDES Item) 6 5 6 TOOL:应用程序或工具名字的SDES数据项(TOOL: Application or Tool Name SDES Item) 6 5 7 NOTE:通知/状态的SDES数据项(NOTE: Notice/Status SDES Item) 6 5 8 PRIV:私有扩展的SDES数据项(PRIV: Private Extensions SDES Item) 6 6 BYE:Goodbye RTCP包(BYE: Goodbye RTCP packet) 6 7 APP:定义应用程序的RTCP包(APP: Application-Defined RTCP Packet) 7 RTP转换器和混频器(RTP Translators and Mixers) 7 1 概述(General Description ) 7 2 在转换器中的RTCP数据处理(RTCP Processing in Translators) 7 3 在混频器中的RTCP数据处理(RTCP Processing in Mixers ) 7 4 级联混频器(Cascaded Mixers) 8 SSRC标识符的分配和使用(SSRC Identifier Allocation and Use) 8 1 冲突概率(Probability of Collision ) 8 2 冲突解决和循环检测(Collision Resolution and Loop Detection) 8 3 在分层编码中使用(Use with Layered Encodings) 9 安全(Security ) 9 1 机密性(Confidentiality) 9 2 身份验证和消息完整性(Authentication and Message Integrity) 10 拥塞控制(Congestion Control) 11 网络和传输协议之上的RTPRTP over Network and Transport Protocols) 12 协议常量摘要(Summary of Protocol Constants) 12 1 RTCP 包类型(RTCP Packet Types) 12 2 SDES 类型(SDES Types) 13 RTP概况和负载格式详细说明     (RTP Profiles and Payload Format Specifications) 14 安全考虑(Security Considerations) 15 IANA考虑(IANA Considerations) 16 知识产权声明(Intellectual Property Rights Statement) 17 鸣谢(Acknowledgments) 附录 A 算法(Algorithms) 附录 A 1 RTP数据有效性检查(RTP Data Header Validity Checks ) 附录 A 2 RTCP数据有效性检查(RTCP Header Validity Checks) 附录 A 3 确定RTP包预期数目和丢失数目(Determining Number of Packets Expected and Lost) 附录 A 4 生成SDES RTCP包(Generating RTCP SDES Packets) 附录 A 5 解析RTCP SDES包(Parsing RTCP SDES Packets) 附录 A 6 生成32位随机标识符(Generating a Random 32-bit Identifier
本文描述RTP (real-time transport protocol),实时传输协议。RTP 在多点传送(多播) 或单点传送(单播)的网络服务上,提供端对端的网络传输功能,适合应用程序传输实时数据, 如:音频,视频或者仿真数据。RTP 没有为实时服务提供资源预留的功能,也不能保证QoS (服 务质量)。数据传输功能由一个控制协议(RTCP)来扩展,通过扩展,可以用一种方式对数据 传输进行监测控制,该协议(RTCP)可以升级到大型的多点传送(多播)网络,并提供最小限 度的控制和鉴别功能。RTP 和RTCP 被设计成和下面的传输层和网络层无关。协议支持RTP 标 准的转换器和混合器的使用。 本文的大多数内容和旧版的RFC1889 相同。在线路里传输的数据包格式没有改变,唯一的改变 是使用协议的规则和控制算法。为了最小化传输,发送RTCP 数据包时超过了设定的速率,而 在这时,很多的参与者同时加入了一个会话,在这样的情况下,一个新加入到(用于计算的可升 级的)计时器算法中的元素是最大的改变。 目录(Table of Contents) 1. 引言 (Introduction) 1 1 术语(Terminology) 2 RTP使用场景(RTP Use Scenarios) 2 1 简单多播音频会议( Simple Multicast Audio Conference) 2 2 音频和视频会议(Audio and Video Conference) 2 3 混频器和转换器(Mixers and Translators) 2 4 分层编码(Layered Encodings) 3 定义(Definitions) 4 字节序,校正和时间格式(Byte Order, Alignment, and Time Format) 5 RTP数据传输协议(RTP Data Transfer Protocol) 5 1 RTP 固定域(RTP Fixed Header Fields) 5 2 多路复用RTP 会话(Multiplexing RTP Sessions) 5 3 RTP 的配置文件详细变更(Profile-Specific Modifications to the RTP Header) 5 3 1 RTP扩展RTP Header Extension) 6 RTP控制协议(RTP Control Protocol)-- RTCP 6 1 RTCP包格式(RTCP Packet Format) 6 2 RTCP传输间隔(RTCP Transmission Interval) 6 2 1 维护会话成员数目(Maintaining the number of session members) 6 3 RTCP包的发送与接收规则(RTCP Packet Send and Receive Rules) 6 3 1 计算RTCP 传输间隔(Computing the RTCP Transmission Interval ) 6 3 2 初始化(Initialization) 6 3 3 接收RTP 或RTCP (非BYE)包(Receiving an RTP or Non-BYE RTCP Packet) 6 3 4 接收RTCP (BYE)包(Receiving an RTCP BYE Packet) 6 3 5 SSRC 计时失效(Timing Out an SSRC ) 6 3 6 关于传输计时器的到期(Expiration of Transmission Timer) 6 3 7 传输一个 BYE 包(Transmitting a BYE Packet) 6 3 8 更新we_sent (Updating we_sent) 6 3 9 分配源描述带宽(Allocation of Source Description Bandwidth ) 6 4 发送方和接收方报告(Sender and Receiver Reports) 6 4 1 SR:发送方报告的RTCP包(SR: Sender report RTCP packet) 6 4 2 RR:接收方报告的RTCP 包(RR: Receiver Report RTCP Packet) 6 4 3 扩展发送方和接收方报告(Extending the Sender and Receiver Reports ) 6 4 4 分析发送方和接收方报告(Analyzing Sender and Receiver Reports ) 6 5 SDES:源描述RTCP包(SDES: Source description RTCP packet) 6 5 1 CNAME:规范终端标识符的SDES 数据项(CNAME: Canonical End-Point Identifier SDES Item) 6 5 2 NAME:用户名的SDES 数据项(NAME: User name SDES item) 6 5 3 EMAIL:电子邮件地址的SDES 数据项(EMAIL: Electronic Mail Address SDES Item) 6 5 4 PHONE:电话号码的SDES 数据项(PHONE: Phone Number SDES Item) 6 5 5 LOC:地理用户地址的SDES 数据项(LOC: Geographic User Location SDES Item) 6 5 6 TOOL:应用程序或工具名字的SDES 数据项(TOOL: Application or Tool Name SDES Item) 6 5 7 NOTE:通知/状态的SDES 数据项(NOTE: Notice/Status SDES Item) 6 5 8 PRIV:私有扩展的SDES 数据项(PRIV: Private Extensions SDES Item) 6 6 BYE:Goodbye RTCP 包(BYE: Goodbye RTCP packet) 6 7 APP:定义应用程序的RTCP 包(APP: Application-Defined RTCP Packet) 7 RTP转换器和混频器(RTP Translators and Mixers) 7 1 概述(General Description ) 7 2 在转换器中的RTCP 数据处理(RTCP Processing in Translators) 7 3 在混频器中的RTCP 数据处理(RTCP Processing in Mixers ) 7 4 级联混频器(Cascaded Mixers) 8 SSRC 标识符的分配和使用(SSRC Identifier Allocation and Use) 8 1 冲突概率(Probability of Collision ) 8 2 冲突解决和循环检测(Collision Resolution and Loop Detection) 8 3 在分层编码中使用(Use with Layered Encodings) 9 安全(Security ) 9 1 机密性(Confidentiality) 9 2 身份验证和消息完整性(Authentication and Message Integrity ) 10 拥塞控制(Congestion Control) 11 网络和传输协议之上的RTPRTP over Network and Transport Protocols) 12 协议常量摘要(Summary of Protocol Constants) 12 1 RTCP 包类型(RTCP Packet Types) 12 2 SDES 类型(SDES Types) 13 RTP 概况和负载格式详细说明 (RTP Profiles and Payload Format Specifications) 14 安全考虑(Security Considerations) 15 IANA 考虑(IANA Considerations) 16 知识产权声明(Intellectual Property Rights Statement) 17 鸣谢(Acknowledgments) 附录A 算法(Algorithms) 附录A 1 RTP 数据有效性检查(RTP Data Header Validity Checks ) 附录A 2 RTCP 数据有效性检查(RTCP Header Validity Checks) 附录A 3 确定RTP包预期数目和丢失数目(Determining Number of Packets Expected and Lost) 附录A 4 生成SDES RTCP包(Generating RTCP SDES Packets) 附录A 5 解析RTCP SDES 包(Parsing RTCP SDES Packets) 附录A 6 生成32位随机标识符(Generating a Random 32-bit Identifier 附录A 7 计算RTCP 传输间隔(Computing the RTCP Transmission Interval) 附录A 8 估测两次到达间隔的抖动(Estimating the Interarrival Jitter) 附录B 与RFC1889 不同之外(Changes from RFC 1889) 参考书目(References) 标准化引用(Normative References ) 资料性引用(Informative References) 作者地址 完整的版权声明

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值