2021-08-11

1、与NACK对应的是ACK,ACK是到达通知技术。以TCP为例,他可靠因为接收方在收到数据后会给发送方返回一个“已收到数据”的消息(ACK),告诉发送方“我已经收到了”,确保消息的可靠。

2、NACK也是一种通知技术,只是触发通知的条件刚好的ACK相反,在未收到消息时,通知发送方“我未收到消息”,即通知未达。

在rfc4585协议中定义可重传未到达数据的类型有二种:

RTP:Real-time Transport  Protocol:实时传输协议

1)RTPFB(Transport layer feedback ):rtp报文丢失重传。

2)PSFB(Payload-specific feedback):指定净荷重传,指定净荷重传里面又分如下三种:

1、PLI  (Picture Loss Indication) 视频帧丢失重传。

2、SLI   (Slice Loss Indication)    slice丢失重转。

3、RPSI (Reference Picture Selection Indication)参考帧丢失重传。

在创建视频连接的SDP协议里面,会协商以上述哪种类型进行NACK重转。以webrtc为例,会协商两种NACK,一个rtp报文丢包重传的nack(nack后面不带参数,默认RTPFB)、PLI 视频帧丢失重传的nack。

Fig1:Common Packet Format for Feedback Messages

 V:     2bit 目前固定为2

P:     1bit padding

FMT:5bit Feedback message type。

RTP FP模式下定义值为:

    0:unassigned

    1:Generic NACK

    2-30:unassigned

    31:reserved for future expansion of the identifier number space

PS FP模式下定义值为:

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。

                Fig2:Syntax for the Generic NACK message

Packet identifier(PID)即为丢失RTP数据包的序列号(标记为起始),Bitmap of Lost Packets(BLP)指示从PID开始接下来16个RTP数据包的丢失情况。一个NACK报文可以携带多个RTP序列号,NACK接收端对这些序列号逐个处理。

Bitmap of Lost Packets(BLP):0x6ae1。解析的时候需要按照小模式解析,

0x6ae1对应二进制:110101011100001倒过来看1000 0111 0101 0110。

按照1bit是丢包,0bit是没有丢包解析,丢失报文序列号分别是:

 177 182 183 184 186 188 190 191与wireshark解析一致。

 PSFB:

        1)PLI FB  PT=PSFB FMT=1

        2)SLI FB的PT=PSFB、FMT=2。

                Fig 3: Syntax of the Slice Loss Indication (SLI)

First: 13 bits The macroblock (MB) address of the first lost macroblock. The MB numbering is done such that the macroblock in the upper left corner of the picture is considered macroblock number 1 and the number for each macroblock increases from left to right and then from top to bottom in raster-scan order (such that if there is a total of N macroblocks in a picture。

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.

         Fig 4: Syntax of the Reference Picture Selection Indication (RPSI)

webrtc支持RTPFB和PLI FB两种重传方式。

即是或者请求重传对应的RTP包,或者是请求I帧。

猜你喜欢

转载自blog.csdn.net/abc1231987/article/details/119600214