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.
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);