diff options
author | Max Kellermann <max@musicpd.org> | 2018-11-14 10:08:29 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-11-14 10:08:29 +0100 |
commit | 1a43f5145d511f37870639fee256c76eb5cb40d3 (patch) | |
tree | 6c4f609483add5162fbdc5eaf986af03bb49a9f9 /src/output | |
parent | 7f143a83c1a1b9b3654d2f3cfeab4f9e6362f1f4 (diff) |
output/alsa: throw on snd_pcm_writei() error while draining
This implements real error handling, and avoids calling
CancelInternal() from this code path.
Diffstat (limited to 'src/output')
-rw-r--r-- | src/output/plugins/AlsaOutputPlugin.cxx | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/output/plugins/AlsaOutputPlugin.cxx b/src/output/plugins/AlsaOutputPlugin.cxx index 8932a02fb..8b505db7d 100644 --- a/src/output/plugins/AlsaOutputPlugin.cxx +++ b/src/output/plugins/AlsaOutputPlugin.cxx @@ -727,9 +727,12 @@ AlsaOutput::DrainInternal() /* drain period_buffer */ if (!period_buffer.IsEmpty()) { auto frames_written = WriteFromPeriodBuffer(); - if (frames_written < 0 && frames_written != -EAGAIN) { - CancelInternal(); - return true; + if (frames_written < 0) { + if (frames_written == -EAGAIN) + return false; + + throw FormatRuntimeError("snd_pcm_writei() failed: %s", + snd_strerror(-frames_written)); } if (!period_buffer.IsEmpty()) |