summaryrefslogtreecommitdiff
path: root/src/output
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-11-14 13:35:17 +0100
committerMax Kellermann <max@musicpd.org>2018-11-14 13:35:17 +0100
commit436ba3c96c91a71d2acdbb545b693eb2ba57612c (patch)
tree5e353eada896a5aac8c12738dcf94cd47abbf188 /src/output
parent5d12f52873afee05e6e741598654b96c2467ce1f (diff)
output/alsa: drain the whole `ring_buffer`, not just one period
This fixes a problem which caused a failure with snd_pcm_writei() because snd_pcm_drain() had already been called in the previous iteration. This commit makes sure that snd_pcm_drain() is only called after the final snd_pcm_writei() call. This fixes discarded samples at the end of playback.
Diffstat (limited to 'src/output')
-rw-r--r--src/output/plugins/AlsaOutputPlugin.cxx9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/output/plugins/AlsaOutputPlugin.cxx b/src/output/plugins/AlsaOutputPlugin.cxx
index 7f403265c..4cf0c3bd2 100644
--- a/src/output/plugins/AlsaOutputPlugin.cxx
+++ b/src/output/plugins/AlsaOutputPlugin.cxx
@@ -749,11 +749,10 @@ AlsaOutput::DrainInternal()
snd_strerror(-frames_written));
}
- if (!period_buffer.IsEmpty())
- /* need to call WriteFromPeriodBuffer() again
- in the next iteration, so don't finish the
- drain just yet */
- return false;
+ /* need to call CopyRingToPeriodBuffer() and
+ WriteFromPeriodBuffer() again in the next
+ iteration, so don't finish the drain just yet */
+ return period_buffer.IsEmpty();
}
/* .. and finally drain the ALSA hardware buffer */