From 109bdb28125322ab233b2fcbf35bfd9efa48723d Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Mon, 11 Apr 2022 00:23:08 +0100 Subject: [PATCH] Update audiohandler.cpp --- audiohandler.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/audiohandler.cpp b/audiohandler.cpp index 4ebca12..98fb87c 100644 --- a/audiohandler.cpp +++ b/audiohandler.cpp @@ -397,8 +397,9 @@ void audioHandler::incomingAudio(audioPacket inPacket) void audioHandler::getNextAudioChunk() { - tempBuf.data = tempBuf.data + audioDevice->readAll(); - if (tempBuf.data.length() <= format.bytesForDuration(setup.blockSize * 1000)) { + tempBuf.data.append(audioDevice->readAll()); + + if (tempBuf.data.length() <= format.bytesForDuration(setup.blockSize * 2000)) { return; } @@ -406,8 +407,8 @@ void audioHandler::getNextAudioChunk() livePacket.time= QTime::currentTime(); livePacket.sent = 0; memcpy(&livePacket.guid, setup.guid, GUIDLEN); - livePacket.data = tempBuf.data.left(format.bytesForDuration(setup.blockSize*1000)); - tempBuf.data.remove(0, format.bytesForDuration(setup.blockSize * 1000)); + livePacket.data = tempBuf.data.left(format.bytesForDuration(setup.blockSize*2000)); + tempBuf.data.remove(0, format.bytesForDuration(setup.blockSize * 2000)); //qDebug(logAudio()) << "Sending audio len" << livePacket.data.length() << "remaining" << tempBuf.data.length(); if (livePacket.data.length() > 0) {