summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVaL Doroshchuk <valentyn.doroshchuk@qt.io>2019-02-07 13:27:36 +0100
committerVaL Doroshchuk <valentyn.doroshchuk@qt.io>2019-02-22 07:52:06 +0000
commitfea4d302cddbb91e23864a4dbd786d53b72f67ea (patch)
tree5190a81e7afa9a633358f53d359846aae47f7b4c
parent4e47d0a710452cfba62a8a3c2c2ce5c118bc00fe (diff)
Gstreamer: Set surface from renderer before creating pipeline
When multiple pipelines are created, and one of these gets recreated, it picks up the last set surface. This is incorrect, as it needs a surface belonging to the current renderer. This patch sets the surface before creating pipelines, retrieving it from the current renderer. Task-number: QTBUG-73557 Change-Id: I0811f7262a0eca57e01361a55515351127520064 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
-rw-r--r--src/gsttools/qgstreamerplayersession.cpp8
-rw-r--r--src/gsttools/qgstreamervideorenderer.cpp1
2 files changed, 7 insertions, 2 deletions
diff --git a/src/gsttools/qgstreamerplayersession.cpp b/src/gsttools/qgstreamerplayersession.cpp
index bd402fb3c..f21c94c5c 100644
--- a/src/gsttools/qgstreamerplayersession.cpp
+++ b/src/gsttools/qgstreamerplayersession.cpp
@@ -47,7 +47,7 @@
#include <private/gstvideoconnector_p.h>
#endif
#include <private/qgstutils_p.h>
-#include <private/qgstutils_p.h>
+#include <private/qvideosurfacegstsink_p.h>
#include <gst/gstvalue.h>
#include <gst/base/gstbasesrc.h>
@@ -60,6 +60,7 @@
#include <QtCore/qdebug.h>
#include <QtCore/qdir.h>
#include <QtCore/qstandardpaths.h>
+#include <qvideorenderercontrol.h>
//#define DEBUG_PLAYBIN
//#define DEBUG_VO_BIN_DUMP
@@ -338,6 +339,11 @@ void QGstreamerPlayerSession::loadFromUri(const QNetworkRequest &request)
#endif
if (m_request.url().scheme() == QLatin1String("gst-pipeline")) {
+ // Set current surface to video sink before creating a pipeline.
+ auto renderer = qobject_cast<QVideoRendererControl*>(m_videoOutput);
+ if (renderer)
+ QVideoSurfaceGstSink::setSurface(renderer->surface());
+
QString url = m_request.url().toString(QUrl::RemoveScheme);
QString pipeline = QUrl::fromPercentEncoding(url.toLatin1().constData());
GError *err = nullptr;
diff --git a/src/gsttools/qgstreamervideorenderer.cpp b/src/gsttools/qgstreamervideorenderer.cpp
index 25fc33cb3..c2226d658 100644
--- a/src/gsttools/qgstreamervideorenderer.cpp
+++ b/src/gsttools/qgstreamervideorenderer.cpp
@@ -113,7 +113,6 @@ void QGstreamerVideoRenderer::setSurface(QAbstractVideoSurface *surface)
if (m_surface) {
connect(m_surface.data(), SIGNAL(supportedFormatsChanged()),
this, SLOT(handleFormatChange()));
- QVideoSurfaceGstSink::setSurface(m_surface);
}
if (wasReady != isReady())