浏览代码

Merge pull request #72 from oddlama/fix-shutdown

fix: make sure shutdown() wakes up the recording_thread
Kolja Beigel 5 月之前
父节点
当前提交
c4fa5953a1
共有 1 个文件被更改,包括 1 次插入2 次删除
  1. 1 2
      RealtimeSTT/audio_recorder.py

+ 1 - 2
RealtimeSTT/audio_recorder.py

@@ -1560,7 +1560,6 @@ class AudioToTextRecorder:
             print("\033[91mRealtimeSTT shutting down\033[0m")
             # logging.debug("RealtimeSTT shutting down")
 
-            # Force wait_audio() and text() to exit
             self.is_shut_down = True
             self.start_recording_event.set()
             self.stop_recording_event.set()
@@ -1571,10 +1570,10 @@ class AudioToTextRecorder:
 
             logging.debug('Finishing recording thread')
             if self.recording_thread:
+                self.audio_queue.put(bytes(1))
                 self.recording_thread.join()
 
             logging.debug('Terminating reader process')
-
             # Give it some time to finish the loop and cleanup.
             if self.use_microphone.value:
                 self.reader_process.join(timeout=10)