protect against erroneous reads

This commit is contained in:
Jakob Ketterl 2020-08-06 20:06:04 +02:00
parent 0518ff9358
commit 645ace75c3

View File

@ -247,7 +247,11 @@ class AudioChopper(threading.Thread, metaclass=ABCMeta):
for w in self.writers:
w.start()
while self.doRun:
data = self.source.read(256)
data = None
try:
data = self.source.read(256)
except ValueError:
pass
if data is None or (isinstance(data, bytes) and len(data) == 0):
self.doRun = False
else: