diff --git a/audiohandler.cpp b/audiohandler.cpp index a134ada..9b5db5b 100644 --- a/audiohandler.cpp +++ b/audiohandler.cpp @@ -761,6 +761,7 @@ void audioHandler::changeLatency(const quint16 newSize) qInfo(logAudio()) << (setup.isinput ? "Input" : "Output") << "Changing latency to: " << newSize << " from " << setup.latency; setup.latency = newSize; delete ringBuf; + audioBuffered = false; ringBuf = new wilt::Ring(setup.latency / 8 + 1); // Should be customizable. } diff --git a/packettypes.h b/packettypes.h index 1bb126a..6c1e9d7 100644 --- a/packettypes.h +++ b/packettypes.h @@ -23,6 +23,7 @@ #define DATA_SIZE 0x15 #define BUFSIZE 50 // Number of packets to buffer +#define TXAUDIO_PERIOD 20 // 0x10 length control packet (connect/disconnect/idle.) typedef union control_packet { diff --git a/udphandler.h b/udphandler.h index 1a8e975..c077f30 100644 --- a/udphandler.h +++ b/udphandler.h @@ -28,7 +28,6 @@ #define TOKEN_RENEWAL 60000 #define PING_PERIOD 100 #define IDLE_PERIOD 100 -#define TXAUDIO_PERIOD 10 #define AREYOUTHERE_PERIOD 500 #define WATCHDOG_PERIOD 500 #define RETRANSMIT_PERIOD 100 diff --git a/udpserver.cpp b/udpserver.cpp index 29df2be..c2ec9e6 100644 --- a/udpserver.cpp +++ b/udpserver.cpp @@ -365,7 +365,7 @@ void udpServer::controlReceived() rxAudioTimer = new QTimer(); rxAudioTimer->setTimerType(Qt::PreciseTimer); connect(rxAudioTimer, &QTimer::timeout, this, std::bind(&udpServer::sendRxAudio, this)); - rxAudioTimer->start(20); + rxAudioTimer->start(TXAUDIO_PERIOD); } }