Skip to content

Commit 26678fe

Browse files
mbakholdinamaxsharabayko
authored andcommitted
[core] Fixed the issue with RTT in case of bidirectional transmission introduced when adding atomic types
1 parent ae787bf commit 26678fe

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

srtcore/core.cpp

+6-8
Original file line numberDiff line numberDiff line change
@@ -8452,16 +8452,14 @@ void srt::CUDT::processCtrlAck(const CPacket &ctrlpkt, const steady_clock::time_
84528452
// TODO: The case of bidirectional transmission requires further
84538453
// improvements and testing. Double smoothing is applied here to be
84548454
// consistent with the previous behavior.
8455-
8456-
int crtt = m_iSRTT.load(), crttvar = m_iRTTVar.load();
8457-
8458-
if (crtt != INITIAL_RTT && rttvar != INITIAL_RTTVAR)
8455+
if (rtt != INITIAL_RTT && rttvar != INITIAL_RTTVAR)
84598456
{
8460-
crttvar = avg_iir<4>(crttvar, abs(crtt - rtt));
8461-
crtt = avg_iir<8>(crtt, rtt);
8457+
int iSRTT = m_iSRTT.load(), iRTTVar = m_iRTTVar.load();
8458+
iRTTVar = avg_iir<4>(iRTTVar, abs(rtt - iSRTT));
8459+
iSRTT = avg_iir<8>(iSRTT, rtt);
8460+
m_iSRTT = iSRTT;
8461+
m_iRTTVar = iRTTVar;
84628462
}
8463-
m_iSRTT = crtt;
8464-
m_iRTTVar = crttvar;
84658463
}
84668464
else // Transmission is unidirectional.
84678465
{

0 commit comments

Comments
 (0)