Commit d301a79d authored by Max Kellermann's avatar Max Kellermann

output/alsa: CopyRingToPeriodBuffer() returns bool

parent 98d76627
...@@ -276,14 +276,17 @@ private: ...@@ -276,14 +276,17 @@ private:
*/ */
void CancelInternal() noexcept; void CancelInternal() noexcept;
void CopyRingToPeriodBuffer() noexcept { /**
* @return false if no data was moved
*/
bool CopyRingToPeriodBuffer() noexcept {
if (period_buffer.IsFull()) if (period_buffer.IsFull())
return; return false;
size_t nbytes = ring_buffer->pop(period_buffer.GetTail(), size_t nbytes = ring_buffer->pop(period_buffer.GetTail(),
period_buffer.GetSpaceBytes()); period_buffer.GetSpaceBytes());
if (nbytes == 0) if (nbytes == 0)
return; return false;
period_buffer.AppendBytes(nbytes); period_buffer.AppendBytes(nbytes);
...@@ -291,6 +294,8 @@ private: ...@@ -291,6 +294,8 @@ private:
/* notify the OutputThread that there is now /* notify the OutputThread that there is now
room in ring_buffer */ room in ring_buffer */
cond.signal(); cond.signal();
return true;
} }
snd_pcm_sframes_t WriteFromPeriodBuffer() noexcept { snd_pcm_sframes_t WriteFromPeriodBuffer() noexcept {
......
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