From bfa79eadcb6db07fc79e1c7ccfabd47fbc306198 Mon Sep 17 00:00:00 2001 From: Username Date: Tue, 24 Feb 2026 16:25:42 +0100 Subject: [PATCH] app: replace audio send polling with blocking queue.get Deterministic wake on data arrival instead of 5ms sleep loop. Reduces CPU wake-ups and eliminates up to 5ms of added latency. --- src/tuimble/app.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/tuimble/app.py b/src/tuimble/app.py index 40a08d0..bdf3a2c 100644 --- a/src/tuimble/app.py +++ b/src/tuimble/app.py @@ -676,13 +676,11 @@ class TuimbleApp(App): @work(thread=True) def _audio_send_loop(self) -> None: - """Poll capture queue and send encoded frames to server.""" + """Send captured audio frames to the server.""" while self._client.connected: - frame = self._audio.get_capture_frame() + frame = self._audio.get_capture_frame(timeout=0.02) if frame is not None: self._client.send_audio(frame) - else: - time.sleep(0.005) # -- channel tree --------------------------------------------------------