diff --git a/audiohandler.cpp b/audiohandler.cpp index c8e45d4..6c52c4d 100644 --- a/audiohandler.cpp +++ b/audiohandler.cpp @@ -350,7 +350,9 @@ qint64 audioHandler::readData(char* buffer, qint64 nBytes) #endif // Calculate output length, always full samples int sentlen = 0; - + if (!isReady) { + isReady = true; + } if (ringBuf->size()>0) { // Output buffer is ALWAYS 16 bit. @@ -439,6 +441,9 @@ int audioHandler::writeData(void* outputBuffer, void* inputBuffer, unsigned int qint64 audioHandler::writeData(const char* data, qint64 nBytes) { #endif + if (!isReady) { + isReady = true; + } int sentlen = 0; //qDebug(logAudio()) << "nFrames" << nFrames << "nBytes" << nBytes; int chunkBytes = chunkSize * devChannels * 2; @@ -481,7 +486,7 @@ void audioHandler::incomingAudio(audioPacket inPacket) // Regardless of the radio stream format, the buffered audio will ALWAYS be // 16bit sample interleaved stereo 48K (or whatever the native sample rate is) - if (!isInitialized) + if (!isInitialized && !isReady) { qDebug(logAudio()) << "Packet received when stream was not ready"; return; diff --git a/audiohandler.h b/audiohandler.h index 3828763..6bbfb26 100644 --- a/audiohandler.h +++ b/audiohandler.h @@ -141,6 +141,7 @@ private: void reinit(); bool isInitialized=false; + bool isReady = false; #if defined(RTAUDIO) RtAudio* audio = Q_NULLPTR;