summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-11-14 10:04:10 +0100
committerMax Kellermann <max@musicpd.org>2018-11-14 10:04:10 +0100
commit6ccc254179f21de82fb19afed48b047d147db9b2 (patch)
tree52998dd62159c8816f9956e22e8fc02e73242e4e /src
parent7db24504478ac5eb40f8114e7f57302be5e59849 (diff)
output/alsa: throw after snd_pcm_drain() error
Diffstat (limited to 'src')
-rw-r--r--src/output/plugins/AlsaOutputPlugin.cxx14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/output/plugins/AlsaOutputPlugin.cxx b/src/output/plugins/AlsaOutputPlugin.cxx
index 29510f870..01ad5e356 100644
--- a/src/output/plugins/AlsaOutputPlugin.cxx
+++ b/src/output/plugins/AlsaOutputPlugin.cxx
@@ -258,10 +258,12 @@ private:
/**
* Drain all buffers. To be run in #EventLoop's thread.
*
+ * Throws on error.
+ *
* @return true if draining is complete, false if this method
* needs to be called again later
*/
- bool DrainInternal() noexcept;
+ bool DrainInternal();
/**
* Stop playback immediately, dropping all buffers. To be run
@@ -711,7 +713,7 @@ AlsaOutput::Recover(int err) noexcept
}
inline bool
-AlsaOutput::DrainInternal() noexcept
+AlsaOutput::DrainInternal()
{
/* drain ring_buffer */
CopyRingToPeriodBuffer();
@@ -747,7 +749,13 @@ AlsaOutput::DrainInternal() noexcept
} else
result = snd_pcm_drain(pcm);
- return result != -EAGAIN;
+ if (result == 0)
+ return true;
+ else if (result == -EAGAIN)
+ return false;
+ else
+ throw FormatRuntimeError("snd_pcm_drain() failed: %s",
+ snd_strerror(-result));
}
void