From d26abdc96814f9bcb3a34e31f442f8e6f2505a78 Mon Sep 17 00:00:00 2001 From: Bryan Biedenkapp Date: Fri, 9 Jan 2026 14:58:50 -0500 Subject: [PATCH] remove main thread sleep control this causes WinSock on Win32 to lose its mind when polled too fast; --- src/bridge/HostBridge.cpp | 8 +------- src/bridge/HostBridge.h | 2 -- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/bridge/HostBridge.cpp b/src/bridge/HostBridge.cpp index e64220af..d9e35c57 100644 --- a/src/bridge/HostBridge.cpp +++ b/src/bridge/HostBridge.cpp @@ -243,7 +243,6 @@ HostBridge::HostBridge(const std::string& confFile) : m_txStreamId(0U), m_detectedSampleCnt(0U), m_dumpSampleLevel(false), - m_mtNoSleep(false), m_trace(false), m_debug(false), m_rtsPttEnable(false), @@ -620,7 +619,7 @@ int HostBridge::run() if (m_udpAudio && m_udpAudioSocket != nullptr) processUDPAudio(); - if (ms < 2U && !m_mtNoSleep) + if (ms < 2U) Thread::sleep(1U); } @@ -1313,8 +1312,6 @@ void HostBridge::processUDPAudio() return; if (length > 0) { - m_mtNoSleep = true; // make main thread run as fast as possible - if (m_debug && m_trace) Utils::dump(1U, "HostBridge()::processUDPAudio(), Audio Network Packet", buffer, length); @@ -1372,9 +1369,6 @@ void HostBridge::processUDPAudio() req->dstId = m_dstId; m_udpPackets.push_back(req); } - else { - m_mtNoSleep = false; // restore main thread sleeping if no pending packets - } } /* Helper to write UDP audio to the UDP audio socket. */ diff --git a/src/bridge/HostBridge.h b/src/bridge/HostBridge.h index aa5c2fa2..2465767e 100644 --- a/src/bridge/HostBridge.h +++ b/src/bridge/HostBridge.h @@ -251,8 +251,6 @@ private: uint8_t m_detectedSampleCnt; bool m_dumpSampleLevel; - bool m_mtNoSleep; - static bool s_running; bool m_trace; bool m_debug;