GstPushSrc needs to execute part of its _fill routine under the main thread.
Stirling Westrup
swestrup at gmail.com
Fri Dec 13 09:51:50 PST 2013
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!
--
Stirling Westrup
Programmer, Entrepreneur.
https://www.linkedin.com/e/fpf/77228
http://www.linkedin.com/in/swestrup
http://technaut.livejournal.com
http://sourceforge.net/users/stirlingwestrup
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20131213/d2b40457/attachment.html>
More information about the gstreamer-devel
mailing list