Using an appsink to provide a clock

chad hanna channa at perimeterinstitute.ca
Tue Apr 12 07:44:36 PDT 2011


I would like to have multiple branches in a pipeline arrive at the application
as "synced" as possible without placing any restriction on how fast the
pipeline executes.  In this simple example I have a pipeline with two src
elements and two appsinks. (needs monospaced  font :)

+++++++            +++++++++++
| src |  ------->  | appsink |
+++++++            +++++++++++

+++++++            +++++++++++
| src |  ------->  | appsink |
+++++++            +++++++++++


The src elements produce buffers of different sizes and possibly even different
rates.  If I set sync=False on the appsinks both src elements and appsinks will
merrily progress.  In terms of stream time one will get ahead of the other, and
before long be very far ahead.  If I turn on sync=True but do not provide any
clock it defaults to the system clock.  This in fact has the effect of forcing
the buffers to arrive well synced.  However, it has the negative effect of also
forcing the pipeline to run at the pace of the system clock.  What I would like
is to have the pipeline run as fast as possible with the constraint that the
elements stay synced.  I had thought to do this by somehow having one of the
appsinks provide a clock for the pipeline that basically used the timestamps of
the incoming buffer to work out the clock time.  That way the other appsinks
wouldn't get ahead but presumably the pipeline will run much faster than "real
time".  Does anyone have any suggestions for me?  I would be greatful
specifically of pointers on how to do this easily in python.  Do I subclass
system clock? How do I make appsink provide a clock? Is a different
approach altogether needed?

Thanks for your help,

Chad



Chad Hanna
Perimeter Institute for Theoretical Physics
31 Caroline St. N.
Waterloo, Ontario, Canada N2L 2Y5
Ph: (519) 569-7600 x7511


More information about the gstreamer-devel mailing list