Skip to content
This repository has been archived by the owner on Sep 8, 2024. It is now read-only.

Commit

Permalink
Move mute stage of __init__() after creating lock
Browse files Browse the repository at this point in the history
If the stream is restarted while muted this would cause an Exception
leating to an unresponsive voice client
  • Loading branch information
forslund committed Apr 20, 2020
1 parent caa77b3 commit f3c89d9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mycroft/client/speech/mic.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ def __init__(self, wrapped_stream, format, muted=False):
assert wrapped_stream is not None
self.wrapped_stream = wrapped_stream

self.muted = muted
if muted:
self.mute()

self.SAMPLE_WIDTH = pyaudio.get_sample_size(format)
self.muted_buffer = b''.join([b'\x00' * self.SAMPLE_WIDTH])
self.read_lock = Lock()

self.muted = muted
if muted:
self.mute()

def mute(self):
"""Stop the stream and set the muted flag."""
with self.read_lock:
Expand Down

0 comments on commit f3c89d9

Please sign in to comment.