Commit 98d76627 authored by Max Kellermann's avatar Max Kellermann

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).
parent 8a809013
...@@ -779,6 +779,14 @@ AlsaOutput::CancelInternal() noexcept ...@@ -779,6 +779,14 @@ AlsaOutput::CancelInternal() noexcept
pcm_export->Reset(); pcm_export->Reset();
period_buffer.Clear(); period_buffer.Clear();
ClearRingBuffer(); ClearRingBuffer();
{
const std::lock_guard<Mutex> lock(mutex);
active = false;
}
MultiSocketMonitor::Reset();
defer_invalidate_sockets.Cancel();
} }
void void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment