mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
catch overflow errors during record
This commit is contained in:
parent
26272cba65
commit
5545f5f622
1 changed files with 9 additions and 2 deletions
|
@ -179,8 +179,15 @@ class PyAudioThreadedRecorder(threading.Thread):
|
|||
frames_per_buffer=chunk)
|
||||
all = []
|
||||
while not self.finish:
|
||||
data = stream.read(chunk)
|
||||
all.append(data)
|
||||
try:
|
||||
data = stream.read(chunk)
|
||||
except IOError, e:
|
||||
if e[1] == pyaudio.paInputOverflowed:
|
||||
data = None
|
||||
else:
|
||||
raise
|
||||
if data:
|
||||
all.append(data)
|
||||
stream.close()
|
||||
p.terminate()
|
||||
data = ''.join(all)
|
||||
|
|
Loading…
Reference in a new issue