g_signal_connect context

Sebastian Dröge sebastian at centricular.com
Thu May 8 23:32:42 PDT 2014


On Fr, 2014-05-09 at 00:50 +0530, Yogesh Tyagi wrote:
> Hi,
> 
> Does g_signal_connect run in pipeline context? I want to add a probe to src
> pad of my element and emit a signal from this probe handler.Upon receiving
> this signal, application is supposed to do state change of this element.
> Will it be a valid implementation?

g_signal_connect() runs in the context where you call it, and in general
the signals are fired from an arbitrary thread (the one where the object
fires the signal), so your callbacks also have to handle that. Usually
this thread will be the streaming thread of the relevant part of the
pipeline.

There are some exceptions for that though, most notably the "message"
signal on GstBus. This will be fired from the thread that runs the main
loop for the context that was the thread default when you created the
signal watch of the bus:
https://developer.gnome.org/glib/stable/glib-The-Main-Event-Loop.html#g-main-context-get-thread-default
So usually your application's main thread.

-- 
Sebastian Dröge, Centricular Ltd - http://www.centricular.com
Expertise, Straight from the Source
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 966 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20140509/c34cc080/attachment.sig>


More information about the gstreamer-devel mailing list