[gst-devel] how to make gstreamer run in separate thread

Edward Hervey bilboed at gmail.com
Mon May 3 09:32:51 CEST 2010


On Sun, 2010-05-02 at 17:20 +0400, Gregory Petrosyan wrote:
> On Sun, Apr 25, 2010 at 10:35 PM, Alexey Chernov <4ernov at gmail.com> wrote:
> > Thank you guys for support, I finally managed to make gstreamer process
> > callbacks in separate thread. The solution was to set bus handler with
> > gst_bus_set_sync_handler() instead of gst_bus_add_watch() as wl2776 proposed,
> > special thanks for him. So here're some things which I found out from this
> > case:
> > 1. Qt actually dispatches glib events and no additional g_main_loop_run() is
> > necessary for Qt applications.
> > 2. Qt seems to create separate glib context for glib objects which are created
> > in separate QThread objects.
> > 3. To make callbacks be called in separate thread where the certain gst
> > objects were created you need to set them as a handler with
> > gst_bus_set_sync_handler() to make them processed in the context of certain
> > objects and not in the main context.
> 
> Hi!
> 
> I'm also trying to use GStreamer with Qt, and I'm experiencing some
> weird problems.
> 
> 1) I'm not sure if Qt dispatches glib events (on Windows, at least):
> gst_bus_add_watch()'ed callback is never called

  Use gst_bus_add_signal_watch(bus) and then connect to the 'message'
event of the bus. If Qt is built with glib and uses the GMainLoop
internally, the message signal will be emitted in the main thread.

> 2) gst_bus_set_sync_handler() works, but events that I send from it
> (using Qt::QueuedConnection) seem to never reach the main loop, and I
> don't even know how to debug this

  It's a *synchronous* handler, therefore the callback you set will be
called in the thread context of whoever emitted that message.

> 
> If anybody can help me with these issues, it will be greatly appreciated.
> 
>                 Gregory
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel






More information about the gstreamer-devel mailing list