oggdec: Fix a thinko in post_select().
[paraslash.git] / oggdec_filter.c
index 7a52508ec8a7bdc0a2ad0d423f65c44d68b905c0..2f52d4d43b759765cc786fab0930e3b0fd91dc45 100644 (file)
@@ -97,11 +97,8 @@ static void ogg_open(struct filter_node *fn)
 {
        struct private_oggdec_data *pod = para_calloc(
                sizeof(struct private_oggdec_data));
-       struct oggdec_filter_args_info *conf = fn->conf;
 
        fn->private_data = pod;
-       fn->bufsize = conf->bufsize_arg * 1024;
-       fn->buf = para_malloc(fn->bufsize);
        fn->min_iqs = 8000;
 }
 
@@ -115,8 +112,6 @@ static void ogg_close(struct filter_node *fn)
                pod->vf = NULL;
        } else
                PARA_DEBUG_LOG("nothing to close\n");
-       free(fn->buf);
-       fn->buf = NULL;
        free(fn->private_data);
        fn->private_data = NULL;
 }
@@ -130,13 +125,13 @@ static int oggdec_execute(struct btr_node *btrn, const char *cmd, char **result)
 
        if (!strcmp(cmd, "samplerate")) {
                if (pod->samplerate == 0)
-                       return -ERRNO_TO_PARA_ERROR(ENAVAIL);
+                       return -E_BTR_NAVAIL;
                *result = make_message("%u", pod->samplerate);
                return 1;
        }
        if (!strcmp(cmd, "channels")) {
                if (pod->channels == 0)
-                       return -ERRNO_TO_PARA_ERROR(ENAVAIL);
+                       return -E_BTR_NAVAIL;
                *result = make_message("%u", pod->channels);
                return 1;
        }
@@ -248,7 +243,7 @@ static void ogg_post_select(__a_unused struct sched *s, struct task *t)
                if (read_ret < 0)
                        goto out;
                btr_add_output(out, read_ret, btrn);
-               if (btr_node_status(btrn, fn->min_iqs, BTR_NT_INTERNAL) == 0)
+               if (btr_get_output_queue_size(btrn) > 640 * 1024)
                        return; /* enough data for the moment */
        }
 out: