Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Improved periodic NAK report timing #961

Merged
merged 2 commits into from
Nov 20, 2019

Conversation

maxsharabayko
Copy link
Collaborator

@maxsharabayko maxsharabayko commented Nov 14, 2019

Periodic NAK Reports

Periodic NAK report is a mechanism for the receiver to periodically resend reports on the current loss list. Roughly, NAK interval equals to max(300ms; RTT / 2). More precise description is here.

Problem Statement

Periodic NAK report timing has several minor issues. They are mainly described in #701.

Those issues can be split into two groups:

  1. Periodic NAK report is triggered too early after a LOSS report for this very range of packets was already sent.
  2. Newly detected loss is added to the general receiver's loss list, and sent too soon with all the previous packets detected as lost.

Suggested Fix

CUDT::checkNAKTimer() is called with every incoming packet. Previously it was only checking if it is time to send NAK report. But if the receiver's loss list is empty, nothing happens.
This means a newly detected loss, observed after more than 300 ms from previous LOSS, will trigger sending immediate loss report, and almost immediate periodic NAK report with the same sequence range.

In this PR the m_ullNextNAKTime_tk is updated in case the receiver's loss list is empty. This fixes group 1 problems.

@maxsharabayko maxsharabayko added Type: Maintenance Work required to maintain or clean up the code [core] Area: Changes in SRT library core labels Nov 14, 2019
@maxsharabayko maxsharabayko added this to the v1.4.1 milestone Nov 14, 2019
srtcore/core.cpp Outdated
{
// If there are no losses so far, update the next NACK time,
// so that a loss report is not sent too erly right after a new loss happens.
m_ullNextNAKTime_tk = currtime_tk + m_ullNAKInt_tk;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This instruction can be now common for both conditions

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactored!

@maxsharabayko
Copy link
Collaborator Author

LossLen > 0 NAKTime > curtime update(nextNAK) SendLoss()
0 0 1 0
0 1 1 0
1 0 0 0
1 1 1 1

@rndi rndi merged commit 5aaff2a into Haivision:master Nov 20, 2019
@maxsharabayko maxsharabayko deleted the hotfix/nak-report-timing branch December 11, 2019 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[core] Area: Changes in SRT library core Type: Maintenance Work required to maintain or clean up the code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants