Max missing packets slightly less than buffer size

merge-requests/9/merge
Phil Taylor 2022-01-28 09:43:53 +00:00
rodzic c0fabb3999
commit 30d5858663
3 zmienionych plików z 6 dodań i 4 usunięć

Wyświetl plik

@ -15,6 +15,7 @@
#define LOCK_PERIOD 10 // How long to try to lock mutex (ms)
#define STALE_CONNECTION 15 // Not heard from in this many seconds
#define BUFSIZE 500 // Number of packets to buffer
#define MAX_MISSING 400 // Make the maximum number of possible missing packets less than total buffer size!
#define TXAUDIO_PERIOD 20

Wyświetl plik

@ -1322,7 +1322,7 @@ void udpBase::sendRetransmitRequest()
if (rxMissing.isEmpty()) {
return;
}
else if (rxMissing.size() > 100) {
else if (rxMissing.size() > MAX_MISSING) {
qDebug(logUdp()) << "Too many missing packets," << rxMissing.size() << "flushing all buffers";
missingMutex.lock();
rxMissing.clear();

Wyświetl plik

@ -823,11 +823,12 @@ void udpServer::commonReceived(QList<CLIENT*>* l, CLIENT* current, QByteArray r)
{
for (quint16 i = 0x10; i < r.length(); i = i + 2)
{
auto match = std::find_if(current->txSeqBuf.begin(), current->txSeqBuf.end(), [&cs = in->seq](SEQBUFENTRY& s) {
quint16 seq = (quint8)r[i] | (quint8)r[i + 1] << 8;
auto match = std::find_if(current->txSeqBuf.begin(), current->txSeqBuf.end(), [&cs = seq](SEQBUFENTRY& s) {
return s.seqNum == cs;
});
if (match == current->txSeqBuf.end()) {
qInfo(logUdpServer()) << current->ipAddress.toString() << "(" << current->type << "): Requested packet " << hex << in->seq << " not found";
qInfo(logUdpServer()) << current->ipAddress.toString() << "(" << current->type << "): Requested packet " << hex << seq << " not found";
// Just send idle packet.
sendControl(current, 0, in->seq);
}
@ -1688,7 +1689,7 @@ void udpServer::sendRetransmitRequest(CLIENT* c)
if (c->rxMissing.isEmpty()) {
return;
}
else if (c->rxMissing.size() > 100) {
else if (c->rxMissing.size() > MAX_MISSING) {
qDebug(logUdp()) << "Too many missing packets," << c->rxMissing.size() << "flushing all buffers";
c->rxMutex.lock();
c->rxSeqBuf.clear();