leave iodevice alone after calling .stop()

Docs say it should not be accessed, and it fails on Linux.
This commit is contained in:
Damien Elmes 2020-12-18 19:14:24 +10:00
parent dc5ce3b9a2
commit 93eccd183f

View file

@ -604,16 +604,14 @@ class QtAudioInputRecorder(Recorder):
self._buffer += self._iodevice.readAll()
def stop(self, on_done: Callable[[str], None]):
# read anything remaining in buffer & stop
self._on_read_ready()
self._audio_input.stop()
if err := self._audio_input.error():
showWarning(f"recording failed: {err}")
return
# read anything remaining in buffer & close
self._on_read_ready()
self._iodevice.close()
# swallow the first 300ms to allow audio device to quiesce
wait = int(44100 * self.STARTUP_DELAY)
if len(self._buffer) <= wait: