Skip to content

Conversation

whytolearn
Copy link
Contributor

@whytolearn whytolearn commented Sep 2, 2025

Fixes a bug in WebRTC NACK packet recovery mechanism where recovered packets were being discarded instead of processed.

In SrsRtcRecvTrack::on_nack(), when a retransmitted packet arrived (found in NACK receiver), the method would:

  1. ✅ Remove the packet from NACK receiver (correct)
  2. ❌ Return early without adding the packet to RTP queue (BUG)

This caused recovered packets to be lost, defeating the purpose of the NACK mechanism and potentially causing media quality issues.

Restructured the control flow in on_nack() to ensure both new and recovered packets reach the packet insertion logic:

  • Before: Early return for recovered packets → packets discarded
  • After: Conditional NACK management + unified packet processing → all packets queued

Closes #3820


Co-authored-by: Haibo Chen [email protected]

@winlinvip winlinvip added the EnglishNative This issue is conveyed exclusively in English. label Sep 2, 2025
@winlinvip winlinvip changed the title Feature/lost pack in rec queue WebRTC: Fix NACK recovered packets not being added to receive queue Sep 4, 2025
@winlinvip winlinvip added the AI Handled This issue is fixed by AI, or the PR is reviewed by AI, or the discussion is replied to by AI. label Sep 4, 2025
@winlinvip winlinvip changed the title WebRTC: Fix NACK recovered packets not being added to receive queue WebRTC: Fix NACK recovered packets not being added to receive queue. v7.0.78 Sep 4, 2025
@winlinvip winlinvip added the RefinedByAI Refined by AI/GPT. label Sep 4, 2025
@winlinvip winlinvip merged commit 57e1622 into ossrs:develop Sep 4, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AI Handled This issue is fixed by AI, or the PR is reviewed by AI, or the discussion is replied to by AI. EnglishNative This issue is conveyed exclusively in English. RefinedByAI Refined by AI/GPT.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WebRTC: Should put lost packet in receive queue
4 participants