output/alsa: call snd_pcm_prepare() if draining is requested early
This fixes a corner case which has probably never occurred and probably never will: if Cancel() is called, and then Play() followed by Drain(), the plugin should really play that data. However currently, this never happens, because snd_pcm_prepare() is never called.
This commit is contained in:
parent
57e34823d8
commit
4247a757b3
@ -891,6 +891,15 @@ AlsaOutput::DispatchSockets() noexcept
|
||||
try {
|
||||
non_block.DispatchSockets(*this, pcm);
|
||||
|
||||
if (must_prepare) {
|
||||
must_prepare = false;
|
||||
|
||||
int err = snd_pcm_prepare(pcm);
|
||||
if (err < 0)
|
||||
throw FormatRuntimeError("snd_pcm_prepare() failed: %s",
|
||||
snd_strerror(-err));
|
||||
}
|
||||
|
||||
{
|
||||
const std::lock_guard<Mutex> lock(mutex);
|
||||
|
||||
@ -911,15 +920,6 @@ try {
|
||||
}
|
||||
}
|
||||
|
||||
if (must_prepare) {
|
||||
must_prepare = false;
|
||||
|
||||
int err = snd_pcm_prepare(pcm);
|
||||
if (err < 0)
|
||||
throw FormatRuntimeError("snd_pcm_prepare() failed: %s",
|
||||
snd_strerror(-err));
|
||||
}
|
||||
|
||||
CopyRingToPeriodBuffer();
|
||||
|
||||
if (period_buffer.IsEmpty()) {
|
||||
|
Loading…
Reference in New Issue
Block a user