Skip to content

Commit

Permalink
[core] Moved m_FreshLoss.push_back() out of the incoming loop.
Browse files Browse the repository at this point in the history
  • Loading branch information
gou4shi1 authored and maxsharabayko committed Sep 29, 2022
1 parent e2f4375 commit 432cfe4
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions srtcore/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10327,23 +10327,7 @@ int srt::CUDT::processData(CUnit* in_unit)
{
int32_t seqlo = CSeqNo::incseq(m_iRcvCurrSeqNo);
int32_t seqhi = CSeqNo::decseq(rpkt.m_iSeqNo);

srt_loss_seqs.push_back(make_pair(seqlo, seqhi));

if (initial_loss_ttl)
{
// pack loss list for (possibly belated) NAK
// The LOSSREPORT will be sent in a while.
ScopedLock lock(m_RcvLossLock);
for (loss_seqs_t::iterator i = srt_loss_seqs.begin(); i != srt_loss_seqs.end(); ++i)
{
m_FreshLoss.push_back(CRcvFreshLoss(i->first, i->second, initial_loss_ttl));
}
HLOGC(qrlog.Debug,
log << CONID() << "FreshLoss: added sequences: " << Printable(srt_loss_seqs)
<< " tolerance: " << initial_loss_ttl);
reorder_prevent_lossreport = true;
}
}
}

Expand All @@ -10360,6 +10344,24 @@ int srt::CUDT::processData(CUnit* in_unit)
}
}

if (!srt_loss_seqs.empty())
{
if (initial_loss_ttl)
{
// pack loss list for (possibly belated) NAK
// The LOSSREPORT will be sent in a while.
ScopedLock lock(m_RcvLossLock);
for (loss_seqs_t::iterator i = srt_loss_seqs.begin(); i != srt_loss_seqs.end(); ++i)
{
m_FreshLoss.push_back(CRcvFreshLoss(i->first, i->second, initial_loss_ttl));
}
HLOGC(qrlog.Debug,
log << CONID() << "FreshLoss: added sequences: " << Printable(srt_loss_seqs)
<< " tolerance: " << initial_loss_ttl);
reorder_prevent_lossreport = true;
}
}

// This is moved earlier after introducing filter because it shouldn't
// be executed in case when the packet was rejected by the receiver buffer.
// However now the 'excessive' condition may be true also in case when
Expand Down

0 comments on commit 432cfe4

Please sign in to comment.