fix: reduce debug log message amount when no audio received

Used to be every `timeout` time that we'd get the message that no audio data is received. Now only the first time since no data is received.

ref: N25B-213
This commit is contained in:
Twirre Meulenbelt
2025-10-28 13:30:45 +01:00
parent 833dd6c9d4
commit 1cfefc8f8c

View File

@@ -58,8 +58,10 @@ class Streaming(CyclicBehaviour):
async def run(self) -> None:
data = await self.audio_in_poller.poll()
if data is None:
logger.debug("No audio data received. Discarding buffer until new data arrives.")
self.audio_buffer = np.array([], dtype=np.float32)
if len(self.audio_buffer) > 0:
logger.debug("No audio data received. Discarding buffer until new data arrives.")
self.audio_buffer = np.array([], dtype=np.float32)
self.i_since_speech = 100
return
# copy otherwise Torch will be sad that it's immutable