]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Merge branch 't/btr_improvements'
authorAndre Noll <maan@systemlinux.org>
Thu, 19 Jul 2012 16:46:58 +0000 (18:46 +0200)
committerAndre Noll <maan@systemlinux.org>
Thu, 19 Jul 2012 16:55:56 +0000 (18:55 +0200)
146316 btr_exec_up(): Also ask given node.
6d9c35 btr: Introduce btr_add_output_dont_free().
4ac313 btr: Remove btr_free_node().

Has been cooking in next for a week.

32 files changed:
NEWS
aacdec_filter.c
alsa_write.c
amp_filter.c
ao_write.c
audioc.c
audiod.c
buffer_tree.c
buffer_tree.h
client.c
client_common.c
compress_filter.c
dccp_recv.c
fecdec_filter.c
file_write.c
filter.c
flacdec_filter.c
grab_client.c
http_recv.c
interactive.c
mp3dec_filter.c
oggdec_filter.c
oss_write.c
osx_write.c
recv.c
spxdec_filter.c
stdin.c
stdout.c
udp_recv.c
wav_filter.c
wmadec_filter.c
write.c

diff --git a/NEWS b/NEWS
index 7fcf7f974a402907019cd0f0805a666cee3b603c..8f1b91da487d945548b1a8cb16fea0e07f6f40d6 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,16 +2,24 @@
 0.4.11 (to be announced) "mutual diversity"
 -------------------------------------------
 
+The major feature in this release is the new sideband API for
+client-server communication. This API will be used exclusively starting
+with 0.5.0, which breaks backward compatibility but allows to get rid
+of quite some compatibility code. Other noteworthy changes include
+decoder latency improvements and a long-standing bug fix for the
+ALSA writer.
+
        - Sideband connections: If both para_server and para_client
          support this feature, data is sent as a multiplexed stream.
        - The --no_default_filters option of para_filter has been
          removed.
        - Several fixes and latency improvements to various decoders.
-       - The alsa writer now limits the prebuffer time to 500ms.
+       - The ALSA writer now limits the prebuffer time to 500ms.
        - Documentation improvements.
        - Overhaul of the command_util.sh script.
        - Fixes for some minor problems found by the clang analyzer.
        - Compiles (almost) without warnings on gcc-3.
+       - Robustness improvements of the buffer tree code.
 
 ------------------------------------------
 0.4.10 (2012-03-30) "heterogeneous vacuum"
index a4414e8f49e0e3dea00b98ea60cec32eaa0235a5..c8b60925ee853de9dec170a733c2a06f35807453 100644 (file)
@@ -204,7 +204,7 @@ out:
 err:
        assert(ret < 0);
        t->error = ret;
-       btr_remove_node(btrn);
+       btr_remove_node(&fn->btrn);
 }
 
 /**
index 8c12c728e551035bd8eca071216e3c7e44060de5..2e096c0c78856e6d0691f31c5fcba768ab3a695d 100644 (file)
@@ -324,7 +324,7 @@ again:
        ret = -E_ALSA;
 err:
        assert(ret < 0);
-       btr_remove_node(btrn);
+       btr_remove_node(&wn->btrn);
        t->error = ret;
 }
 
index 3dc1e4117938f0c07d67f519e3cf076a51f4d52c..7e88cc495f2f805196c60ff45538050dc7c33338 100644 (file)
@@ -118,7 +118,7 @@ next_buffer:
 err:
        assert(ret < 0);
        t->error = ret;
-       btr_remove_node(btrn);
+       btr_remove_node(&fn->btrn);
 }
 
 static void amp_free_config(void *conf)
index 93861ab63f50baf478bf74fe6f216fce6cf39f53..a45d4fb946eea25087746fc786712229dae0dacc 100644 (file)
@@ -280,7 +280,6 @@ static void aow_post_select(__a_unused struct sched *s,
                struct task *t)
 {
        struct writer_node *wn = container_of(t, struct writer_node, task);
-       struct btr_node *btrn = wn->btrn;
        struct private_aow_data *pawd = wn->private_data;
        int ret;
 
@@ -288,14 +287,14 @@ static void aow_post_select(__a_unused struct sched *s,
                int32_t rate, ch, format;
                struct btr_node_description bnd;
 
-               ret = btr_node_status(btrn, wn->min_iqs, BTR_NT_LEAF);
+               ret = btr_node_status(wn->btrn, wn->min_iqs, BTR_NT_LEAF);
                if (ret < 0)
                        goto remove_btrn;
                if (ret == 0)
                        return;
-               get_btr_sample_rate(btrn, &rate);
-               get_btr_channels(btrn, &ch);
-               get_btr_sample_format(btrn, &format);
+               get_btr_sample_rate(wn->btrn, &rate);
+               get_btr_channels(wn->btrn, &ch);
+               get_btr_sample_format(wn->btrn, &format);
                ret = aow_init(wn, rate, ch, format);
                if (ret < 0)
                        goto remove_btrn;
@@ -303,7 +302,7 @@ static void aow_post_select(__a_unused struct sched *s,
 
                /* set up thread btr node */
                bnd.name = "ao_thread_btrn";
