Commit fea4d302 authored by VaL Doroshchuk's avatar VaL Doroshchuk
Browse files

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: default avatarOliver Wolff <oliver.wolff@qt.io>
Reviewed-by: default avatarAndy Shaw <andy.shaw@qt.io>
Showing with 7 additions and 2 deletions
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
#include <private/gstvideoconnector_p.h> #include <private/gstvideoconnector_p.h>
#endif #endif
#include <private/qgstutils_p.h> #include <private/qgstutils_p.h>
#include <private/qgstutils_p.h> #include <private/qvideosurfacegstsink_p.h>
#include <gst/gstvalue.h> #include <gst/gstvalue.h>
#include <gst/base/gstbasesrc.h> #include <gst/base/gstbasesrc.h>
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
#include <QtCore/qdebug.h> #include <QtCore/qdebug.h>
#include <QtCore/qdir.h> #include <QtCore/qdir.h>
#include <QtCore/qstandardpaths.h> #include <QtCore/qstandardpaths.h>
#include <qvideorenderercontrol.h>
//#define DEBUG_PLAYBIN //#define DEBUG_PLAYBIN
//#define DEBUG_VO_BIN_DUMP //#define DEBUG_VO_BIN_DUMP
...@@ -338,6 +339,11 @@ void QGstreamerPlayerSession::loadFromUri(const QNetworkRequest &request) ...@@ -338,6 +339,11 @@ void QGstreamerPlayerSession::loadFromUri(const QNetworkRequest &request)
#endif #endif
if (m_request.url().scheme() == QLatin1String("gst-pipeline")) { 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 url = m_request.url().toString(QUrl::RemoveScheme);
QString pipeline = QUrl::fromPercentEncoding(url.toLatin1().constData()); QString pipeline = QUrl::fromPercentEncoding(url.toLatin1().constData());
GError *err = nullptr; GError *err = nullptr;
......
...@@ -113,7 +113,6 @@ void QGstreamerVideoRenderer::setSurface(QAbstractVideoSurface *surface) ...@@ -113,7 +113,6 @@ void QGstreamerVideoRenderer::setSurface(QAbstractVideoSurface *surface)
if (m_surface) { if (m_surface) {
connect(m_surface.data(), SIGNAL(supportedFormatsChanged()), connect(m_surface.data(), SIGNAL(supportedFormatsChanged()),
this, SLOT(handleFormatChange())); this, SLOT(handleFormatChange()));
QVideoSurfaceGstSink::setSurface(m_surface);
} }
if (wasReady != isReady()) if (wasReady != isReady())
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment