fix writer node group eof
authorAndre <maan@p133.(none)>
Mon, 29 May 2006 00:27:08 +0000 (02:27 +0200)
committerAndre <maan@p133.(none)>
Mon, 29 May 2006 00:27:08 +0000 (02:27 +0200)
The old code did not set the eof flag at all. This patch fixes the problem
and contains also some loglevel and log message text improvements.

audiod.c
filter_chain.c
mp3dec.c
ortp_recv.c
write_common.c

index c2abfd5..36e826c 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -737,7 +737,6 @@ static void open_receiver(int format)
        PARA_NOTICE_LOG("started %s: %s receiver in slot %d\n",
                audio_formats[s->format], a->receiver->name, slot_num);
        rn->task.private_data = s->receiver_node;
-       PARA_NOTICE_LOG("rn = %p\n", rn->task.private_data);
        rn->task.pre_select = a->receiver->pre_select;
        rn->task.post_select = a->receiver->post_select;
        rn->task.event_handler = rn_event_handler;
index 5b87b08..17f6705 100644 (file)
@@ -69,8 +69,11 @@ static void close_callbacks(struct filter_node *fn)
 {
        struct filter_callback *fcb, *tmp;
 
-       list_for_each_entry_safe(fcb, tmp, &fn->callbacks, node)
+       list_for_each_entry_safe(fcb, tmp, &fn->callbacks, node) {
+               PARA_INFO_LOG("closing %s filter callback\n",
+                       fn->filter->name);
                close_filter_callback(fcb);
+       }
 }
 
 static void call_callbacks(struct filter_node *fn, char *inbuf, size_t inlen,
@@ -138,7 +141,7 @@ again:
                        *loaded -= t->ret;
                        conv += t->ret;
                        if (*loaded && t->ret) {
-                               PARA_DEBUG_LOG("moving %zd bytes in input buffer for %s filter\n",
+                               PARA_INFO_LOG("moving %zd bytes in input buffer for %s filter\n",
                                        *loaded,  fn->filter->name);
                                memmove(ib, ib + t->ret, *loaded);
                        }
@@ -147,7 +150,7 @@ again:
                loaded = &fn->loaded;
        }
        conv_total += conv;
-       PARA_DEBUG_LOG("eof (in/out/fc): %d/%d/%d out_loaded: %d, conv: %d, conv_total: %d\n", *fc->input_eof,
+       PARA_INFO_LOG("eof (in/out/fc): %d/%d/%d out_loaded: %d, conv: %d, conv_total: %d\n", *fc->input_eof,
                *fc->output_eof, fc->eof, *fc->out_loaded, conv, conv_total);
        if (conv)
                goto again;
@@ -181,11 +184,10 @@ void close_filters(struct filter_chain *fc)
 
        if (!fc)
                return;
-       PARA_DEBUG_LOG("closing filter chain %p\n", fc);
+       PARA_NOTICE_LOG("closing filter chain %p\n", fc);
        list_for_each_entry_safe(fn, tmp, &fc->filters, node) {
-               PARA_NOTICE_LOG("closing %s filter callbacks (fc %p, fn %p)\n", fn->filter->name, fc, fn);
                close_callbacks(fn);
-               PARA_NOTICE_LOG("closing %s filter (fc %p, fn %p)\n", fn->filter->name, fc, fn);
+               PARA_INFO_LOG("closing %s filter\n", fn->filter->name);
                fn->filter->close(fn);
                list_del(&fn->node);
                free(fn);
index dd7887d..f809dae 100644 (file)
--- a/mp3dec.c
+++ b/mp3dec.c
@@ -98,8 +98,8 @@ next_frame:
 out:
        if (pmd->stream.next_frame) { /* we still have some data */
                size_t off = pmd->stream.bufend - pmd->stream.next_frame;
-               PARA_DEBUG_LOG("converted %zd, rate: %u, returning %zd\n", len - off,
-                       fn->fc->samplerate, copy - off);
+//             PARA_DEBUG_LOG("converted %zd, rate: %u, returning %zd\n", len - off,
+//                     fn->fc->samplerate, copy - off);
                return copy - off;
        }
        return copy;
index 99b53ad..60fb6b0 100644 (file)
@@ -106,7 +106,7 @@ static void ortp_recv_post_select(struct sched *s, struct task *t)
        char tmpbuf[CHUNK_SIZE + 3];
        unsigned chunk_time;
 
-//     PARA_DEBUG_LOG("rn: %p, pord: %p, session: %p\n", rn, pord, pord->session);
+//     PARA_INFO_LOG("rn: %p, pord: %p, session: %p\n", rn, pord, pord->session);
        t->ret = 1;
        if (pord->start.tv_sec)
                if (tv_diff(&s->now, &pord->next_chunk, NULL) < 0)
index 7fb8d12..cfdabe4 100644 (file)
@@ -45,9 +45,10 @@ static void wng_post_select(__a_unused struct sched *s, struct task *t)
                        min_written = PARA_MIN(min_written, t->ret);
        }
        *g->loaded -= min_written;
-       if (!*g->loaded && *g->input_eof)
+       if (!*g->loaded && *g->input_eof) {
+               g->eof = 1;
                t->ret = -E_WNG_EOF;
-       else
+       else
                t->ret = 1;
        if (*g->loaded && min_written)
                memmove(g->buf, g->buf + min_written, *g->loaded);
@@ -57,6 +58,7 @@ int wng_open(struct writer_node_group *g)
 {
        int i, ret = 1;
 
+       PARA_NOTICE_LOG("opening wng with %d writer(s)\n", g->num_writers);
        FOR_EACH_WRITER_NODE(i, g) {
                struct writer_node *wn = &g->writer_nodes[i];
                ret = wn->writer->open(wn);
@@ -92,6 +94,7 @@ void wng_close(struct writer_node_group *g)
 {
        int i;
 
+       PARA_NOTICE_LOG("closing wng with %d writer(s)\n", g->num_writers);
        FOR_EACH_WRITER_NODE(i, g) {
                struct writer_node *wn = &g->writer_nodes[i];
                unregister_task(&wn->task);