Commit f0ac63d5 authored by Max Kellermann's avatar Max Kellermann

output/alsa: DrainInternal() ignores postponed partial frame

parent c1eb0583
......@@ -82,6 +82,17 @@ public:
}
/**
* Has all data for the current period been drained? If not,
* then there is pending data. This ignores the partial frame
* which may have been postponed by FillWithSilence().
*/
bool IsDrained() const noexcept {
/* compare head with capacity, not with tail; this
method makes only sense if the period is full */
return head >= capacity;
}
/**
* Returns the tail of the buffer, i.e. where new data can be
* written. Call GetSpaceBytes() to find out how much may be
* copied to the returned pointer, and call AppendBytes() to
......
......@@ -753,7 +753,7 @@ AlsaOutput::DrainInternal()
period_buffer.FillWithSilence(silence, out_frame_size);
/* drain period_buffer */
if (!period_buffer.IsEmpty()) {
if (!period_buffer.IsDrained()) {
auto frames_written = WriteFromPeriodBuffer();
if (frames_written < 0) {
if (frames_written == -EAGAIN)
......
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