[Bug 761003] Error getting OpenGL context when qml item when scene graph is initialized.

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Tue Feb 16 15:13:23 UTC 2016


https://bugzilla.gnome.org/show_bug.cgi?id=761003

--- Comment #6 from Sergey Borovkov <serge.borovkov at gmail.com> ---
Comment on attachment 321399
  --> https://bugzilla.gnome.org/attachment.cgi?id=321399
Return old node when there is no initialized context yet

>From 6d311dc9954670e0224a928c24bf7c325668bea4 Mon Sep 17 00:00:00 2001
From: Sergey Borovkov <sergey.borovkov at wireload.net>
Date: Tue, 16 Feb 2016 18:02:44 +0300
Subject: [PATCH 3/3] qt: return old node if shared opengl context is not
 initialized yet

---
 ext/qt/qtitem.cc | 7 ++++++-
 ext/qt/qtitem.h  | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/ext/qt/qtitem.cc b/ext/qt/qtitem.cc
index b884ca0..282ad25 100644
--- a/ext/qt/qtitem.cc
+++ b/ext/qt/qtitem.cc
@@ -136,7 +136,7 @@ QtGLVideoItem::QtGLVideoItem()
     GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "qtglwidget", 0, "Qt GL
Widget");
     g_once_init_leave (&_debug, 1);
   }
-
+  this->m_openGlContextInitialized = false;
   this->setFlag (QQuickItem::ItemHasContents, true);

   this->priv = g_new0 (QtGLVideoItemPrivate, 1);
@@ -220,6 +220,10 @@ QSGNode *
 QtGLVideoItem::updatePaintNode(QSGNode * oldNode,
     UpdatePaintNodeData * updatePaintNodeData)
 {
+  if (!m_openGlContextInitialized) {
+    return oldNode;
+  }
+
   QSGSimpleTextureNode *texNode = static_cast<QSGSimpleTextureNode *>
(oldNode);
   GstVideoRectangle src, dst, result;
   GstQSGTexture *tex;
@@ -399,6 +403,7 @@ QtGLVideoItem::onSceneGraphInitialized ()
     } else {
       gst_gl_display_filter_gl_api (this->priv->display,
gst_gl_context_get_gl_api (this->priv->other_context));
       gst_gl_context_activate (this->priv->other_context, FALSE);
+      m_openGlContextInitialized = true;
     }
   }

diff --git a/ext/qt/qtitem.h b/ext/qt/qtitem.h
index 701d639..ae23eff 100644
--- a/ext/qt/qtitem.h
+++ b/ext/qt/qtitem.h
@@ -62,6 +62,7 @@ private:
     void shareContext();

     QSize m_viewportSize;
+    bool m_openGlContextInitialized;
 };

 extern "C"
-- 
2.5.0

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list