From: Jaroslav Kysela Date: Thu, 4 Oct 2001 15:06:37 +0000 (+0000) Subject: Added suspend handling X-Git-Tag: v1.0.3~129 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=ced6868184f03ca1ee0c8d57bdd9271c12f3be69;p=alsa-tools.git Added suspend handling --- diff --git a/ac3dec/output.c b/ac3dec/output.c index 1192326..86a82b5 100644 --- a/ac3dec/output.c +++ b/ac3dec/output.c @@ -174,8 +174,14 @@ int output_play(sint_16* output_samples, uint_32 num_frames) snd_pcm_sframes_t res = 0; do { - if (res == -EPIPE) + if (res == -EPIPE) /* underrun */ res = snd_pcm_prepare(pcm); + else if (res == -ESTRPIPE) { /* suspend */ + while ((res = snd_pcm_resume(pcm)) == -EBUSY) + sleep(1); + if (res < 0) + res = snd_pcm_prepare(pcm); + } res = res < 0 ? res : snd_pcm_writei(pcm, (void *)output_samples, num_frames); if (res > 0) { output_samples += out_config.channels * res;