Details
-
Bug
-
Resolution: Won't Do
-
P4: Low
-
None
-
5.15.15
Description
All of the following needs to be true:
- Desktop platform (X11 or wayland)
- Qt5 EGL build (config -opengl es2 -egl)
- Gstreamer backend for QtMultimedia
- Video app with forced (QT_GSTREAMER_USE_OPENGL_PLUGIN=1) OpenGL rendering (zero-copy)
In this case the wrong gstreamer integration is picked and only black video frames are shown. There might also be a warning "Could not create display context: Cannot share context with non-GLX context".
This can be fixed with:
--- a/src/gsttools/qgstvideorenderersink.cpp +++ b/src/gsttools/qgstvideorenderersink.cpp @@ -328,8 +328,14 @@ static GstGLContext *gstGLDisplayContext(QAbstractVideoSurface *surface) GstGLPlatform glPlatform = GST_GL_PLATFORM_EGL; QPlatformNativeInterface *pni = QGuiApplication::platformNativeInterface(); +#if GST_GL_HAVE_PLATFORM_EGL + Qt::HANDLE eglDisplay = pni->nativeResourceForIntegration("egldisplay"); + if (eglDisplay) + display = (GstGLDisplay *)gst_gl_display_egl_new_with_egl_display(eglDisplay); +#endif + #if GST_GL_HAVE_WINDOW_X11 - if (platform == QLatin1String("xcb")) { + if (!display && platform == QLatin1String("xcb")) { if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) { contextName = "glxcontext"; glPlatform = GST_GL_PLATFORM_GLX; @@ -340,13 +346,6 @@ static GstGLContext *gstGLDisplayContext(QAbstractVideoSurface *surface) } #endif -#if GST_GL_HAVE_PLATFORM_EGL - if (!display && platform == QLatin1String("eglfs")) { - display = (GstGLDisplay *)gst_gl_display_egl_new_with_egl_display( - pni->nativeResourceForIntegration("egldisplay")); - } -#endif - #if GST_CHECK_VERSION(1,11,1) #if GST_GL_HAVE_WINDOW_WAYLAND if (!display && platform.startsWith(QLatin1String("wayland"))) {
The question remains, whether this should still be upstreamed.