From 1a43f5145d511f37870639fee256c76eb5cb40d3 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 14 Nov 2018 10:08:29 +0100 Subject: [PATCH] output/alsa: throw on snd_pcm_writei() error while draining This implements real error handling, and avoids calling CancelInternal() from this code path. --- src/output/plugins/AlsaOutputPlugin.cxx | 9 ++++++--- 1 file 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())