Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions RealtimeSTT/audio_recorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import os
import re
import gc
import queue

# Set OpenMP runtime duplicate library handling to OK (Use only for development!)
os.environ['KMP_DUPLICATE_LIB_OK'] = 'TRUE'
Expand Down Expand Up @@ -1258,7 +1259,7 @@ def _recording_worker(self):

try:

data = self.audio_queue.get()
data = self.audio_queue.get(True, 1)
if self.on_recorded_chunk:
self.on_recorded_chunk(data)

Expand All @@ -1275,8 +1276,11 @@ def _recording_worker(self):
while (self.audio_queue.qsize() >
self.allowed_latency_limit):

data = self.audio_queue.get()
data = self.audio_queue.get(True, 1)

except queue.Empty:
continue

except BrokenPipeError:
print("BrokenPipeError _recording_worker")
self.is_running = False
Expand Down