Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prevent shutdown from hanging on Windows #104

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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