]> git.alsa-project.org Git - alsa-tools.git/commitdiff
Added suspend handling
authorJaroslav Kysela <perex@perex.cz>
Thu, 4 Oct 2001 15:06:37 +0000 (15:06 +0000)
committerJaroslav Kysela <perex@perex.cz>
Thu, 4 Oct 2001 15:06:37 +0000 (15:06 +0000)
ac3dec/output.c

index 119232667091d116e9060ae636a1d7ef62725ec0..86a82b529ce0b0fceea2b0ad199495c42c9ea2fc 100644 (file)
@@ -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;