EPIPE and ESTRPIPE may be equal

fixes #133
This commit is contained in:
Tom M 2017-06-30 08:14:09 +02:00 committed by GitHub
parent 0edbe06621
commit 3995efca5d

View file

@ -347,6 +347,18 @@ static int fluid_alsa_handle_write_error (snd_pcm_t *pcm, int errval)
case -EAGAIN: case -EAGAIN:
snd_pcm_wait(pcm, 1); snd_pcm_wait(pcm, 1);
break; break;
// on some BSD variants ESTRPIPE is defined as EPIPE.
// not sure why, maybe because this version of alsa doesnt support
// suspending pcm stream. anyway, since EPIPE seems to be more
// likely than ESTRPIPE, so ifdef it out in case.
#if ESTRPIPE != EPIPE
case -ESTRPIPE:
if (snd_pcm_resume(pcm) != 0) {
FLUID_LOG(FLUID_ERR, "Failed to resume the audio device");
return FLUID_FAILED;
}
/* fall through, since the stream got resumed, but still has to be prepared */
#endif
case -EPIPE: case -EPIPE:
case -EBADFD: case -EBADFD:
if (snd_pcm_prepare(pcm) != 0) { if (snd_pcm_prepare(pcm) != 0) {
@ -354,12 +366,6 @@ static int fluid_alsa_handle_write_error (snd_pcm_t *pcm, int errval)
return FLUID_FAILED; return FLUID_FAILED;
} }
break; break;
case -ESTRPIPE:
if ((snd_pcm_resume(pcm) != 0) && (snd_pcm_prepare(pcm) != 0)) {
FLUID_LOG(FLUID_ERR, "Failed to resume the audio device");
return FLUID_FAILED;
}
break;
default: default:
FLUID_LOG(FLUID_ERR, "The audio device error: %s", snd_strerror(errval)); FLUID_LOG(FLUID_ERR, "The audio device error: %s", snd_strerror(errval));
return FLUID_FAILED; return FLUID_FAILED;