From 4d9ba2af056ad48dfa9580cdc9f41cf0f1478508 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Fri, 26 Feb 2021 10:20:55 +0000 Subject: [PATCH] Update audiohandler.cpp --- audiohandler.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/audiohandler.cpp b/audiohandler.cpp index 281220c..1a98db9 100644 --- a/audiohandler.cpp +++ b/audiohandler.cpp @@ -1008,7 +1008,7 @@ void audioHandler::stateChanged(QAudio::State state) qDebug(logAudio()) << this->metaObject()->className() << "RX:Buffer underrun"; QMutexLocker locker(&mutex); audioOutput->suspend(); - buffer.clear(); + //buffer.clear(); } //qDebug(logAudio()) << this->metaObject()->className() << ": state = " << state; } @@ -1021,8 +1021,8 @@ void audioHandler::incomingAudio(const QByteArray& data) if (audioOutput != Q_NULLPTR && audioOutput->state() != QAudio::StoppedState) { QMutexLocker locker(&mutex); buffer.append(data); - // Restart playback once we have more than a couple of 20ms samples. - if ((buffer.length() > data.length()*2) && audioOutput->state() == QAudio::SuspendedState) + // Restart playback + if (audioOutput->state() == QAudio::SuspendedState) { qDebug(logAudio()) << "RX Audio Suspended, Resuming..."; audioOutput->resume();