summaryrefslogtreecommitdiffstats
path: root/src/qtmultimediaquicktools/qsgvideonode_yuv.cpp
diff options
context:
space:
mode:
authorVaL Doroshchuk <valentyn.doroshchuk@qt.io>2020-08-29 15:20:03 +0200
committerVal Doroshchuk <valentyn.doroshchuk@qt.io>2020-08-30 09:15:07 +0000
commitd82c1b5d05407a5ea8f29d23be316c84d4e1082e (patch)
treea39c8697a45c7d885922ceefbaf7d0b1bfb1794e /src/qtmultimediaquicktools/qsgvideonode_yuv.cpp
parent3a275c659698f4a3758dc105cd38a9d8a57f36cd (diff)
Quick: Always create sg textures in ctor()
Since compare() can be called before updateUniformData() Change-Id: I7a1e0a08926cbf6d5629468b8bf64dcd7602b399 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/qtmultimediaquicktools/qsgvideonode_yuv.cpp')
-rw-r--r--src/qtmultimediaquicktools/qsgvideonode_yuv.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/qtmultimediaquicktools/qsgvideonode_yuv.cpp b/src/qtmultimediaquicktools/qsgvideonode_yuv.cpp
index e825838ba..40eed8fbb 100644
--- a/src/qtmultimediaquicktools/qsgvideonode_yuv.cpp
+++ b/src/qtmultimediaquicktools/qsgvideonode_yuv.cpp
@@ -231,11 +231,6 @@ bool QSGVideoMaterialRhiShader_YUV::updateUniformData(RenderState &state, QSGMat
changed = true;
}
- if (!m->m_textures[0]) {
- m->m_textures[0].reset(new QSGVideoTexture);
- m->m_textures[1].reset(new QSGVideoTexture);
- }
-
m->m_frameMutex.lock();
mapFrame(m);
m->m_frameMutex.unlock();
@@ -294,9 +289,6 @@ void QSGVideoMaterialRhiShader_YUV_YV::mapFrame(QSGVideoMaterial_YUV *m)
if (!m->m_frame.isValid() || !m->m_frame.map(QAbstractVideoBuffer::ReadOnly))
return;
- if (!m->m_textures[2])
- m->m_textures[2].reset(new QSGVideoTexture);
-
int y = 0;
int u = m->m_frame.pixelFormat() == QVideoFrame::Format_YV12 ? 2 : 1;
int v = m->m_frame.pixelFormat() == QVideoFrame::Format_YV12 ? 1 : 2;
@@ -341,6 +333,10 @@ QSGVideoMaterial_YUV::QSGVideoMaterial_YUV(const QVideoSurfaceFormat &format) :
m_format(format),
m_opacity(1.0)
{
+ m_textures[0].reset(new QSGVideoTexture);
+ m_textures[1].reset(new QSGVideoTexture);
+ m_textures[2].reset(new QSGVideoTexture);
+
switch (format.yCbCrColorSpace()) {
case QVideoSurfaceFormat::YCbCr_JPEG:
m_colorMatrix = QMatrix4x4(