Gst Tasks

Tim-Philipp Müller t.i.m at zen.co.uk
Wed Feb 8 04:24:23 PST 2012


On Fri, 2012-02-03 at 11:47 +0000, Neil Jones wrote:

> In the Core Reference Manual gst_task_join() is described as follows:
> "... The task will automatically be stopped with this call...." Is
> this true ?
> 
> should join() not wait for the task to finsh (due to someone or itself
> calling gst_task_stop), a bit like g_thread_join() ?
> 
> Also GstTask seems rather limited, Is it possible to use g_threads
> inside an element instead ?

GstTask is basically just a wrapper around GThread, but it gives you
some additional start/stop logic that's easy to get wrong or at least
tedious to write yourself. It also uses a task pool.

gst_task_join() does wait for the task to finish whatever it's currently
doing (i.e. it waits until the task gives back control from its task
function; tasks are built on the assumption that GstTask handles the
outer while (do_run) { task_iteration() } loop). gst_task_join() does
call _stop() internally. gst_task_stop() on the other hand just signals
the task to stop, but doesn't wait for it to do so.

Of course you can use GThread or whatever to start your own threads if
you find GstTask too limited. It depends a bit on the context though.
There is some GstTask integration in GstPad as well.

In what sense do you find GstTask limited? It's just a convenience
wrapper around GThread really.

 Cheers
  -Tim





More information about the gstreamer-devel mailing list