[gst-devel] Scheduling changes and ideas

Erik Walthinsen omega at cse.ogi.edu
Wed Nov 29 23:42:22 CET 2000


I'm reworking the cothread scheduling code, as part of the changes to the
way sources work.  One of the changes is to actually make use of the
function pointer concept.  Previously, there was a single loopfunc_wrapper
that had a bunch of if's in it to determine what to do in the case of a
normal element, Src, or Connection.  This is rather inefficient, since it
has to make that decision as many as one time per iteration.

Instead, I'm construction several _wrapper's, specialized to each case.
The first two are gst_bin_pushsrc_wrapper and gst_bin_pullsrc_wrapper,
since those are the two cases of immediate interest.  The selection of
which of these to use occurs in create_plan, when setting the function for
the cothread.

In order to avoid confusion, I've renamed the pushfunc_wrapper and
pullfunc_wrapper functions to pushfunc_proxy and pullfunc_proxy, since all
they do is cause a cothread switch.

As for the _wrapper functions, they are given the standard argc/argv pair.
We cast the char **argv to a GstElement *, and ignore the argc.

In terms of the wrapper functions, I did some tests and found that, due to
a quirk of the cothreads or cosmic radiation or something, the function
handed to a cothread is effectively in an infinitely loop anyway.
However, this loop has extra overhead.  Therefore, it makes sense that all
_wrapper functions loop internally, to save that overhead.

The problem comes when we want to change the cothread function.  One
option is to make the _wrapper's internal 'infinite loop' predicated on a
bit that gets set to FALSE when there's a change in plan (literally,
create_plan changes something).

The problem is that there is currently no way to actually shut down and/or
restart a cothread without cooperation from the cothread.  This needs to
be fixed before we can have a completely robust create_plan setup.

         Erik Walthinsen <omega at cse.ogi.edu> - Staff Programmer @ OGI
        Quasar project - http://www.cse.ogi.edu/DISC/projects/quasar/
   Video4Linux Two drivers and stuff - http://www.cse.ogi.edu/~omega/v4l2/
        __
       /  \             SEUL: Simple End-User Linux - http://www.seul.org/
      |    | M E G A           Helping Linux become THE choice
      _\  /_                          for the home or office user







More information about the gstreamer-devel mailing list