webrtc commuting seven codes (RTP packet format)

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/CrystalShaw/article/details/90606523

A, rtp header format

V: version number must be 2
P: stuffing bit
X: an extension bit, sign extended if there
CC: CSRC number
M: Mark flag, the end flag of one frame, the audio frame is a complete package almost every frame, so M general equal to 1, a video package because a relatively large, will be divided into several packets are sent, the last packet flag requires about mark.
PT: load type, different types of loads corresponding to the codec type (corresponding to the audio to be different according to different types of loads and sample rate channel), the FEC type.
sequence number: packet sequence number, the transmitting side to specify a starting sequence number (if not specified, a random), then the sequence number of each packet in ascending order; RTX, if present, is that this retransmission sequence number is the sequence number rtx details see RTPSender: : SendPadData implementation
timestamp: timestamp, if a video frame is divided into several packets, the time stamp corresponding to this frame is the same as several packages; sender can specify a start timestamp timestamp_offset_ (if not specified a random), then the time stamp of each frame is equal to the timestamp plus the acquisition start time stamp timestamp_offset_ + capture_timestamp, details can be seen RTPSender :: SendOutgoingData implementation
SSRC: uniquely identifies the synchronization source, each source (audio or video, file) must have a unique identification code, to distinguish itself from the flow
CSRC: contributing source, this SSRC list of resources by how many other resources (SSRC other resources) from the mixing. For example, we need to modify the MCU after the mix; can only represent 15 sources

If the presence of the RTP extension flag X must be set to 1, in addition to the standard extension, WebRTC also has its own extension, so if you use a standard server rtp parsing library need to add a bit of RTP extension WebRTC. Extended relevant documents have rtp_header_extensions.h and rtp_utility.cc.

RTP extension header is defined as follows:

The extended type (ID value is above figure) support WebRTC follows:

 

Second, the agreement introduces

Have not yet sorted each extension type, the following three types of expansion, find the corresponding RFC protocol defined private feeling to rest.

  • kRtpExtensionTransmissionTimeOffset

       Meaning: a package with ticks offset acquisition time of

       Protocol: https://tools.ietf.org/html/rfc5450

       Code to achieve the function: RTPSender :: SendToNetwork

  • kRtpExtensionAudioLevel of rfc agreement

       Meaning: one db value of the audio data

       Protocol: https://tools.ietf.org/html/rfc6465

       Code to achieve the function: RTPSenderAudio :: SendAudio

  • kRtpExtensionTransportSequenceNumber of rfc agreement

       Meaning: extension number, whether it is the first transmission or retransmission of the packet, this requires incremented

       https://tools.ietf.org/html/draft-holmer-rmcat-transport-wide-cc-extensions-01

       Code to achieve the function: RTPSender :: UpdateTransportSequenceNumber

 

  • kRtpExtensionAbsoluteSendTime

       Meaning: absolute time to send a packet.

       Parameters: RTPSender :: SendToNetwork

        

  • kRtpExtensionVideoRotation

       Meaning: direction frame of the video frame.

       parameter:

       

  • kRtpExtensionPlayoutDelay

      Meaning: long time has been played

       parameter:

       

  • kRtpExtensionVideoContentType

       Meaning: whether the video source is a screen resource.

       parameter:

       

  • kRtpExtensionVideoTiming

       含义:记录视频编码开始,编码结束,打包完成,平滑发送等时间戳,不过这几个时间戳都是相对时间。

       参数:

       

    如下三个未知。

  • kRtpExtensionRtpStreamId
  • kRtpExtensionRepairedRtpStreamId
  • kRtpExtensionMid    

 

三、wireshark抓包示例

 

 

四、视频净荷格式

请参见:

264 RTP打包格式:https://blog.csdn.net/CrystalShaw/article/details/81538207

Vp8 RTP打包格式:https://blog.csdn.net/CrystalShaw/article/details/81289617

 

Guess you like

Origin blog.csdn.net/CrystalShaw/article/details/90606523
RTP