mirror of https://github.com/libsdl-org/SDL.git
alsa: recover from snd_pcm_avail() returning -EPIPE
This commit is contained in:
parent
e68f5ca99a
commit
7d9fd48557
|
|
@ -356,8 +356,12 @@ static bool ALSA_WaitDevice(SDL_AudioDevice *device)
|
||||||
while (!SDL_GetAtomicInt(&device->shutdown)) {
|
while (!SDL_GetAtomicInt(&device->shutdown)) {
|
||||||
const int rc = ALSA_snd_pcm_avail(device->hidden->pcm);
|
const int rc = ALSA_snd_pcm_avail(device->hidden->pcm);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_AUDIO, "ALSA wait failed (unrecoverable): %s", ALSA_snd_strerror(rc));
|
const int status = ALSA_snd_pcm_recover(device->hidden->pcm, rc, 0);
|
||||||
return false;
|
if (status < 0) {
|
||||||
|
// Hmm, not much we can do - abort
|
||||||
|
SDL_LogError(SDL_LOG_CATEGORY_AUDIO, "ALSA wait failed (unrecoverable): %s", ALSA_snd_strerror(rc));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (rc >= sample_frames) {
|
if (rc >= sample_frames) {
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue