GstPushSrc needs to execute part of its _fill routine under the main thread.
Sebastian Dröge
sebastian at centricular.com
Fri Dec 13 09:55:15 PST 2013
On Fr, 2013-12-13 at 12:51 -0500, Stirling Westrup wrote:
> On Wed, Dec 11, 2013 at 12:33 PM, Sebastian Dröge
> <sebastian at centricular.com> wrote:
> On Mi, 2013-12-11 at 12:13 -0500, Stirling Westrup wrote:
>
>
> > 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.
>
>
> 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).
>
>
> Thanks! Your advice pushed me in the right direction. I built a custom
> event queue out of a pipe, and turned it into a GSource to register
> with the main gstreamer loop. Now in my _fill routine I send a
> 'Render' event down the pipe and wait on a 'completion' signal. When
> the GSource wakes up, it calls a callback in my element that decodes
> the Render event, performs the render operation, and signals
> completion, all of the above protected with the appropriate semphores
> and locks.
>
>
> Was a bit convoluted to write, but it works like a charm!
Great to hear :) You could also take a look at the WebKit GStreamer
video sink, it does something very similar too.
Note that using a GSource only works as long as Qt is compiled with GLib
mainloop support. On Windows and OSX this is not the default IIRC.
--
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/20131213/5eef994c/attachment.pgp>
More information about the gstreamer-devel
mailing list