[gst-devel] About thread module in the gstreamer framework

Edward Hervey bilboed at gmail.com
Mon Jun 26 08:03:05 CEST 2006


On 6/24/06, huang zongming <hzm_fly at hotmail.com> wrote:
> Hi, folks;
> Now , i am want to know the thread module in the gstreamer framework, and i
> had know some points about thread modle.

  First of all, application/plugin developers shouldn't have to *know*
about threads. They are hidden in GStreamer core so that you don't
have to worry about them.

> Some results following as:
> When during run "gst-launch fakesrc num-buffers=100000 ! fakesink", i check
> thread about gst-launch using "ps aux", i found , those are four threads in
> the gst-launch
> 1: in the gstbin.c , at line 2074, g_thread_pool_push (klass->pool, bin,
> NULL), i know, it will create first thread , i think, it is pipeline thread
> , it is a main thread , right?

  That's the message bus (See the GstBus documentation), which is used
to send messages in a threadsafe way to the application.

> 2: i know , in the fakesrc.c, it will create one thread to push buffer data
> to down element, right?

  That thread is in fact the source pad task (see 4.)

> 3:in the gstsystemclock.c, at line 130,   clock->thread = g_thread_create
> ((GThreadFunc) gst_system_clock_async_thread,
>       clock, TRUE, &error);,  i think, this thread used to control
> clock,some sync function, right?


> 4: in the gsttask.c, at line 371,  g_thread_pool_push (tclass->pool, task,
> NULL);, it will create other thread, i do not know, why create this thread
> using task which is reated by the pad? could explian those?

  See the GstTask documentation. Task are threads which are created on
the pads to 'drive' the pipeline data flow. A normal pipeline (fakesrc
! fakesink) only has one thread that pushes the data (the task on the
basesrc source pad). Tasks are an easier way to use threads for

> All, do you think those?
> please confirm those if you know those in detail, i think, i maybe do not
> understand clearly.

  I'm repeating myself, but in most cases you shoudn't have to worry
about threads. If you do, you're doing a very special element, in
which case you might want to tell us more about it so we can confirm
if you need tasks or not.
  You will also find more information about how the
scheduling/threading is meant to work in the design document contained
in the source code of gstreamer core (gstreamer/docs/design/)

> thanks
> hzm


> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel

Edward Hervey
Junior developer / Fluendo S.L.

More information about the gstreamer-devel mailing list