webrtc代码走读五(vp8 rtp 报文解析)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/CrystalShaw/article/details/81289617

一、wireshark解析VP8报文方法

首先webrtc里面默认开启了FEC和SRTP功能,导致wireshark无法正常解析VP8的报文。所以若想了解VP8的RTP报文格式,还需要先关闭FEC、SRTP。

1、关闭FEC。

internalencoderfactory.cc文件屏蔽kRedCodecName、kUlpfecCodecName

2、关闭SRTP

webrtc\src\webrtc\api\peerconnectioninterface.h

disable_encryption = true 取消SRTP

bool Conductor::CreatePeerConnection(bool dtls)配置不生成密钥。

3、启动RTP数据抓包

这样就能捕获VP8的RTP报文,进行分析了。

二、协议定义

 

1、RTP公共头

2、VP8 Payload Descriptor

 

X:该位为1时,后面这些 OPTIONAL(Ibit、Lbit、Tbit、Kbit)需要进行解析,如果为0的话,则直接忽略这些可选的项目。
R:保留。
N:Non-reference帧。默认是0,以备后续扩展。
S:Start of VP8 partition,如果当前的帧为VP8 partition的起始,则该参数必须被置1。
PartID:partition index,如果S位为1,那么partid为1。

之后的I bit、L bit、T bit、K bit都是需要X置1才有效。

I:picture id呈现标志位,置1时,必须在后面I所示行呈现picture id。
L:TL0PICIDX呈现标志位,置1时,必须在后面L所示行呈现TL0PICIDX。
T:TID呈现标志位.被置1时,可选的TID/KEYIDX部分必须被呈现。TID|Y部分必须在其之后。如果K被置1但T为0,TID/KEYIDX必须呈现出来,但是TID|Y必须被忽略。T或K都不为1时,TID/KEYIDX都不必呈现!
K:KEYIDX present,这个其实和T说明的差不多了。
RSV:保留。

PictureID:8位或16位的长度,其中首位为为1时,则为16位的长度,后15位为picture id,为0,则为8位的长度,后7位为picture id。PictureID为视频帧序列号。可以以随机数起始,但是必须以1递增。
TL0PICIDX:8位temporal level为0的帧序号。当下面的TID为0时,是temporal level为0的帧序号。否则是当前帧参考前面帧的个数。
TID:2为temporal layer index.目前VPX和264支持最大4层Temporal Scalability。
Y:1 layer sync bit.
Informative note: This document does not describe how to determine the dependency status for a frame; this information is preferably provided from the encoder implementation. In the case of unknown status, the Y bit can safely be set to 0.
KEYIDX:5 bits temporal key frame index.

关于TID、TL0PICIDX、Y参数含义的理解,请参考https://blog.csdn.net/CrystalShaw/article/details/81184531

2、VP8 Payload Header

三、参考

 

https://tools.ietf.org/html/rfc7741

http://elkpi.com/topics/vp8-rtp-payload.html

猜你喜欢

转载自blog.csdn.net/CrystalShaw/article/details/81289617
RTP