From d301a79dcf1f27bb389c33758f90ee79d39c58b8 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 26 Apr 2018 10:32:03 +0200 Subject: [PATCH] output/alsa: CopyRingToPeriodBuffer() returns bool --- src/output/plugins/AlsaOutputPlugin.cxx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/output/plugins/AlsaOutputPlugin.cxx b/src/output/plugins/AlsaOutputPlugin.cxx index 329e458cf..b7c9f256d 100644 --- a/src/output/plugins/AlsaOutputPlugin.cxx +++ b/src/output/plugins/AlsaOutputPlugin.cxx @@ -276,14 +276,17 @@ private: */ void CancelInternal() noexcept; - void CopyRingToPeriodBuffer() noexcept { + /** + * @return false if no data was moved + */ + bool CopyRingToPeriodBuffer() noexcept { if (period_buffer.IsFull()) - return; + return false; size_t nbytes = ring_buffer->pop(period_buffer.GetTail(), period_buffer.GetSpaceBytes()); if (nbytes == 0) - return; + return false; period_buffer.AppendBytes(nbytes); @@ -291,6 +294,8 @@ private: /* notify the OutputThread that there is now room in ring_buffer */ cond.signal(); + + return true; } snd_pcm_sframes_t WriteFromPeriodBuffer() noexcept {