mirror of
https://github.com/overte-org/overte.git
synced 2025-08-05 12:20:00 +02:00
setup default for RTT, RTT variance, _synInterval
This commit is contained in:
parent
85156b9d0f
commit
55555cf13e
4 changed files with 14 additions and 5 deletions
|
@ -20,7 +20,7 @@ static const double USECS_PER_SECOND = 1000000.0;
|
||||||
void DefaultCC::init() {
|
void DefaultCC::init() {
|
||||||
_lastRCTime = high_resolution_clock::now();
|
_lastRCTime = high_resolution_clock::now();
|
||||||
|
|
||||||
_mss = udt::MAX_PACKET_SIZE;
|
_mss = udt::MAX_PACKET_SIZE_WITH_UDP_HEADER;
|
||||||
|
|
||||||
_slowStartLastAck = _sendCurrSeqNum;
|
_slowStartLastAck = _sendCurrSeqNum;
|
||||||
_lastDecreaseMaxSeq = SequenceNumber { SequenceNumber::MAX };
|
_lastDecreaseMaxSeq = SequenceNumber { SequenceNumber::MAX };
|
||||||
|
|
|
@ -30,6 +30,10 @@ Connection::Connection(Socket* parentSocket, HifiSockAddr destination, unique_pt
|
||||||
_destination(destination),
|
_destination(destination),
|
||||||
_congestionControl(move(congestionControl))
|
_congestionControl(move(congestionControl))
|
||||||
{
|
{
|
||||||
|
// setup default SYN, RTT and RTT Variance based on the SYN interval in CongestionControl object
|
||||||
|
_synInterval = _congestionControl->synInterval();
|
||||||
|
_rtt = _synInterval * 10;
|
||||||
|
_rttVariance = _rtt / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
Connection::~Connection() {
|
Connection::~Connection() {
|
||||||
|
@ -126,7 +130,9 @@ void Connection::sendACK(bool wasCausedBySyncTimeout) {
|
||||||
// pack in the RTT and variance
|
// pack in the RTT and variance
|
||||||
ackPacket->writePrimitive(_rtt);
|
ackPacket->writePrimitive(_rtt);
|
||||||
|
|
||||||
// pack the available buffer size - must be a minimum of 2
|
// pack the available buffer size, in packets
|
||||||
|
// in our implementation we have no hard limit on receive buffer size, send the default value
|
||||||
|
ackPacket->writePrimitive((int32_t) udt::CONNECTION_RECEIVE_BUFFER_SIZE_PACKETS);
|
||||||
|
|
||||||
if (wasCausedBySyncTimeout) {
|
if (wasCausedBySyncTimeout) {
|
||||||
// pack in the receive speed and estimatedBandwidth
|
// pack in the receive speed and estimatedBandwidth
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#include "Constants.h"
|
||||||
#include "LossList.h"
|
#include "LossList.h"
|
||||||
#include "PacketTimeWindow.h"
|
#include "PacketTimeWindow.h"
|
||||||
#include "SendQueue.h"
|
#include "SendQueue.h"
|
||||||
|
@ -61,7 +62,7 @@ private:
|
||||||
|
|
||||||
int estimatedTimeout() const;
|
int estimatedTimeout() const;
|
||||||
|
|
||||||
int _synInterval; // Periodical Rate Control Interval, in microseconds, defaults to 10ms
|
int _synInterval; // Periodical Rate Control Interval, in microseconds
|
||||||
|
|
||||||
int _nakInterval; // NAK timeout interval, in microseconds
|
int _nakInterval; // NAK timeout interval, in microseconds
|
||||||
int _minNAKInterval { 100000 }; // NAK timeout interval lower bound, default of 100ms
|
int _minNAKInterval { 100000 }; // NAK timeout interval lower bound, default of 100ms
|
||||||
|
@ -79,7 +80,7 @@ private:
|
||||||
|
|
||||||
int32_t _rtt; // RTT, in microseconds
|
int32_t _rtt; // RTT, in microseconds
|
||||||
int32_t _rttVariance; // RTT variance
|
int32_t _rttVariance; // RTT variance
|
||||||
int _flowWindowSize; // Flow control window size
|
int _flowWindowSize { udt::MAX_PACKETS_IN_FLIGHT }; // Flow control window size
|
||||||
|
|
||||||
int _bandwidth { 1 }; // Exponential moving average for estimated bandwidth, in packets per second
|
int _bandwidth { 1 }; // Exponential moving average for estimated bandwidth, in packets per second
|
||||||
int _deliveryRate { 16 }; // Exponential moving average for receiver's receive rate, in packets per second
|
int _deliveryRate { 16 }; // Exponential moving average for receiver's receive rate, in packets per second
|
||||||
|
|
|
@ -15,12 +15,14 @@
|
||||||
#define hifi_udt_Constants_h
|
#define hifi_udt_Constants_h
|
||||||
|
|
||||||
namespace udt {
|
namespace udt {
|
||||||
static const int MAX_PACKET_SIZE = 1450;
|
static const int MAX_PACKET_SIZE_WITH_UDP_HEADER = 1500;
|
||||||
|
static const int MAX_PACKET_SIZE = MAX_PACKET_SIZE_WITH_UDP_HEADER - 28;
|
||||||
static const int MAX_PACKETS_IN_FLIGHT = 25600;
|
static const int MAX_PACKETS_IN_FLIGHT = 25600;
|
||||||
static const int CONNECTION_RECEIVE_BUFFER_SIZE_PACKETS = 8192;
|
static const int CONNECTION_RECEIVE_BUFFER_SIZE_PACKETS = 8192;
|
||||||
static const int CONNECTION_SEND_BUFFER_SIZE_PACKETS = 8192;
|
static const int CONNECTION_SEND_BUFFER_SIZE_PACKETS = 8192;
|
||||||
static const int UDP_SEND_BUFFER_SIZE_BYTES = 1048576;
|
static const int UDP_SEND_BUFFER_SIZE_BYTES = 1048576;
|
||||||
static const int UDP_RECEIVE_BUFFER_SIZE_BYTES = 1048576;
|
static const int UDP_RECEIVE_BUFFER_SIZE_BYTES = 1048576;
|
||||||
|
static const int DEFAULT_SYN_INTERVAL_USECS = 10 * 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // hifi_udt_Constants_h
|
#endif // hifi_udt_Constants_h
|
||||||
|
|
Loading…
Reference in a new issue