@@ -81,7 +81,7 @@ class LiveCC: public SrtCongestionControlBase
81
81
m_zSndAvgPayloadSize = m_zMaxPayloadSize;
82
82
83
83
m_iMinNakInterval_us = 20000; //Minimum NAK Report Period (usec)
84
-
m_iNakReportAccel = 2; //Default NAK Report Period (RTT) accelerator
84
+
m_iNakReportAccel = 2; //Default NAK Report Period (RTT) accelerator (send periodic NAK every RTT/2)
85
85
86
86
HLOGC(cclog.Debug, log << "Creating LiveCC: bw=" << m_llSndMaxBW << " avgplsize=" << m_zSndAvgPayloadSize);
87
87
@@ -92,11 +92,11 @@ class LiveCC: public SrtCongestionControlBase
92
92
// from receiving thread.
93
93
parent->ConnectSignal(TEV_SEND, SSLOT(updatePayloadSize));
94
94
95
-
/*
96
-
* Readjust the max SndPeriod onACK (and onTimeout)
97
-
*/
98
-
parent->ConnectSignal(TEV_CHECKTIMER, SSLOT(updatePktSndPeriod_onTimer));
99
-
parent->ConnectSignal(TEV_ACK, SSLOT(updatePktSndPeriod_onAck));
95
+
//
96
+
// Adjust the max SndPeriod onACK and onTimeout.
97
+
//
98
+
parent->ConnectSignal(TEV_CHECKTIMER, SSLOT(onRTO));
99
+
parent->ConnectSignal(TEV_ACK, SSLOT(onAck));
100
100
}
101
101
102
102
bool checkTransArgs(SrtCongestion::TransAPI api, SrtCongestion::TransDir dir, const char* , size_t size, int , bool ) ATR_OVERRIDE
@@ -153,17 +153,22 @@ class LiveCC: public SrtCongestionControlBase
153
153
HLOGC(cclog.Debug, log << "LiveCC: avg payload size updated: " << m_zSndAvgPayloadSize);
154
154
}
155
155
156
-
void updatePktSndPeriod_onTimer(ETransmissionEvent , EventVariant var)
156
+
/// @brief On RTO event update an inter-packet send interval.
157
+
/// @param arg EventVariant::STAGE to distinguish between INIT and actual RTO.
158
+
void onRTO(ETransmissionEvent , EventVariant var)
157
159
{
158
-
if ( var.get<EventVariant::STAGE>() != TEV_CHT_INIT )
160
+
if (var.get<EventVariant::STAGE>() != TEV_CHT_INIT )
159
161
updatePktSndPeriod();
160
162
}
161
163
162
-
void updatePktSndPeriod_onAck(ETransmissionEvent , EventVariant )
164
+
/// @brief Handle an incoming ACK event.
165
+
/// Mainly updates a send interval between packets relying on the maximum BW limit.
166
+
void onAck(ETransmissionEvent, EventVariant )
163
167
{
164
168
updatePktSndPeriod();
165
169
}
166
170
171
+
/// @brief Updates a send interval between packets relying on the maximum BW limit.
167
172
void updatePktSndPeriod()
168
173
{
169
174
// packet = payload + header
@@ -289,9 +294,9 @@ class FileCC : public SrtCongestionControlBase
289
294
m_dCWndSize = 16;
290
295
m_dPktSndPeriod = 1;
291
296
292
-
parent->ConnectSignal(TEV_ACK, SSLOT(updateSndPeriod));
293
-
parent->ConnectSignal(TEV_LOSSREPORT, SSLOT(slowdownSndPeriod));
294
-
parent->ConnectSignal(TEV_CHECKTIMER, SSLOT(speedupToWindowSize));
297
+
parent->ConnectSignal(TEV_ACK, SSLOT(onACK));
298
+
parent->ConnectSignal(TEV_LOSSREPORT, SSLOT(onLossReport));
299
+
parent->ConnectSignal(TEV_CHECKTIMER, SSLOT(onRTO));
295
300
296
301
HLOGC(cclog.Debug, log << "Creating FileCC");
297
302
}
@@ -305,10 +310,11 @@ class FileCC : public SrtCongestionControlBase
305
310
return true;
306
311
}
307
312
313
+
/// Tells if an early ACK is needed (before the next Full ACK happening every 10ms).
314
+
/// In FileCC, treat non-full-payload as an end-of-message (stream)
315
+
/// and request ACK to be sent immediately.
308
316
bool needsQuickACK(const CPacket& pkt) ATR_OVERRIDE
309
317
{
310
-
// For FileCC, treat non-full-buffer situation as an end-of-message situation;
311
-
// request ACK to be sent immediately.
312
318
if (pkt.getLength() < m_parent->maxPayloadSize())
313
319
{
314
320
// This is not a regular fixed size packet...
@@ -329,9 +335,10 @@ class FileCC : public SrtCongestionControlBase
329
335
}
330
336
331
337
private:
332
-
333
-
// SLOTS
334
-
void updateSndPeriod(ETransmissionEvent, EventVariant arg)
338
+
/// Handle icoming ACK event.
339
+
/// In slow start stage increase CWND. Leave slow start once maximum CWND is reached.
340
+
/// In congestion avoidance stage adjust inter packet send interval value to achieve maximum rate.
341
+
void onACK(ETransmissionEvent, EventVariant arg)
335
342
{
336
343
const int ack = arg.get<EventVariant::ACK>();
337
344
@@ -455,9 +462,10 @@ class FileCC : public SrtCongestionControlBase
455
462
456
463
}
457
464
458
-
// When a lossreport has been received, it might be due to having
459
-
// reached the available bandwidth limit. Slowdown to avoid further losses.
460
-
void slowdownSndPeriod(ETransmissionEvent, EventVariant arg)
465
+
/// When a lossreport has been received, it might be due to having
466
+
/// reached the available bandwidth limit. Slowdown to avoid further losses.
467
+
/// Leave the slow start stage if it was active.
468
+
void onLossReport(ETransmissionEvent, EventVariant arg)
461
469
{
462
470
const int32_t* losslist = arg.get_ptr();
463
471
size_t losslist_size = arg.get_len();
@@ -559,7 +567,9 @@ class FileCC : public SrtCongestionControlBase
559
567
}
560
568
}
561
569
562
-
void speedupToWindowSize(ETransmissionEvent, EventVariant arg)
570
+
/// @brief On retransmission timeout leave slow start stage if it was active.
571
+
/// @param arg EventVariant::STAGE to distinguish between INIT and actual RTO.
572
+
void onRTO(ETransmissionEvent, EventVariant arg)
563
573
{
564
574
ECheckTimerStage stg = arg.get<EventVariant::STAGE>();
565
575
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4