webrtc 代码走读三(h264 rtp打包)

本文详细介绍了H264视频编码标准中RTP打包的三种主要模式:单一NAL单元模式、组合封包模式(包括STAP和MTAP)及分片封包模式,并解释了每种模式的应用场景和技术细节。

基本概念 :

H264 编解码器:

        编解码器规范在概念上区分视频编码层(VCL) 和网络抽象层(NAL)。

        VCL编码器输出切片:一点包含整数个宏块数据的字符串宏块和切片头信息。NAL编码器将VCL编码器的切片封装成网络抽象层单元(NAL),适用于通过分组网络或者面向分组的多路复用环境。  

        F: 1 bit forbidden_zero_bit. The H.264 specification declares a value of 1 as a syntax violation.

        NRI: 2 bits nal_ref_idc. A value of 00 indicates that the content of the NAL unit is not used to reconstruct reference pictures for inter picture prediction. Such NAL units can be discarded without risking the integrity of the reference pictures. Values greater than 00 indicate that the decoding of the NAL unit is required to maintain the integrity of the reference pictures.

        Type: 5 bits nal_unit_type. This component specifies the NAL unit payload type as defined in Table 7-1 of [1] and later within this memo. For a reference of all currently defined NAL unit types and their semantics, please refer to Section 7.4.1 in [1] 

IDR picture: A coded picture containing only slices with I or SI slice types that causes a "reset" in the decoding proces

一、Payload Structures

h264 rtp打包载荷结构有三种:单一NAL单元模式、组合封包模式、分片封包模式。

 参考:RFC 6184 - RTP Payload Format for H.264 Video

1、单一NAL单元模式

        即一个RTP包仅由一个完整的NALU组成。这种情况下RTP NAL头类型字段和原始的H.264的NALU头类型字段是一样的。对于NALU的长度小于MTU大小的包,一般采用单一NAL单元模式。对于一个原始的H.264NALU单元常由[StartCode][NALUHeader][NALUPayload]三部分组成,其中StartCode用于标示这是一个NALU单元的开始,必须是"00 00 00 01"或"00 00 01",NALU头仅一个字节,其后

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值