Commit 549faa8a authored by Max Kellermann's avatar Max Kellermann

output/alsa: add full check before calling FillWithSilence()

parent 8f6c7500
...@@ -123,6 +123,8 @@ public: ...@@ -123,6 +123,8 @@ public:
*/ */
void FillWithSilence(const uint8_t *_silence, void FillWithSilence(const uint8_t *_silence,
const size_t frame_size) noexcept { const size_t frame_size) noexcept {
assert(!IsFull());
size_t partial_frame = tail % frame_size; size_t partial_frame = tail % frame_size;
auto *dest = GetTail() - partial_frame; auto *dest = GetTail() - partial_frame;
......
...@@ -746,7 +746,7 @@ AlsaOutput::DrainInternal() ...@@ -746,7 +746,7 @@ AlsaOutput::DrainInternal()
/* drain ring_buffer */ /* drain ring_buffer */
CopyRingToPeriodBuffer(); CopyRingToPeriodBuffer();
if (period_buffer.WasConsumed()) if (period_buffer.WasConsumed() && !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);
......
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