From cafdd0a10e3ec387c7265ae6d50ee504ded4e056 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Thu, 1 Mar 2007 20:42:32 +0100 Subject: [PATCH] filter.c: Register tasks in proper order The order is important as it determines the order in which the pre_select functions are going to be called by the scheduler. In the previous code, the scheduler called stdin->pre_select _before_ filter_chain->pre_select() which gave rise to the following scenario (note that there's no filter_chain->post_select()): stdin->pre_select(): set stdin for reading filter_chain->pre_select(): nothing to do stdin->post_select(): read buffer stdin->pre_select(): do _not_ set stdin for reading as stdin buffer is full For para_filter, after the last there are no fds set which causes the scheduler to use the default timeout of 1s. This had the effect that decoding of aac files started only after a few seconds. With the roles of interchanged tasks the scenario is as follows: filter_chain->pre_select(): nothing to do stdin->pre_select(): set stdin for reading stdin->post_select(): read buffer filter_chain->pre_select(): convert buffer stdin->pre_select(): set stdin _again_ as stdin buffer is not full Alternative fix might be to use filter_pre_select() also for post_select. --- filter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/filter.c b/filter.c index d1f88539..ee08f28e 100644 --- a/filter.c +++ b/filter.c @@ -168,9 +168,9 @@ int main(int argc, char *argv[]) sot->loaded = fc->out_loaded; sot->input_eof = &fc->eof; - register_task(&sot->task); - register_task(&fc->task); register_task(&sit->task); + register_task(&fc->task); + register_task(&sot->task); s.default_timeout.tv_sec = 1; s.default_timeout.tv_usec = 0; ret = sched(&s); -- 2.39.5