Commit b12fc3c6 authored by Max Kellermann's avatar Max Kellermann

output/alsa: throw unexpected snd_pcm_writei() errors

If snd_pcm_writei() fails, throw an error and stop playback instead of going into an endless busy loop.
parent 6d013b09
...@@ -767,13 +767,16 @@ AlsaOutput::Recover(int err) noexcept ...@@ -767,13 +767,16 @@ AlsaOutput::Recover(int err) noexcept
written = false; written = false;
err = snd_pcm_prepare(pcm); err = snd_pcm_prepare(pcm);
break; break;
case SND_PCM_STATE_DISCONNECTED: case SND_PCM_STATE_DISCONNECTED:
case SND_PCM_STATE_DRAINING:
/* can't play in this state; throw the error */
break; break;
/* this is no error, so just keep running */
case SND_PCM_STATE_PREPARED: case SND_PCM_STATE_PREPARED:
case SND_PCM_STATE_RUNNING: case SND_PCM_STATE_RUNNING:
case SND_PCM_STATE_DRAINING: /* the state is ok, but the error was unexpected;
err = 0; throw it */
break; break;
default: default:
......
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