summaryrefslogtreecommitdiff
path: root/src/output
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-11-13 20:23:22 +0100
committerMax Kellermann <max@musicpd.org>2018-11-14 10:24:08 +0100
commit3830748de5d44b5f895c3ebadd576a915737fba8 (patch)
treea2f4c5104dcb6db3d01e9b4de68b030ef24aa660 /src/output
parent1a43f5145d511f37870639fee256c76eb5cb40d3 (diff)
output/alsa: clear the `period_buffer` in LockCaughtError()
The method Cancel() assumes that the `period_buffer` must be empty when `active==false`, but that is not the case when Play() fails. Of course the assertion in Cancel() is not 100% correct, but I decided to rather fix this in LockCaughtError() because the `period_buffer` should only be accessed from within the RTIO thread, and this is the only code path where `active` can be set to `false` with a non-empty `period_buffer`. Fixes #423
Diffstat (limited to 'src/output')
-rw-r--r--src/output/plugins/AlsaOutputPlugin.cxx2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/output/plugins/AlsaOutputPlugin.cxx b/src/output/plugins/AlsaOutputPlugin.cxx
index 8b505db7d..c72cf4ea2 100644
--- a/src/output/plugins/AlsaOutputPlugin.cxx
+++ b/src/output/plugins/AlsaOutputPlugin.cxx
@@ -306,6 +306,8 @@ private:
}
void LockCaughtError() noexcept {
+ period_buffer.Clear();
+
const std::lock_guard<Mutex> lock(mutex);
error = std::current_exception();
active = false;