output/alsa: CopyRingToPeriodBuffer() returns bool
This commit is contained in:
parent
98d76627a5
commit
d301a79dcf
@ -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:
|
|||||||
/* 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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user