]> git.tue.mpg.de Git - paraslash.git/commitdiff
alsa_write.c: Don't abort on EAGAIN.
authorAndre Noll <maan@systemlinux.org>
Thu, 6 Dec 2007 21:12:03 +0000 (22:12 +0100)
committerAndre Noll <maan@systemlinux.org>
Thu, 6 Dec 2007 21:12:03 +0000 (22:12 +0100)
Just retry a bit later.

alsa_write.c

index fab886cacf777caaa51358970f5b43f081e62585..faadec1f673b5064465bf6151fcaa12990098359 100644 (file)
@@ -188,15 +188,19 @@ static int alsa_write_post_select(__a_unused struct sched *s,
                snd_pcm_prepare(pad->handle);
                return 1;
        }
-       if (ret < 0) {
+       if (ret < 0 && ret != -EAGAIN) {
                PARA_WARNING_LOG("alsa error (%zu frames, ret = %d\n",
                        frames, (int)ret);
                return -E_ALSA_WRITE;
        }
-       ms2tv(pad->buffer_time / 4000, &tv);
-//     ms2tv(1, &tv);
+       if (ret == -EAGAIN) { /* try again in 5ms */
+               PARA_WARNING_LOG("EAGAIN\n");
+               ms2tv(5, &tv);
+       } else {
+               wn->written += ret * pad->bytes_per_frame;
+               ms2tv(pad->buffer_time / 4000, &tv);
+       }
        tv_add(now, &tv, &pad->next_chunk);
-       wn->written += ret * pad->bytes_per_frame;
        return 1;
 }