Only start audio when stream is ready

merge-requests/6/head
Phil Taylor 2021-07-06 10:04:35 +01:00
rodzic 05d9c16eb9
commit f4cdcccfec
2 zmienionych plików z 8 dodań i 2 usunięć

Wyświetl plik

@ -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;

Wyświetl plik

@ -141,6 +141,7 @@ private:
void reinit();
bool isInitialized=false;
bool isReady = false;
#if defined(RTAUDIO)
RtAudio* audio = Q_NULLPTR;