]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - alsa_write.c
configure.ac: para_client needs time.o.
[paraslash.git] / alsa_write.c
index 8e3688faad4719c39b5819fb738cac1578323eee..658183eacafca7ba9385177185b72392cf78d3d0 100644 (file)
@@ -177,8 +177,8 @@ static int alsa_write_pre_select(struct sched *s, struct writer_node *wn)
                if (ret == 0)
                        return 1;
                if (ret < 0) {
-                       underrun = 10;
-                       goto timeout;
+                       sched_request_timeout_ms(20, s);
+                       return 42;
                }
        } else {
                if (*wng->loaded - wn->written < pad->bytes_per_frame)
@@ -202,7 +202,6 @@ static int alsa_write_pre_select(struct sched *s, struct writer_node *wn)
        if (underrun < 50)
                underrun = 50;
        underrun -= 50;
-timeout:
        ms2tv(underrun, &tv);
        if (tv_diff(&s->timeout, &tv, NULL) > 0)
                s->timeout = tv;
@@ -353,11 +352,6 @@ again:
                wn->min_iqs = pad->bytes_per_frame;
        }
        frames = bytes / pad->bytes_per_frame;
-       avail = snd_pcm_avail_update(pad->handle);
-       if (avail <= 0)
-               return;
-       frames = PARA_MIN(frames, avail);
-       //PARA_CRIT_LOG("writing %ld frames\n", frames);
        frames = snd_pcm_writei(pad->handle, data, frames);
        if (frames >= 0) {
                btr_consume(btrn, frames * pad->bytes_per_frame);
@@ -368,9 +362,9 @@ again:
                snd_pcm_prepare(pad->handle);
                return;
        }
-       PARA_WARNING_LOG("%s\n", snd_strerror(-frames));
        if (frames == -EAGAIN)
                return;
+       PARA_WARNING_LOG("%s\n", snd_strerror(-frames));
        ret = -E_ALSA_WRITE;
 err:
        assert(ret < 0);