-               bnd.parent = btrn;
+               bnd.parent = wn->btrn;
                bnd.child = NULL;
                bnd.handler = NULL;
                bnd.context = pawd;
@@ -316,27 +315,24 @@ static void aow_post_select(__a_unused struct sched *s,
                return;
        }
        pthread_mutex_lock(&pawd->mutex);
-       ret = btr_node_status(btrn, wn->min_iqs, BTR_NT_LEAF);
+       ret = btr_node_status(wn->btrn, wn->min_iqs, BTR_NT_LEAF);
        if (ret > 0) {
-               btr_pushdown(btrn);
+               btr_pushdown(wn->btrn);
                pthread_cond_signal(&pawd->data_available);
        }
        pthread_mutex_unlock(&pawd->mutex);
        if (ret >= 0)
                goto out;
        pthread_mutex_lock(&pawd->mutex);
-       btr_remove_node(btrn);
-       btrn = NULL;
+       btr_remove_node(&wn->btrn);
        PARA_INFO_LOG("waiting for thread to terminate\n");
        pthread_cond_signal(&pawd->data_available);
        pthread_mutex_unlock(&pawd->mutex);
        pthread_join(pawd->thread, NULL);
 remove_thread_btrn:
-       btr_remove_node(pawd->thread_btrn);
-       btr_free_node(pawd->thread_btrn);
+       btr_remove_node(&pawd->thread_btrn);
 remove_btrn:
-       if (btrn)
-               btr_remove_node(btrn);
+       btr_remove_node(&wn->btrn);
 out:
        t->error = ret;
 }
index d3e092e29301f71e02948259483623e56967966f..3997001d13f3a66ac0b9c70d31771417b5acddfd 100644 (file)
--- a/audioc.c
+++ b/audioc.c
@@ -128,9 +128,7 @@ static void audioc_post_select(struct sched *s, struct task *t)
 out:
        if (ret < 0) {
                free(buf);
-               btr_remove_node(at->btrn);
-               btr_free_node(at->btrn);
-               at->btrn = NULL;
+               btr_remove_node(&at->btrn);
                close(at->fd);
        }
        t->error = ret;
index 93bc8da37c6e8cf16f550b9e88b8c6f2c0c5ef95..9f2aa5ab6960f08c9affdd919ae04b26f73b039c 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -381,7 +381,7 @@ static void close_receiver(int slot_num)
        PARA_NOTICE_LOG("closing %s receiver in slot %d\n",
                audio_formats[s->format], slot_num);
        a->receiver->close(s->receiver_node);
-       btr_free_node(s->receiver_node->btrn);
+       btr_remove_node(&s->receiver_node->btrn);
        free(s->receiver_node);
        s->receiver_node = NULL;
        tv_add(now, &(struct timeval)EMBRACE(0, 200 * 1000),
@@ -397,7 +397,7 @@ static void writer_cleanup(struct writer_node *wn)
        w = writers + wn->writer_num;
        PARA_INFO_LOG("closing %s\n", writer_names[wn->writer_num]);
        w->close(wn);
-       btr_free_node(wn->btrn);
+       btr_remove_node(&wn->btrn);
 }
 
 static void close_writers(struct slot_info *s)
