summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartlomiej Moskal <bartlomiej.moskal@qt.io>2023-07-25 11:51:41 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-08-04 06:24:28 +0000
commitdb77452d9cc5084f5ec102c71e02867180f66c76 (patch)
treeabf77facb3b8fe1e1fb88578a5bf826b09cced1f
parent53e941f58f2ed4cb39965863611dc22ab62d629e (diff)
Android: Move clean up AndroidTextureThread to its destructor
AndroidTextureThread should properly clean itself instead of expecting the owner to do it. It is needed especialy when AndroidTextureThread will be shared. Change-Id: I55603e73da5b3621385c7ce72b51242763dd1b4c Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit c59c642181a8bd265817793e0e44d87aaf6c01e5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/plugins/multimedia/android/common/qandroidvideooutput.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/plugins/multimedia/android/common/qandroidvideooutput.cpp b/src/plugins/multimedia/android/common/qandroidvideooutput.cpp
index 4afb119ee..bb2a10dee 100644
--- a/src/plugins/multimedia/android/common/qandroidvideooutput.cpp
+++ b/src/plugins/multimedia/android/common/qandroidvideooutput.cpp
@@ -254,7 +254,21 @@ class AndroidTextureThread : public QThread
{
Q_OBJECT
public:
- AndroidTextureThread() : QThread() {}
+ AndroidTextureThread() : QThread() {
+ }
+
+ ~AndroidTextureThread() {
+ QMetaObject::invokeMethod(this,
+ &AndroidTextureThread::clearSurfaceTexture, Qt::BlockingQueuedConnection);
+ this->quit();
+ this->wait();
+ }
+
+ void start()
+ {
+ QThread::start();
+ moveToThread(this);
+ }
void initRhi(QOpenGLContext *context)
{
@@ -341,17 +355,11 @@ QAndroidTextureVideoOutput::QAndroidTextureVideoOutput(QVideoSink *sink, QObject
m_surfaceThread = std::make_unique<AndroidTextureThread>();
connect(m_surfaceThread.get(), &AndroidTextureThread::newFrame,
this, &QAndroidTextureVideoOutput::newFrame);
-
m_surfaceThread->start();
- m_surfaceThread->moveToThread(m_surfaceThread.get());
}
QAndroidTextureVideoOutput::~QAndroidTextureVideoOutput()
{
- QMetaObject::invokeMethod(m_surfaceThread.get(),
- &AndroidTextureThread::clearSurfaceTexture, Qt::BlockingQueuedConnection);
- m_surfaceThread->quit();
- m_surfaceThread->wait();
}
void QAndroidTextureVideoOutput::setSubtitle(const QString &subtitle)