webrtc icon indicating copy to clipboard operation
webrtc copied to clipboard

Pion repeatedly sends the same RTCP (NACK) packet even after successfully receiving and processing the corresponding RTX packet.

Open arjunshajitech opened this issue 7 months ago • 8 comments

Environment

  • Version: v4.0.12
  • OS: Zorin OS 17.1 Core

What I Did

I simulated packet loss by generating UDP packet drops, triggering RTCP (NACK) requests in Pion WebRTC with RTX enabled.

Expected Behavior

The RTCP (NACK) requests should stop once the missing packet is successfully received via RTX, preventing further redundant requests.

Actual Behavior

Pion continuously sends RTCP (NACK) requests for the same packet, even after the RTX packet is received and processed.

This happens because RTX packets are only logged in the receiver log of the RTX track, not the corresponding RTP track.

The tight coupling of the RTPReader within the interceptor prevents RTX packets from passing through the correct interceptor chain for the RTP track.

Image Image Image

Root Cause

The ReadRTP function reads an RTP packet and passes it through the interceptor chain. However, when an RTX packet is received, it isn’t processed through the corresponding RTP track’s interceptor chain. As a result, it isn’t logged in the RTP track’s receiver log, causing the system to treat the packet as missing and repeatedly issue NACKs.

Proposed Fix

To resolve this, I propose separating the reading and processing of RTP packets:

Read RTP: Handle packet reading independently to avoid tight coupling with the interceptor.

Process RTP: Pass the packet (including converted RTX packets) through the interceptor chain explicitly.

Currently, RTX packets are converted to RTP packets but not passed through the interceptor chain. By splitting the process, the converted RTX packets can be processed through the appropriate interceptors and logged correctly in the RTP track’s receiver log.

Image Image Image

arjunshajitech avatar Mar 13 '25 14:03 arjunshajitech