@@ -434,7 +434,7 @@ static void close_filters(struct slot_info *s)
                f = filters + fn->filter_num;
                if (f->close)
                        f->close(fn);
-               btr_free_node(fn->btrn);
+               btr_remove_node(&fn->btrn);
        }
        free(s->fns);
        s->fns = NULL;
@@ -446,12 +446,12 @@ static void close_filters(struct slot_info *s)
  * task. Note that the scheduler checks t->error also _before_ each pre/post
  * select call, so the victim will never be scheduled again.
  */
-static void kill_btrn(struct btr_node *btrn, struct task *t, int error)
+static void kill_btrn(struct btr_node **btrnp, struct task *t, int error)
 {
        if (t->error < 0)
                return;
        t->error = error;
-       btr_remove_node(btrn);
+       btr_remove_node(btrnp);
 }
 
 static void kill_all_decoders(int error)
@@ -464,7 +464,7 @@ static void kill_all_decoders(int error)
                        continue;
                if (!s->receiver_node)
                        continue;
-               kill_btrn(s->receiver_node->btrn, &s->receiver_node->task,
+               kill_btrn(&s->receiver_node->btrn, &s->receiver_node->task,
                                error);
        }
 }
@@ -563,7 +563,7 @@ static int open_receiver(int format)
                EMBRACE(.name = r->name, .context = rn));
        ret = r->open(rn);
        if (ret < 0) {
-               btr_free_node(rn->btrn);
+               btr_remove_node(&rn->btrn);
                free(rn);
                return ret;
        }
@@ -1196,7 +1196,7 @@ static void status_post_select(struct sched *s, struct task *t)
                if (!st->ct)
                        goto out;
                if (st->ct->task.error >= 0) {
-                       kill_btrn(st->ct->btrn, &st->ct->task, -E_AUDIOD_OFF);
+                       kill_btrn(&st->ct->btrn, &st->ct->task, -E_AUDIOD_OFF);
                        goto out;
                }
                close_stat_pipe();
@@ -1218,7 +1218,7 @@ static void status_post_select(struct sched *s, struct task *t)
                        struct timeval diff;
                        tv_diff(now, &st->last_status_read, &diff);
                        if (diff.tv_sec > 61)
-                               kill_btrn(st->ct->btrn, &st->ct->task,
+                               kill_btrn(&st->ct->btrn, &st->ct->task,
                                        -E_STATUS_TIMEOUT);
                        goto out;
                }
