alsa_writer pre_select: Only set a small timeout if really neccessary.
authorAndre <maan@p133.(none)>
Mon, 5 Jun 2006 19:38:17 +0000 (21:38 +0200)
committerAndre <maan@p133.(none)>
Mon, 5 Jun 2006 19:38:17 +0000 (21:38 +0200)
alsa_writer.c

index 466f1e8d5cbfa53ed124f1a8a89d30808ed27d56..d13ea3a8b2ec71eaf85310603d437f60b9a39e15 100644 (file)
@@ -154,14 +154,14 @@ static void alsa_write_pre_select(struct sched *s, struct task *t)
        struct timeval diff;
 
        t->ret = 1;
        struct timeval diff;
 
        t->ret = 1;
-       if (*wng->input_eof && *wng->loaded < pad->bytes_per_frame)
+       if (*wng->loaded < pad->bytes_per_frame)
                return;
        if (tv_diff(&s->now, &pad->next_chunk, &diff) < 0) {
                if (tv_diff(&s->timeout, &diff, NULL) > 0)
                        s->timeout = diff;
        } else {
                s->timeout.tv_sec = 0;
                return;
        if (tv_diff(&s->now, &pad->next_chunk, &diff) < 0) {
                if (tv_diff(&s->timeout, &diff, NULL) > 0)
                        s->timeout = diff;
        } else {
                s->timeout.tv_sec = 0;
-               s->timeout.tv_usec = 1000;
+               s->timeout.tv_usec = 1;
        }
 //     PARA_INFO_LOG("timeout: %lu\n", tv2ms(&s->timeout));
 }
        }
 //     PARA_INFO_LOG("timeout: %lu\n", tv2ms(&s->timeout));
 }
@@ -206,6 +206,7 @@ static void alsa_write_post_select(struct sched *s, struct task *t)
 static void alsa_close(struct writer_node *wn)
 {
        struct private_alsa_data *pad = wn->private_data;
 static void alsa_close(struct writer_node *wn)
 {
        struct private_alsa_data *pad = wn->private_data;
+       PARA_INFO_LOG("closing writer node %p\n", wn);
        snd_pcm_drain(pad->handle);
        snd_pcm_close(pad->handle);
        snd_config_update_free_global();
        snd_pcm_drain(pad->handle);
        snd_pcm_close(pad->handle);
        snd_config_update_free_global();