diff options
author | Chris Robinson <[email protected]> | 2009-09-20 00:40:23 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2009-09-20 00:40:23 -0700 |
commit | 750399ccd7409d570712509720d2a8cc845963c1 (patch) | |
tree | 6ff319c8785ef24b2c036e2b0ae125b701a95f1b /Alc | |
parent | fb97ca6022308e5898dbfa43958f61bcaed82f30 (diff) |
Let verify_state restore from an ALSA underrun
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/alsa.c | 27 |
1 files changed, 8 insertions, 19 deletions
@@ -150,7 +150,7 @@ static int verify_state(snd_pcm_t *handle) int err = xrun_recovery(handle, -EPIPE); if(err < 0) return err; } - else if (state == SND_PCM_STATE_SUSPENDED) + else if(state == SND_PCM_STATE_SUSPENDED) { int err = xrun_recovery(handle, -ESTRPIPE); if(err < 0) return err; @@ -183,13 +183,7 @@ static ALuint ALSAProc(ALvoid *ptr) avail = psnd_pcm_avail_update(data->pcmHandle); if(avail < 0) { - err = xrun_recovery(data->pcmHandle, avail); - if (err < 0) - { - AL_PRINT("available update failed: %s\n", psnd_strerror(err)); - aluHandleDisconnect(pDevice); - break; - } + AL_PRINT("available update failed: %s\n", psnd_strerror(avail)); continue; } @@ -200,31 +194,26 @@ static ALuint ALSAProc(ALvoid *ptr) { err = psnd_pcm_start(data->pcmHandle); if(err < 0) - err = xrun_recovery(data->pcmHandle, err); - if(err < 0) { AL_PRINT("start failed: %s\n", psnd_strerror(err)); - aluHandleDisconnect(pDevice); - break; + continue; } } - else if(psnd_pcm_wait(data->pcmHandle, 1000) == 0) + if(psnd_pcm_wait(data->pcmHandle, 1000) == 0) AL_PRINT("Wait timeout... buffer size too low?\n"); continue; } avail = pDevice->UpdateSize; // it is possible that contiguous areas are smaller, thus we use a loop - while (avail > 0) + while(avail > 0) { frames = avail; err = psnd_pcm_mmap_begin(data->pcmHandle, &areas, &offset, &frames); - if (err < 0) + if(err < 0) { - err = xrun_recovery(data->pcmHandle, err); - if (err < 0) - AL_PRINT("mmap begin error: %s\n", psnd_strerror(err)); + AL_PRINT("mmap begin error: %s\n", psnd_strerror(err)); break; } @@ -232,7 +221,7 @@ static ALuint ALSAProc(ALvoid *ptr) aluMixData(pDevice, WritePtr, frames); commitres = psnd_pcm_mmap_commit(data->pcmHandle, offset, frames); - if (commitres < 0 || (commitres-frames) != 0) + if(commitres < 0 || (commitres-frames) != 0) { AL_PRINT("mmap commit error: %s\n", psnd_strerror(commitres >= 0 ? -EPIPE : commitres)); |