@@ -1226,7 +1226,7 @@ static void status_post_select(struct sched *s, struct task *t)
                sz = btr_next_buffer(st->btrn, &buf);
                ret = for_each_stat_item(buf, sz, update_item);
                if (ret < 0) {
-                       kill_btrn(st->ct->btrn, &st->ct->task, ret);
+                       kill_btrn(&st->ct->btrn, &st->ct->task, ret);
                        goto out;
                }
                if (sz != ret) {
index 7d79636fac717f4e4cb8559dec698f8204eed34c..5756898bced710406b3c68b8cb1e5cc85a992183 100644 (file)
@@ -30,6 +30,8 @@ struct btr_buffer {
        int refcount;
        /* NULL means no buffer pool but a malloced buffer. */
        struct btr_pool *pool;
+       /* Only relevant if pool is NULL. */
+       bool dont_free;
 };
 
 struct btr_buffer_reference {
@@ -319,7 +321,7 @@ static void dealloc_buffer(struct btr_buffer *btrb)
 {
        if (btrb->pool)
                btr_pool_deallocate(btrb->pool, btrb->size);
-       else
+       else if (!btrb->dont_free)
                free(btrb->buf);
 }
 
@@ -392,6 +394,34 @@ void btr_add_output(char *buf, size_t size, struct btr_node *btrn)
        add_btrb_to_children(btrb, btrn, 0);
 }
 
+/**
+ * Insert a buffer into the buffer tree, non-freeing variant.
+ *
+ * \param buf See \ref btr_add_output().
+ * \param size See \ref btr_add_output().
+ * \param btrn See \ref btr_add_output().
+ *
+ * This is similar to btr_add_output() but additionally sets the \p dont_free
+ * flag on \a buf. If the refcount for the buffer drops to zero, \a buf will
+ * not be deallocated if this flag is set.
+ *
+ * The \p dont_free bit also prevents the children of \a btrn from modifying
+ * the buffer contents inplace. Specifically, \ref btr_inplace_ok() returns
+ * false if there is any buffer in the input queue with the \p dont_free bit
+ * set.
+ */
+void btr_add_output_dont_free(const char *buf, size_t size, struct btr_node *btrn)
+{
+       struct btr_buffer *btrb;
+
+       assert(size != 0);
+       if (list_empty(&btrn->children))
+               return;
+       btrb = new_btrb((char *)buf, size);
+       btrb->dont_free = true;
+       add_btrb_to_children(btrb, btrn, 0);
+}
+
 /**
  * Feed data to child nodes of a buffer tree node.
  *
@@ -544,9 +574,15 @@ bool btr_no_parent(struct btr_node *btrn)
  */
 bool btr_inplace_ok(struct btr_node *btrn)
 {
-       if (!btrn->parent)
-               return true;
-       return list_is_singular(&btrn->parent->children);
+       struct btr_buffer_reference *br;
+       FOR_EACH_BUFFER_REF(br, btrn) {
+               struct btr_buffer *btrb = br->btrb;
+               if (btrb->refcount > 1)
+                       return false;
+               if (btrb->dont_free == true)
+                       return false;
+       }
+       return true;
 }
 
 static inline size_t br_available_bytes(struct btr_buffer_reference *br)
@@ -729,44 +765,37 @@ void btr_drain(struct btr_node *btrn)
                btr_drop_buffer_reference(br);
 }
 
-/**
- * Free all resources allocated by btr_new_node().
- *
- * \param btrn Pointer to a btr node obtained by \ref btr_new_node().
- *
- * Like free(3), it is OK to call this with a \p NULL pointer argument.
- */
-void btr_free_node(struct btr_node *btrn)
-{
-       if (!btrn)
-               return;
-       free(btrn->name);
-       free(btrn);
-}
-
 /**
  * Remove a node from a buffer tree.
  *
- * \param btrn The node to remove.
+ * \param btrnp Determines the node to remove.
  *
- * This makes all child nodes of \a btrn orphans and removes \a btrn from the
- * list of children of its parent. Moreover, the input queue of \a btrn is
- * flushed if it is not empty.
+ * This orphans all children of the node given by \a btrnp and removes this
+ * node from the child list of its parent. Moreover, the input queue is flushed
+ * and the node pointer given by \a btrp is set to \p NULL.
  *
  * \sa \ref btr_splice_out_node.
  */
