diff options
author | Piotr Srebrny <piotr.srebrny@qt.io> | 2022-11-03 16:28:37 +0100 |
---|---|---|
committer | Piotr Srebrny <piotr.srebrny@qt.io> | 2022-11-07 12:53:38 +0100 |
commit | bd2e80867e4e04fff277cf7340747630d2ea55a4 (patch) | |
tree | e123cfa38cab3930fd91911a3919a1ee9c12ee65 /src | |
parent | 65cc7e62f0aab27efee5dff9acdedbefa38d892f (diff) |
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
Pick-to: 6.4
Change-Id: Iac8925da43aa100fe03c09f57f3d254c27add49c
Reviewed-by: Samuel Mira <samuel.mira@qt.io>
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
Diffstat (limited to 'src')
-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; |