output/alsa: improve silence generator test in DrainInternal()

There cannot be partial frames in the buffer, so we don't need
GetPeriodPosition(); it's enough to check whether head has been moved
in this period.
This commit is contained in:
Max Kellermann
2019-06-27 21:17:37 +02:00
parent 9fc1668de3
commit 8f6c750064
2 changed files with 9 additions and 6 deletions

View File

@@ -746,8 +746,7 @@ AlsaOutput::DrainInternal()
/* drain ring_buffer */
CopyRingToPeriodBuffer();
auto period_position = period_buffer.GetPeriodPosition(out_frame_size);
if (period_position > 0)
if (period_buffer.WasConsumed())
/* generate some silence to finish the partial
period */
period_buffer.FillWithSilence(silence, out_frame_size);