-void btr_remove_node(struct btr_node *btrn)
+void btr_remove_node(struct btr_node **btrnp)
 {
        struct btr_node *ch;
+       struct btr_node *btrn;
 
-       if (!btrn)
+       if (!btrnp)
                return;
+       btrn = *btrnp;
+       if (!btrn)
+               goto out;
        PARA_INFO_LOG("removing btr node %s from buffer tree\n", btrn->name);
        FOR_EACH_CHILD(ch, btrn)
                ch->parent = NULL;
        btr_drain(btrn);
        if (btrn->parent)
                list_del(&btrn->node);
+       free(btrn->name);
+       free(btrn);
+out:
+       *btrnp = NULL;
 }
 
 /**
@@ -849,37 +878,36 @@ size_t btr_get_output_queue_size(struct btr_node *btrn)
 }
 
 /**
- * Execute a inter-node command on a parent node.
+ * Execute a inter-node command on the given node or on a parent node.
  *
  * \param btrn The node to start looking.
  * \param command The command to execute.
  * \param value_result Additional arguments and result value.
  *
- * This function traverses the buffer tree upwards and looks for parent nodes
- * of \a btrn that understands \a command. On the first such node the command
- * is executed, and the result is stored in \a value_result.
+ * This function traverses the buffer tree from \a btrn upwards and looks for
+ * the first node that understands \a command. On this node \a command is
+ * executed, and the result is stored in \a value_result.
  *
  * \return \p -ENOTSUP if no parent node of \a btrn understands \a command.
  * Otherwise the return value of the command handler is returned.
+ *
+ * \sa \ref receiver::execute, filter::execute, writer::execute.
  */
 int btr_exec_up(struct btr_node *btrn, const char *command, char **value_result)
 {
        int ret;
 
        for (; btrn; btrn = btrn->parent) {
-               struct btr_node *parent = btrn->parent;
-               if (!parent)
-                       return -ERRNO_TO_PARA_ERROR(ENOTSUP);
-               if (!parent->execute)
+               if (!btrn->execute)
                        continue;
-               PARA_INFO_LOG("parent: %s, cmd: %s\n", parent->name, command);
-               ret = parent->execute(parent, command, value_result);
+               PARA_INFO_LOG("executing %s on %s\n", command, btrn->name);
+               ret = btrn->execute(btrn, command, value_result);
                if (ret == -ERRNO_TO_PARA_ERROR(ENOTSUP))
                        continue;
                if (ret < 0)
                        return ret;
                if (value_result && *value_result)
-                       PARA_INFO_LOG("%s(%s): %s\n", command, parent->name,
+                       PARA_INFO_LOG("%s(%s): %s\n", command, btrn->name,
                                *value_result);
                return 1;
        }
index a9890b9854b5bce2fce731a19d6cc44ba538c442..b0817759ee145dfd4ef7bb9ddcb5412b6d00b0fd 100644 (file)
@@ -182,9 +182,9 @@ void btr_copy(const void *src, size_t n, struct btr_pool *btrp,
        struct btr_node *btrn);
 
 struct btr_node *btr_new_node(struct btr_node_description *bnd);
-void btr_remove_node(struct btr_node *btrn);
-void btr_free_node(struct btr_node *btrn);
+void btr_remove_node(struct btr_node **btrnp);
 void btr_add_output(char *buf, size_t size, struct btr_node *btrn);
+void btr_add_output_dont_free(const char *buf, size_t size, struct btr_node *btrn);
 size_t btr_get_input_queue_size(struct btr_node *btrn);
 size_t btr_get_output_queue_size(struct btr_node *btrn);
 bool btr_no_parent(struct btr_node *btrn);
index f0f3b2617be6f3554250cedfafbbcc92c38f54b7..8e3e021d90249f44a0c655c493eb1198ed9f71cf 100644 (file)
--- a/client.c
+++ b/client.c
@@ -114,11 +114,11 @@ static int execute_client_command(const char *cmd, char **result)
                goto out;
        schedule(&command_sched);
        *result = exec_task.result_buf;
-       btr_remove_node(exec_task.btrn);
+       btr_remove_node(&exec_task.btrn);
        client_disconnect(ct);
        ret = 1;
 out:
-       btr_free_node(exec_task.btrn);
+       btr_remove_node(&exec_task.btrn);
        if (ret < 0)
                free(exec_task.result_buf);
        return ret;
@@ -619,7 +619,7 @@ out:
        if (ret < 0)
                PARA_ERROR_LOG("%s\n", para_strerror(-ret));
        client_close(ct);
-       btr_free_node(sit.btrn);
-       btr_free_node(sot.btrn);
+       btr_remove_node(&sit.btrn);
+       btr_remove_node(&sot.btrn);
        return ret < 0? EXIT_FAILURE : EXIT_SUCCESS;
 }
index 649a1b4fdf49579e653d7b6cd6d9c977524e6171..a4aa6d8c3ecc3ae386cbb14515f05f8257d96e0d 100644 (file)
@@ -48,8 +48,7 @@ void client_disconnect(struct client_task *ct)
        ct->scc.recv = NULL;
        sc_free(ct->scc.send);
        ct->scc.send = NULL;
-       btr_free_node(ct->btrn);
-       ct->btrn = NULL;
+       btr_remove_node(&ct->btrn);
 }
 
 /**
@@ -562,7 +561,7 @@ out:
                if (!ct->use_sideband && ret != -E_SERVER_EOF &&
                                ret != -E_BTR_EOF && ret != -E_EOF)
                        PARA_ERROR_LOG("%s\n", para_strerror(-t->error));
-               btr_remove_node(btrn);
+               btr_remove_node(&ct->btrn);
        }
 }
 
index 74ea59f3ada85e6e10bba6f0d015d6bc8dbc3dd1..3dee5ccd1e62e5e5e155e717b44bf7dd408ffdfb 100644 (file)
@@ -109,7 +109,7 @@ next_buffer:
 err:
        assert(ret < 0);
        t->error = ret;
-       btr_remove_node(btrn);
+       btr_remove_node(&fn->btrn);
 }
 
 /** TODO: Add sanity checks */
