Commit a92aa0be authored by Max Kellermann's avatar Max Kellermann

output/alsa: use IsCleared() instead of IsDrained() in DrainInternal()

Really drain all data from the period_buffer in any case.
parent d66f5a85
...@@ -78,14 +78,6 @@ public: ...@@ -78,14 +78,6 @@ public:
} }
/** /**
* Has some data already been consumed at the buffer's head in
* this period?
*/
bool WasConsumed() const noexcept {
return head > 0;
}
/**
* Has all data for the current period been drained? If not, * Has all data for the current period been drained? If not,
* then there is pending data. This ignores the partial frame * then there is pending data. This ignores the partial frame
* which may have been postponed by FillWithSilence(). * which may have been postponed by FillWithSilence().
......
...@@ -747,7 +747,9 @@ AlsaOutput::DrainInternal() ...@@ -747,7 +747,9 @@ AlsaOutput::DrainInternal()
/* drain ring_buffer */ /* drain ring_buffer */
CopyRingToPeriodBuffer(); CopyRingToPeriodBuffer();
if (period_buffer.WasConsumed() && !period_buffer.IsFull()) /* drain period_buffer */
if (!period_buffer.IsCleared()) {
if (!period_buffer.IsFull())
/* generate some silence to finish the partial /* generate some silence to finish the partial
period */ period */
period_buffer.FillWithSilence(silence, out_frame_size); period_buffer.FillWithSilence(silence, out_frame_size);
...@@ -765,9 +767,11 @@ AlsaOutput::DrainInternal() ...@@ -765,9 +767,11 @@ AlsaOutput::DrainInternal()
/* need to call CopyRingToPeriodBuffer() and /* need to call CopyRingToPeriodBuffer() and
WriteFromPeriodBuffer() again in the next WriteFromPeriodBuffer() again in the next
iteration, so don't finish the drain just yet */ iteration, so don't finish the drain just
yet */
return false; return false;
} }
}
if (!written) if (!written)
/* if nothing has ever been written to the PCM, we /* if nothing has ever been written to the PCM, we
......
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