diff options
author | Samuel Mira <samuel.mira@qt.io> | 2022-12-15 14:33:39 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-12-16 08:25:14 +0000 |
commit | 6f9762c51a53f02c7f559fc3a9a0f86d57b57add (patch) | |
tree | c9f7f679f0501804a05d42683c6d2cdbc727d2a4 /src | |
parent | aad72fc2fdf4be0679e072514a7542415c4a7bfd (diff) |
Android: fix thread hang on tst_qvideowidget
QVideoWidget gets blocked because of a hanging thread on
QAndroidTextureVideoOutput. This thread waits on the destructor forever.
This only happened when the provided sink had no RHI.
QAndroidTextureVideoOutput depends on OpenGL so it does not work without
an RHI. Therefore a check was added on the constructor to prevent the
thread to start in this case.
Fixes: QTBUG-109443
Change-Id: I158ff95967116697018e7d6f34c29c5e999182be
Reviewed-by: Piotr Srebrny <piotr.srebrny@qt.io>
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
(cherry picked from commit f6b0e3a33add68972e3ba556dddb1f745224ce01)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/multimedia/android/common/qandroidvideooutput.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/plugins/multimedia/android/common/qandroidvideooutput.cpp b/src/plugins/multimedia/android/common/qandroidvideooutput.cpp index e5b212283..ffda18378 100644 --- a/src/plugins/multimedia/android/common/qandroidvideooutput.cpp +++ b/src/plugins/multimedia/android/common/qandroidvideooutput.cpp @@ -328,6 +328,12 @@ QAndroidTextureVideoOutput::QAndroidTextureVideoOutput(QVideoSink *sink, QObject : QAndroidVideoOutput(parent) , m_sink(sink) { + if (!m_sink || !m_sink->rhi()) { + qDebug() << "Cannot create QAndroidTextureVideoOutput without a sink and a rhi"; + m_surfaceThread = nullptr; + return; + } + m_surfaceThread = std::make_unique<AndroidTextureThread>(); connect(m_surfaceThread.get(), &AndroidTextureThread::newFrame, this, &QAndroidTextureVideoOutput::newFrame); @@ -338,7 +344,8 @@ QAndroidTextureVideoOutput::QAndroidTextureVideoOutput(QVideoSink *sink, QObject QAndroidTextureVideoOutput::~QAndroidTextureVideoOutput() { - m_surfaceThread->wait(); + if (m_surfaceThread) + m_surfaceThread->wait(); } void QAndroidTextureVideoOutput::setSubtitle(const QString &subtitle) |