index 21c69322715572758697c2573e62bbfd5de6665c..ea6884b16a1ffcda3002eb6b6340b2cff257b7be 100644 (file)
@@ -151,7 +151,7 @@ static void dccp_recv_post_select(struct sched *s, struct task *t)
 out:
        if (ret >= 0)
                return;
-       btr_remove_node(rn->btrn);
+       btr_remove_node(&rn->btrn);
        t->error = ret;
 }
 
index aea32bfdb8976180dd6aa34f21766c272097973d..945e3e9dbed587c873009965dbf2e87d6b10345f 100644 (file)
@@ -470,7 +470,7 @@ next_buffer:
 out:
        t->error = ret;
        if (ret < 0)
-               btr_remove_node(btrn);
+               btr_remove_node(&fn->btrn);
 }
 
 static void fecdec_open(struct filter_node *fn)
index 5c5c5149ab4d27f7f8853df6a47833948da30f74..98d15a439ecc8eb154dd5f56ce57acbae0fcc6ba 100644 (file)
@@ -129,7 +129,7 @@ static void file_write_post_select(__a_unused struct sched *s,
        btr_consume(btrn, ret);
 out:
        if (ret < 0)
-               btr_remove_node(btrn);
+               btr_remove_node(&wn->btrn);
        t->error = ret;
 }
 
index 81258a6a12b51459d21ec00bad628bae009fa015..55b48ea257a99a618968bf79c91097e88ecf4dae 100644 (file)
--- a/filter.c
+++ b/filter.c
@@ -161,13 +161,13 @@ out_cleanup:
                f = filters + fn->filter_num;
                if (f->close)
                        f->close(fn);
-               btr_free_node(fn->btrn);
+               btr_remove_node(&fn->btrn);
                free(fn->conf);
                free(fn);
        }
        free(fns);
-       btr_free_node(sit->btrn);
-       btr_free_node(sot->btrn);
+       btr_remove_node(&sit->btrn);
+       btr_remove_node(&sot->btrn);
 out:
        if (ret < 0)
                PARA_EMERG_LOG("%s\n", para_strerror(-ret));
index e8baa6b4b35031205f4fb28d858a6c1593e7ae7e..dfd90213234e5733ee0b9c3cfb29de390368d285 100644 (file)
@@ -257,7 +257,7 @@ static void flacdec_post_select(__a_unused struct sched *s, struct task *t)
 out:
        t->error = ret;
        if (ret < 0)
-               btr_remove_node(btrn);
+               btr_remove_node(&fn->btrn);
 }
 
 static void flacdec_close(struct filter_node *fn)
