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.
This commit is contained in:
Max Kellermann 2019-07-04 12:46:15 +02:00
parent 6d013b092f
commit b12fc3c60d

View File

@ -767,13 +767,16 @@ AlsaOutput::Recover(int err) noexcept
written = false;
err = snd_pcm_prepare(pcm);
break;
case SND_PCM_STATE_DISCONNECTED:
case SND_PCM_STATE_DRAINING:
/* can't play in this state; throw the error */
break;
/* this is no error, so just keep running */
case SND_PCM_STATE_PREPARED:
case SND_PCM_STATE_RUNNING:
case SND_PCM_STATE_DRAINING:
err = 0;
/* the state is ok, but the error was unexpected;
throw it */
break;
default: