Commit 1a43f514 authored by Max Kellermann's avatar Max Kellermann

output/alsa: throw on snd_pcm_writei() error while draining

This implements real error handling, and avoids calling CancelInternal() from this code path.
parent 7f143a83
...@@ -727,9 +727,12 @@ AlsaOutput::DrainInternal() ...@@ -727,9 +727,12 @@ AlsaOutput::DrainInternal()
/* drain period_buffer */ /* drain period_buffer */
if (!period_buffer.IsEmpty()) { if (!period_buffer.IsEmpty()) {
auto frames_written = WriteFromPeriodBuffer(); auto frames_written = WriteFromPeriodBuffer();
if (frames_written < 0 && frames_written != -EAGAIN) { if (frames_written < 0) {
CancelInternal(); if (frames_written == -EAGAIN)
return true; return false;
throw FormatRuntimeError("snd_pcm_writei() failed: %s",
snd_strerror(-frames_written));
} }
if (!period_buffer.IsEmpty()) if (!period_buffer.IsEmpty())
......
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