index 07f779bd172ac5f83f78d53e133881b94cc54ef3..2b8c8d3e3d8e947789aa32c049403204948c1dc9 100644 (file)
@@ -166,9 +166,7 @@ void activate_grab_clients(struct sched *s)
 
 static int gc_close(struct grab_client *gc, int err)
 {
-       btr_remove_node(gc->btrn);
-       btr_free_node(gc->btrn);
-       gc->btrn = NULL;
+       btr_remove_node(&gc->btrn);
        PARA_INFO_LOG("closing gc: %s\n", para_strerror(-err));
        list_move(&gc->node, &inactive_grab_client_list);
        if (err == -E_GC_WRITE || (gc->flags & GF_ONE_SHOT)) {
index b4bf1530d811fefb04c4f5b107e752e45d8e9048..11602f9544e34c36eb54763852d1d5cf63d7f2cc 100644 (file)
@@ -128,7 +128,7 @@ static void http_recv_post_select(struct sched *s, struct task *t)
 out:
        if (ret >= 0)
                return;
-       btr_remove_node(rn->btrn);
+       btr_remove_node(&rn->btrn);
        t->error = ret;
 }
 
index f9ea3612ee8a1b0e80bef508051ed737b9a0ba05..68891ac10a4f0a48e491a0eaf2c82033a36335ae 100644 (file)
@@ -298,9 +298,7 @@ static void i9e_post_select(struct sched *s, struct task *t)
        btr_consume(btrn, ret);
        goto out;
 rm_btrn:
-       btr_remove_node(btrn);
-       btr_free_node(btrn);
-       i9ep->stdout_btrn = NULL;
+       btr_remove_node(&i9ep->stdout_btrn);
        rl_set_prompt(i9ep->ici->prompt);
        rl_forced_update_display();
 out:
index 6955a7423650f3b929b807b6184221d5b5773717..b58c694b4c31040c97284d9684067dcb6df90f71 100644 (file)
@@ -166,7 +166,7 @@ decode:
 err:
        assert(ret < 0);
        t->error = ret;
-       btr_remove_node(btrn);
+       btr_remove_node(&fn->btrn);
 }
 
 static void mp3dec_open(struct filter_node *fn)
index 9498313c6ca42cb1cbe2c3e792b88f8f381d1d14..c5c0b538cd739c6d7168d6125d5e5562e476cb9b 100644 (file)
@@ -259,7 +259,7 @@ static void ogg_post_select(__a_unused struct sched *s, struct task *t)
 out:
        t->error = ret;
        if (ret < 0)
