diff options
author | Piotr Srebrny <piotr.srebrny@qt.io> | 2022-11-03 16:28:37 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-11-07 12:40:47 +0000 |
commit | 476960a8585154ece81d70d7731d1927ffdbf954 (patch) | |
tree | f480efd2d503e47d7b75d5999586b50f8bbdef2b | |
parent | 371d2bd14e6fc00d9228fe488396f825d5440d3f (diff) | |
download | qtmultimedia-476960a8585154ece81d70d7731d1927ffdbf954.tar.gz |
Allow sinks that do not have associated QRhi to receive video frames
AndroidSurfaceTexture was created only when QVideoSink has an associated
QRhi. This enables QVideoSink to display textures created by camera or
media player as the textures are created in the OpenGL context
associated with QRhi. However, we can allow QVideoSink without QRhi to
receive frames as the context sharing can be established later or
frames are processed as QImage.
Fixes: QTBUG-108027
Change-Id: Iac8925da43aa100fe03c09f57f3d254c27add49c
Reviewed-by: Samuel Mira <samuel.mira@qt.io>
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
(cherry picked from commit bd2e80867e4e04fff277cf7340747630d2ea55a4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/plugins/multimedia/android/common/qandroidvideooutput.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/plugins/multimedia/android/common/qandroidvideooutput.cpp b/src/plugins/multimedia/android/common/qandroidvideooutput.cpp index 7ba44c307..535915b38 100644 --- a/src/plugins/multimedia/android/common/qandroidvideooutput.cpp +++ b/src/plugins/multimedia/android/common/qandroidvideooutput.cpp @@ -291,10 +291,10 @@ public slots: if (m_surfaceTexture) return m_surfaceTexture.get(); - if (!rhi) - return nullptr; - - initRhi(static_cast<const QRhiGles2NativeHandles *>(rhi->nativeHandles())->context); + QOpenGLContext *ctx = rhi + ? static_cast<const QRhiGles2NativeHandles *>(rhi->nativeHandles())->context + : nullptr; + initRhi(ctx); m_texture.reset(m_rhi->newTexture(QRhiTexture::RGBA8, m_size, 1, QRhiTexture::ExternalOES)); m_texture->create(); @@ -352,7 +352,7 @@ void QAndroidTextureVideoOutput::setSubtitle(const QString &subtitle) AndroidSurfaceTexture *QAndroidTextureVideoOutput::surfaceTexture() { - if (!m_sink || !m_sink->rhi()) + if (!m_sink) return nullptr; AndroidSurfaceTexture *surface = nullptr; |