improve write() underrun handling, take 2

we *really* should not paper over underruns, as they require attention.
however, the previous attempt (c2a6b6e) caused an exception to be thrown
(see #130), which was a bit excessive, and was consequently reverted
(438e52e).

so instead we make the handling consistent with what we do in read():
return the verbatim -EPIPE in this case. this can be simply ignored, and
the next write will resume the stream, so this is mostly backwards-
compatible (the failing write will be discarded and would need
repeating, but that will just cause a skip after the interruption,
which does not seem particularly relevant).

as a drive-by, again stop using snd_pcm_recover(), as it still just
obfuscates the snd_pcm_prepare() call it does in the end.
This commit is contained in:
Oswald Buddenhagen
2024-02-02 13:33:00 +01:00
committed by Lars Immisch
parent 691c1d9b23
commit 8fb33ddd49
3 changed files with 39 additions and 25 deletions

View File

@@ -1,5 +1,6 @@
# Version 0.10.1
- restore previous xrun behaviour, #131
- revert to not throwing an exception on playback buffer underrun;
instead, return -EPIPE like `PCM.read()` does on overrun; #131
- type hints
# Version 0.10.0