-               btr_remove_node(btrn);
+               btr_remove_node(&fn->btrn);
 }
 
 /**
index eae4167a18503b2cc8014a5069b53ce8c8eb9677..1d9add7b9a296e5a8d9750c77fa1f28a77894453 100644 (file)
@@ -199,7 +199,7 @@ static void oss_post_select(__a_unused struct sched *s,
 out:
        t->error = ret;
        if (ret < 0)
-               btr_remove_node(btrn);
+               btr_remove_node(&wn->btrn);
 }
 
 __malloc static void *oss_parse_config_or_die(const char *options)
index 0f9d9605926a81fa5be0c4643ca6565fbe0391c2..2c6fd0d2ef3867d5ad5e1e6d37db9e3b0083722c 100644 (file)
@@ -309,10 +309,9 @@ static void osx_write_post_select(__a_unused struct sched *s, struct task *t)
        AudioOutputUnitStop(powd->audio_unit);
        AudioUnitUninitialize(powd->audio_unit);
        CloseComponent(powd->audio_unit);
-       btr_remove_node(powd->callback_btrn);
-       btr_free_node(powd->callback_btrn);
+       btr_remove_node(&powd->callback_btrn);
 remove_btrn:
-       btr_remove_node(btrn);
+       btr_remove_node(&wn->btrn);
        PARA_NOTICE_LOG("%s\n", para_strerror(-ret));
 out:
        t->error = ret;
diff --git a/recv.c b/recv.c
index f14ea2876fba05a4b8196c4dcafbcf968de32644..c021b17bdbefdbcc7e562f496b6ae14917d3d681 100644 (file)
--- a/recv.c
+++ b/recv.c
@@ -112,10 +112,11 @@ int main(int argc, char *argv[])
 out:
        if (r_opened)
                r->close(&rn);
-       btr_free_node(rn.btrn);
-       btr_free_node(sot.btrn);
+       btr_remove_node(&rn.btrn);
+       btr_remove_node(&sot.btrn);
        if (rn.conf)
                r->free_config(rn.conf);
+
        if (ret < 0)
                PARA_ERROR_LOG("%s\n", para_strerror(-ret));
        return ret < 0? EXIT_FAILURE : EXIT_SUCCESS;
index e54b2657d02650bdd33e22b730ee7c0a71f051eb..9a827d53a9c37aa8e5f25ccdd69609301ee82c20 100644 (file)
@@ -292,7 +292,7 @@ next_buffer:
 fail:
        if (ret < 0) {
                t->error = ret;
-               btr_remove_node(btrn);
+               btr_remove_node(&fn->btrn);
        }
 }
 
diff --git a/stdin.c b/stdin.c
index ac1581d12f22a473919633d2e8a5f213c55e2202..8dce76b56e396e1f1bccc0bb9be6edfa1179b6f2 100644 (file)
--- a/stdin.c
+++ b/stdin.c
@@ -83,7 +83,7 @@ static void stdin_post_select(struct sched *s, struct task *t)
        if (ret >= 0)
                return;
 err:
-       btr_remove_node(sit->btrn);
+       btr_remove_node(&sit->btrn);
        //btr_pool_free(sit->btrp);
        t->error = ret;
 }
index abe7abc98df759af034872be4d65ed9a30133207..066f1af77e4ea0784221ee411a2548df0e9ce630 100644 (file)
--- a/stdout.c
+++ b/stdout.c
@@ -75,7 +75,7 @@ static void stdout_post_select(struct sched *s, struct task *t)
        }
 out:
        if (ret < 0)
-               btr_remove_node(btrn);
+               btr_remove_node(&sot->btrn);
        t->error = ret;
 }
 /**
index c1f238308b58bab556434f57171be30db92944f2..615553c586064ed39bfb29e31c3c8fff18faf852 100644 (file)
@@ -83,7 +83,7 @@ static void udp_recv_post_select(__a_unused struct sched *s, struct task *t)
 out:
        if (ret >= 0)
                return;
-       btr_remove_node(btrn);
+       btr_remove_node(&rn->btrn);
        t->error = ret;
        close(rn->fd);
        rn->fd = -1;
index c5079061972d838d1e76d0308db02cd61e341998..e8630f9e203a3981f7ac1a83d361df590466c501 100644 (file)
@@ -117,7 +117,7 @@ err:
        if (ret == -E_WAV_SUCCESS)
                btr_splice_out_node(btrn);
        else {
-               btr_remove_node(btrn);
+               btr_remove_node(&fn->btrn);
                PARA_ERROR_LOG("%s\n", para_strerror(-ret));
        }
 }
index 220dc40c22a0810d6ff7ac4484b7ea09e3346a67..20f9df44b92b35061980d857f86c9ccee40b4bcd 100644 (file)
@@ -1267,7 +1267,7 @@ success:
 err:
        assert(ret < 0);
        t->error = ret;
-       btr_remove_node(btrn);
+       btr_remove_node(&fn->btrn);
 }
 
 static void wmadec_open(struct filter_node *fn)
diff --git a/write.c b/write.c
index a8e2429ce0f8a659492e3f29fcf4d504318fce4d..de73000815e092440de3b0475bc451aa0444e996 100644 (file)
--- a/write.c
+++ b/write.c
@@ -143,7 +143,7 @@ pushdown:
 out:
        t->error = ret;
        if (ret < 0)
-               btr_remove_node(btrn);
+               btr_remove_node(&cwt->btrn);
 }
 
 static int loglevel;
@@ -253,12 +253,12 @@ static int setup_and_schedule(void)
                struct writer *w = writers + wn->writer_num;
 
                w->close(wn);
-               btr_free_node(wn->btrn);
+               btr_remove_node(&wn->btrn);
                w->free_config(wn->conf);
                free(wn->conf);
        }
        free(wns);
-       btr_free_node(cwt->btrn);
+       btr_remove_node(&cwt->btrn);
        return ret;
 }