audiod: Kill noisy debug message.
[paraslash.git] / wmadec_filter.c
index 87de6b4..49f69b5 100644 (file)
@@ -1225,40 +1225,26 @@ static int wmadec_execute(struct btr_node *btrn, const char *cmd, char **result)
        return -ERRNO_TO_PARA_ERROR(ENOTSUP);
 }
 
-#define WMADEC_MAX_PENDING (640 * 1024)
-
-static void wmadec_pre_select(struct sched *s, struct task *t)
-{
-       struct filter_node *fn = container_of(t, struct filter_node, task);
-       size_t iqs = btr_get_input_queue_size(fn->btrn);
-
-       t->error = 0;
-       if (iqs == 0)
-               return;
-       if (btr_bytes_pending(fn->btrn) > WMADEC_MAX_PENDING)
-               return; /* FIXME, should use reasonable bound on timeout */
-       s->timeout.tv_sec = 0;
-       s->timeout.tv_usec = 1;
-}
-
 #define WMA_OUTPUT_BUFFER_SIZE (128 * 1024)
 
 static void wmadec_post_select(__a_unused struct sched *s, struct task *t)
 {
        struct filter_node *fn = container_of(t, struct filter_node, task);
-       int ret, converted = 0;
+       int ret, converted;
        struct private_wmadec_data *pwd = fn->private_data;
        struct btr_node *btrn = fn->btrn;
        size_t len;
        char *in;
 
 next_buffer:
+       converted = 0;
        t->error = 0;
-       ret = prepare_filter_node(btrn, fn->min_iqs);
+       ret = btr_node_status(btrn, fn->min_iqs, BTR_NT_INTERNAL);
        if (ret < 0)
                goto err;
        if (ret == 0)
                return;
+       btr_merge(btrn, fn->min_iqs);
        len = btr_next_buffer(btrn, (char **)&in);
        ret = -E_WMADEC_EOF;
        if (len < fn->min_iqs)
@@ -1279,7 +1265,7 @@ next_buffer:
        for (;;) {
                char *out;
                int out_size = WMA_OUTPUT_BUFFER_SIZE;
-               if (converted + WMA_FRAME_SKIP + pwd->ahi.block_align > len)
+               if (converted + fn->min_iqs > len)
                        break;
                out = para_malloc(WMA_OUTPUT_BUFFER_SIZE);
                ret = wma_decode_superframe(pwd, out,
@@ -1297,9 +1283,8 @@ success:
        goto next_buffer;
 err:
        assert(ret < 0);
-       wmadec_close(fn);
        t->error = ret;
-       btr_del_node(btrn);
+       btr_remove_node(btrn);
 }
 
 static ssize_t wmadec_convert(char *inbuffer, size_t len,
@@ -1357,6 +1342,6 @@ void wmadec_filter_init(struct filter *f)
        f->close = wmadec_close;
        f->convert = wmadec_convert;
        f->execute = wmadec_execute;
-       f->pre_select = wmadec_pre_select;
+       f->pre_select = generic_filter_pre_select;
        f->post_select = wmadec_post_select;
 }