audiod: kill close_writer()
[paraslash.git] / filter_chain.c
index 2510e49..5b87b08 100644 (file)
@@ -117,6 +117,10 @@ void filter_pre_select(__a_unused struct sched *s, struct task *t)
        char *ib;
        size_t *loaded;
        int conv, conv_total = 0;
+
+       t->ret = -E_FC_EOF;
+       if (*fc->output_eof)
+               goto err_out;
 again:
        ib = fc->inbuf;
        loaded = fc->in_loaded;
@@ -128,7 +132,7 @@ again:
                                fc, *loaded, fn->filter->name);
                        t->ret = fn->filter->convert(ib, *loaded, fn);
                        if (t->ret < 0)
-                               return;
+                               goto err_out;
                        call_callbacks(fn, ib, t->ret, fn->buf + old_fn_loaded,
                                fn->loaded - old_fn_loaded);
                        *loaded -= t->ret;
@@ -143,18 +147,19 @@ again:
                loaded = &fn->loaded;
        }
        conv_total += conv;
-       PARA_DEBUG_LOG("reader eof: %d, eof: %d out_loaded: %d, conv: %d, conv_total: %d\n", *fc->reader_eof,
-               fc->eof, *fc->out_loaded, conv, conv_total);
+       PARA_DEBUG_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;
        t->ret = 1;
-       if (!*fc->reader_eof)
+       if (!*fc->input_eof)
                return;
        if (*fc->out_loaded)
                return;
        if (*fc->in_loaded && conv_total)
                return;
        t->ret = -E_FC_EOF;
+err_out:
        fc->eof = 1;
 }