Identify if we have missing audio seq numbers.

merge-requests/2/head
Phil Taylor 2021-03-02 14:35:33 +00:00
rodzic 1edcd6cc59
commit e5f1ac31a8
2 zmienionych plików z 8 dodań i 2 usunięć

Wyświetl plik

@ -959,8 +959,9 @@ qint64 audioHandler::readData(char* data, qint64 maxlen)
//qDebug(logAudio()) << "Packet " << hex << packet->seq << " arrived too late (increase rx buffer size!) " << dec << packet->time.msecsTo(QTime::currentTime()) << "ms";
packet = audioBuffer.erase(packet); // returns next packet
}
else //if (timediff > (int)latency / 2)
else if (packet->seq == lastSeq+1 || packet->seq <= lastSeq)
{
lastSeq = packet->seq;
//qDebug(logAudio()) << "Packet " << hex << packet->seq << " arrived on time " << dec << packet->time.msecsTo(QTime::currentTime()) << "ms";
// Will this packet fit in the current buffer?
int send = qMin((int)((maxlen/divisor) - (sentlen/divisor)), packet->data.length() - packet->sent);
@ -992,6 +993,7 @@ qint64 audioHandler::readData(char* data, qint64 maxlen)
if (send == packet->data.length())
{
lastSeq = packet->seq;
packet = audioBuffer.erase(packet); // returns next packet
if (maxlen - sentlen == 0)
{
@ -1010,7 +1012,10 @@ qint64 audioHandler::readData(char* data, qint64 maxlen)
qDebug(logAudio()) << "Packet " << hex << packet->seq << " is partial, sent=" << dec << packet->sent << " sentlen=" << sentlen;
break;
}
}
} else {
qDebug(logAudio()) << "Missing audio packet(s) from: " << lastSeq + 1 << " to " << packet->seq - 1;
lastSeq = packet->seq;
}
}
}

Wyświetl plik

@ -82,6 +82,7 @@ private:
bool isInput; // Used to determine whether input or output audio
float volume;
int chunkSize;
quint16 lastSeq;
QAudioFormat format;
QAudioDeviceInfo deviceInfo;