소스 검색

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)