From 807e530e7dc6cf3b5bc5e241d00983647724bd52 Mon Sep 17 00:00:00 2001 From: Andre Date: Mon, 29 May 2006 02:27:08 +0200 Subject: [PATCH] fix writer node group eof 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 | 1 - filter_chain.c | 14 ++++++++------ mp3dec.c | 4 ++-- ortp_recv.c | 2 +- write_common.c | 7 +++++-- 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/audiod.c b/audiod.c index c2abfd5a..36e826c0 100644 --- 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; diff --git a/filter_chain.c b/filter_chain.c index 5b87b087..17f67058 100644 --- a/filter_chain.c +++ b/filter_chain.c @@ -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); diff --git a/mp3dec.c b/mp3dec.c index dd7887d5..f809daec 100644 --- 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; diff --git a/ortp_recv.c b/ortp_recv.c index 99b53ad0..60fb6b0e 100644 --- a/ortp_recv.c +++ b/ortp_recv.c @@ -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) diff --git a/write_common.c b/write_common.c index 7fb8d123..cfdabe48 100644 --- a/write_common.c +++ b/write_common.c @@ -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); -- 2.39.5