Problem with context sharing (glupload) with an OVR thread (Oculus Mobile SDK)

jeremi.wojcicki jeremi.wojcicki at gmail.com
Wed Feb 21 17:52:35 UTC 2018


Success!


>> Maybe the problem is not really in it. It is possible to set the context
>> just upon element creation, right? Maybe it would be better to focus on
>> this
>> solution.
> 
> This solution is effectively, create the GstContext containing the
> GstGLDisplay/GstGLContext and then call gst_element_set_context() on the
> pipeline before you start the pipeline.

Following this suggestion I put:

    GstContext *app_context = gst_context_new ("gst.gl.app_context", TRUE);
    GstStructure *s = gst_context_writable_structure (app_context);
    gst_structure_set (s, "context", GST_GL_TYPE_CONTEXT, data->gst_context,
NULL);
    gst_element_set_context (GST_ELEMENT (data->upload), app_context);

    GstContext *display_context = gst_context_new
(GST_GL_DISPLAY_CONTEXT_TYPE, TRUE);
    gst_context_set_gl_display (display_context, data->gst_display);
    gst_element_set_context (GST_ELEMENT (data->upload), display_context);

before starting pipeline and context is correctly shared! thanks a lot for
all the guidance.

Looking back at the problem I notice the following:
 - Originally issue was caused by the fact that I had an asynchronous bus
handler (which I guess was not suitable). It somehow worked in the simple
tutorial-3 case but not in the OVR code => possibly some race condition
occurs with async, right?
- I substituted async with sync handler ONLY, but interestingly no
"need-context" message appears there, only some state-change messages
arrive. Having the messy implementation with both handlers showed that need
context appears only in async. This problem remains unfixed and I do not
know what is the reason.
- Using the alternative of applying context before pipeline starts works
flawlessly and is the best solution for me, given circumstances.




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/


More information about the gstreamer-devel mailing list