A method webrtc QOS (NACK implemented)

First, the concept
corresponding to NACK is ACK, ACK is arrival notification technology. TCP as an example, he was reliable because the receiver will return to the sender message (ACK) a "data has been received" after receiving the data, tell the sender "I have received", to ensure reliable message.

NACK notification is also a technology, but the conditions that triggered the notification of ACK just the opposite, when the message is not received, notify the sender "I have not received the message," that is less than notification.

Rfc4585 protocol may be defined in a retransmission does not reach there are two types of data:

1) RTPFB: rtp packet loss retransmission.

2) PSFB: Specifies the net load transmission, which transmits a load of the specified net is divided into the following three:
. 1, PLI (Picture Loss Indication) retransmission of lost video frames.
2, SLI (Slice Loss Indication) slice lose weight transfer.
3, RPSI (Reference Picture Selection Indication ) retransmission of lost reference frame.

Inside SDP protocol to create a video connection, in order to negotiate which of the above types NACK re-turn. To webrtc for example, negotiate two kinds NACK, a nack rtp packet loss retransmission (nack back with no parameters, the default RTPFB), PLI video frame loss retransmission nack.

Second, the definition


 
V: 2bit fixed current 2
P: 1bit padding
the FMT: 5bit Feedback Message type.
Mode is defined in the RTP FP:
     0: Unassigned
     . 1: the Generic NACK
     2-30: Unassigned
     31 is: Reserved for Future Expansion The identifier of Space Number

PS FP mode is defined:

0:     unassigned
1:     Picture Loss Indication (PLI)
2:     Slice Loss Indication (SLI)
3:     Reference Picture Selection Indication (RPSI)
4-14:  unassigned
15:    Application layer FB (AFB) message
16-30: unassigned
31:    reserved for future expansion of the sequence number space

PT:   8bit Payload type。


FCI:变长 Feedback Control Information。
1、RTPFB


Packet identifier (PID) is the missing sequence number of RTP data packets, Bitmap of Lost Packets (BLP) starts from the PID indicative of the next 16 cases lost RTP packets. NACK message may carry a plurality of RTP sequence number, processing of the NACK receiving end by one of these sequence numbers. The following example:

Packet identifier (PID) 176.

Bitmap of Lost Packets (BLP): 0x6ae1. Resolution mode when required in accordance with small resolution,

          0x6ae1 the corresponding binary: 110,101,011,100,001 upside down 1,000,011,101,010,110.

          According to 1bit is dropping, 0bit is no loss resolution, the loss packet sequence numbers are:

          177,182,183,184,186 188 190 191 wireshark resolve the same.

2, PSFB
1) MORE FB PT = PSFB FMT = 1.


2) SLI FB of PT = PSFB, FMT = 2.


First: 13 bits The macroblock (MB) address of the first lost macroblock.

Number: 13 bits The number of lost macroblocks, in scan order as discussed above。

PictureID: 6 bits The six least significant bits of the codec-specific identifier that is used to reference the picture in which the loss of the macroblock(s) has occurred. For many video codecs, the PictureID is identical to the Temporal Reference.

3)RPSI FB的PT=PSFB、FMT=3。


三、实现
webrtc支持RTPFB和PLI FB两种重传方式。

AssignPayloadTypesAndAddAssociatedRtxCodecs->AddDefaultFeedbackParams里面将两种方式都填写到SDP命令行里面。

RTPFB在JB里面实现。通过RTP报文的序列号和时间戳,判断是否出现丢包异常。参考NackTracker类实现。

PLI FB在webrtc里面实现的是请求关键帧。当连续出现解码失败,或者长期没有解码输入,就通过RTCP报文发送请求IDR帧命令。参考VideoReceiveStream::Decode、RequestKeyFrame这两个函数实现。

四、参考
https://tools.ietf.org/html/rfc4585
 

Guess you like

Origin blog.csdn.net/tanningzhong/article/details/87277534