X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=alsa_write.c;h=1c168e7b4b037f8e8853681e02254879f0912640;hp=ae3bbfbab60c82ab26311c00b1d0389a7544ec5c;hb=eb9722e8763a9b2a2ae99d98a9715bd932081c3c;hpb=dd98d31d017bbbe16bf6711e0343b267dd6cfe89 diff --git a/alsa_write.c b/alsa_write.c index ae3bbfba..1c168e7b 100644 --- a/alsa_write.c +++ b/alsa_write.c @@ -14,7 +14,6 @@ #include #include -#include #include #include #include @@ -146,14 +145,15 @@ static void alsa_write_pre_select(struct sched *s, struct task *t) { struct writer_node *wn = container_of(t, struct writer_node, task); struct private_alsa_write_data *pad = wn->private_data; - struct timeval tv; snd_pcm_sframes_t avail, underrun; int ret = btr_node_status(wn->btrn, wn->min_iqs, BTR_NT_LEAF); if (ret == 0) return; - if (ret < 0 || !pad) + if (!pad) return sched_min_delay(s); + if (ret < 0) + return sched_request_barrier_or_min_delay(&pad->drain_barrier, s); /* * Data is available to be written to the alsa handle. Compute number * of milliseconds until next buffer underrun would occur. @@ -172,8 +172,7 @@ static void alsa_write_pre_select(struct sched *s, struct task *t) if (underrun < 50) underrun = 50; underrun -= 50; - ms2tv(underrun, &tv); - sched_request_timeout(&tv, s); + sched_request_timeout_ms(underrun, s); } static void alsa_close(struct writer_node *wn) @@ -214,7 +213,7 @@ again: bytes = btr_next_buffer(btrn, &data); if (ret < 0 || bytes < wn->min_iqs) { /* eof */ assert(btr_no_parent(btrn)); - ret = -E_ALSA_EOF; + ret = -E_WRITE_COMMON_EOF; if (!pad) goto err; /* wait until pending frames are played */