GNOME Bugzilla – Bug 790124
playbin3: NEED_CONTEXT events not propagated to app when creating sinks
Last modified: 2018-11-03 12:01:45 UTC
Some sinks can require an external context from the application, for example waylandsink and glimagesink require a wayland display or gl display handle when going from NULL to READY. However, in playbin3 the sinks are created by playsink, which first tries to set the element state to READY. Since the element is still orphaned at this point, the NEED_CONTEXT messages are not propagated to the message bus, and thus the app (or playbin) cannot reply with a proper context. This means it is impossible to properly embed waylandsink or glimagesink in an application using playbin3. Note that this only seems to happen with playbin3: playbin2 creates the sink in the autoplug-select signal, and it correctly assigns a bus handler first before setting the sink to READY, and playsink uses the sink provided by playbin2. In playbin3 apparently the autoplug-select signal is not used.
Can't we just put it back to NULL, add it, and then sync it's state ?
That would work but it would create a gl or wayland context for nothing. I'm not sure what the plan is to replace the autoplug-select and other signals in playbin3, but the new mechanism that will be implemented should fix this issue.
isn't this automatic these days ? i.e. when you add an element to a bin the context is set on it.
This is a special case. We are required to have a context to pass to ready state for autoplugging. So yes, it's automatic if the element is parented when set to ready. According to the report, it's not. Note that context sharing also go through pads, so not being linked also limit how well the context propagates.
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/401.