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).
This commit is contained in:
Max Kellermann 2018-04-26 12:28:10 +02:00
parent 8a809013f3
commit 98d76627a5
1 changed files with 8 additions and 0 deletions

View File

@ -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