qml6glsrc: Reduce capture delay
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Tue, 13 Aug 2024 19:07:07 +0000 (15:07 -0400)
committerBackport Bot <gitlab-backport-bot@gstreamer-foundation.org>
Mon, 23 Sep 2024 20:04:03 +0000 (22:04 +0200)
In qml6glsrc, we capture the application by copying the back buffer into
our own FBO. The afterRendering() signal is too soon as from the apitrace, the
application has been rendered into a QT internal buffer, to be used as a cache
for refresh.

Use afterFrameEnd() signal instead. This works with no delay on GLES. With GL
it seems to reduce from 2 to 1 frame delay (this may be platform specific). A
different recording technique would need to be used to completely remove this
delay.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7562>

subprojects/gst-plugins-good/ext/qt6/qt6glwindow.cc
subprojects/gst-plugins-good/ext/qt6/qt6glwindow.h

index 3486c54e7927511c64988860963cbcf3b85b25ab..661187c6eb44a2a701cbdc74f4ecfe202c7e884f 100644 (file)
@@ -103,7 +103,7 @@ Qt6GLWindow::Qt6GLWindow (QWindow * parent, QQuickWindow *src)
   this->priv->internal_format = GL_RGBA;
 
   connect (source, SIGNAL(beforeRendering()), this, SLOT(beforeRendering()), Qt::DirectConnection);
-  connect (source, SIGNAL(afterRendering()), this, SLOT(afterRendering()), Qt::DirectConnection);
+  connect (source, SIGNAL(afterFrameEnd()), this, SLOT(afterFrameEnd()), Qt::DirectConnection);
   if (source->isSceneGraphInitialized())
     source->scheduleRenderJob(new RenderJob(std::bind(&Qt6GLWindow::onSceneGraphInitialized, this)), QQuickWindow::BeforeSynchronizingStage);
   else
@@ -201,7 +201,7 @@ Qt6GLWindow::beforeRendering()
 }
 
 void
-Qt6GLWindow::afterRendering()
+Qt6GLWindow::afterFrameEnd()
 {
   gboolean ret;
   guint width, height;
index c964da23b0fde8de5f9c17a2cda76c186894bf62..3c0fc14d978b75946d597318a0b2c5ce2651c543 100644 (file)
@@ -45,7 +45,7 @@ public:
 
 private Q_SLOTS:
     void beforeRendering ();
-    void afterRendering ();
+    void afterFrameEnd ();
     void onSceneGraphInitialized ();
     void onSceneGraphInvalidated ();