summaryrefslogtreecommitdiff
path: root/src/output/plugins
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-04-26 12:28:10 +0200
committerMax Kellermann <max@musicpd.org>2018-04-26 16:41:49 +0200
commit98d76627a5ea5217ad3629d57e475bb5c55034bb (patch)
treeecbab3301e1866ac7a1a6a4764b77c7780a8967b /src/output/plugins
parent8a809013f36fe11b7c8b05d091895418f497552b (diff)
output/alsa: disable events in Cancel()
Don't reactivate the PCM device immediately after Cancel() is finished; if Cancel() gets called this may mean that new data may take a while to produce, or no data at all will be produced because the current song is being stopped. Once new data is available, Play() will automatically reactivate the PCM. This fixes underruns when switching songs manually (closes #264).
Diffstat (limited to 'src/output/plugins')
-rw-r--r--src/output/plugins/AlsaOutputPlugin.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/output/plugins/AlsaOutputPlugin.cxx b/src/output/plugins/AlsaOutputPlugin.cxx
index 3336117c8..329e458cf 100644
--- a/src/output/plugins/AlsaOutputPlugin.cxx
+++ b/src/output/plugins/AlsaOutputPlugin.cxx
@@ -779,6 +779,14 @@ AlsaOutput::CancelInternal() noexcept
pcm_export->Reset();
period_buffer.Clear();
ClearRingBuffer();
+
+ {
+ const std::lock_guard<Mutex> lock(mutex);
+ active = false;
+ }
+
+ MultiSocketMonitor::Reset();
+ defer_invalidate_sockets.Cancel();
}
void