Open the filters from within audiod_pre_select()
authorAndre <maan@p133.(none)>
Sun, 28 May 2006 19:12:35 +0000 (21:12 +0200)
committerAndre <maan@p133.(none)>
Sun, 28 May 2006 19:12:35 +0000 (21:12 +0200)
audiod.c

index 5e8cf2b..60e7903 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -616,6 +616,7 @@ static void open_filters(int slot_num)
        s->fc = NULL;
        if (!nf)
                return;
+       PARA_INFO_LOG("opening %s filters\n", audio_formats[s->format]);
        s->fc = para_calloc(sizeof(struct filter_chain));
        INIT_LIST_HEAD(&s->fc->filters);
        s->fc->inbuf = s->receiver_node->buf;
@@ -688,14 +689,12 @@ static void wng_event_handler(struct task *t)
        }
 }
 
-static void start_stream_writer(int slot_num, struct timeval *now)
+static void open_writer(int slot_num, struct timeval *now)
 {
        int ret, i;
        struct slot_info *s = &slot[slot_num];
        struct audio_format_info *a = &afi[s->format];
 
-       PARA_INFO_LOG("opening %s filters\n", audio_formats[s->format]);
-       open_filters(slot_num);
        PARA_INFO_LOG("opening %s writers\n", audio_formats[s->format]);
        if (!a->num_writers)
                s->wng = setup_default_wng();
@@ -945,8 +944,8 @@ static void audiod_pre_select(struct sched *s, __a_unused struct task *t)
                        continue;
                rn = slot[i].receiver_node;
                if (rn && rn->loaded && !slot[i].wng) {
-                       PARA_INFO_LOG("no writer in slot %d\n", i);
-                       start_stream_writer(i, &s->now);
+                       open_filters(i);
+                       open_writer(i, &s->now);
                }
        }
 }