Skip to content

Commit 97e5ce3

Browse files
committed
Fix soundrenderer bugs
1 parent 36d116d commit 97e5ce3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

mediadecoder/soundrenderers/sounddevicerenderer.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ def __init__(self, audioformat, queue=None):
4040

4141
def get_frame(self, outdata, frames, timedata, status):
4242
""" Callback function for the audio stream. Don't use directly. """
43+
44+
if not self.keep_listening:
45+
raise sd.CallbackStop
46+
4347
try:
4448
chunk = self.queue.get_nowait()
4549
# Check if the chunk contains the expected number of frames
@@ -60,5 +64,5 @@ def start(self):
6064
def close_stream(self):
6165
""" Closes the stream. Performs cleanup. """
6266
self.keep_listening = False
63-
self.stream.stop
67+
self.stream.stop()
6468
self.stream.close()

0 commit comments

Comments
 (0)