Skip to content

Commit

Permalink
[core] Improved periodic NAK report timing
Browse files Browse the repository at this point in the history
  • Loading branch information
maxsharabayko authored and rndi committed Nov 20, 2019
1 parent 400994e commit 53e179b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions srtcore/core.cpp
Expand Up @@ -9307,12 +9307,18 @@ void CUDT::checkNAKTimer(uint64_t currtime_tk)
* not knowing what to retransmit when the only NAK sent by receiver is lost,
* all packets past last ACK are retransmitted (rexmitMethod() == SRM_FASTREXMIT).
*/
if ((currtime_tk > m_ullNextNAKTime_tk) && (m_pRcvLossList->getLossLength() > 0))
const int loss_len = m_pRcvLossList->getLossLength();
SRT_ASSERT(loss_len >= 0);
if (loss_len <= 0)
{
// 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;
}
else if (currtime_tk > m_ullNextNAKTime_tk)
{
// NAK timer expired, and there is loss to be reported.
sendCtrl(UMSG_LOSSREPORT);

CTimer::rdtsc(currtime_tk);
m_ullNextNAKTime_tk = currtime_tk + m_ullNAKInt_tk;
}
}
Expand Down

0 comments on commit 53e179b

Please sign in to comment.