GstPushSrc needs to execute part of its _fill routine under the main thread.

Sebastian Dröge sebastian at centricular.com
Wed Dec 11 09:33:02 PST 2013


On Mi, 2013-12-11 at 12:13 -0500, Stirling Westrup wrote:
> I am currently working on an element that integrates QT and its port of
> WebKit into a source element that can be used for browsing.
> 
> I have run into a number of issues, mostly due to QT insisting that
> QApplication, QWebView and other objects run in the main program thread, or
> they crash.
> 
> I have managed to find ways around these issues for the most part, but have
> come across one that has me stumped. When filling out a buffer in the
> GstPushSrc _fill callback, I need to create a QImage from the buffer, and
> then call QWebView::render() on that QImage. The problem is that the _fill
> routines is called in a different thread than QWebView::render needs to be
> run in.
> 
> Ideally, I imagine a solution to this problem would be to have a
> non-blocking routine inserted into the main gst event loop, and each time
> around the loop that routine would check if there was rendering to do, and
> if so would perform the render operation.
> 
> Then the _fill routine would need to set things up for the render
> operation, somehow trigger the main event loop, and then wait on a 'done'
> signal of some sort.
> 
> Now, I have *NO IDEA* how to achieve this, or even if its a good idea. I
> fear that suspending the _fill routine in the middle and causing the
> event-loop to cycle could have all sorts of repercussions I know nothing
> about, but I've basically run out of other ideas.
> 
> I've tried everything I can think of, but the QWebView object *insists* on
> being run in the main thread.

You could trigger things to be called from the main thread from the
GStreamer threads, and in the GStreamer thread then wait until the main
thread has provided the results (make sure that the waiting can be
interrupted by GstBaseSrc::unlock() vfunc implementation).

In Qt IIRC you would do that with signals/slots, in GLib you would use
things like g_idle_add() (and that would also work on Qt if it is built
with GLib mainloop support).

-- 
Sebastian Dröge <sebastian at centricular.com>
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/20131211/c02c4610/attachment-0001.pgp>


More information about the gstreamer-devel mailing list