diff options
author | Volker Krause <vkrause@kde.org> | 2024-03-27 17:53:52 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2024-03-30 04:56:40 +0000 |
commit | 766c2a92c17da193661389a4b15577294478007f (patch) | |
tree | 556bfd9c41531ca2e7731e4cc9122a29ba8d0e9a | |
parent | e1cbbf2dfd537ba3cc1697929864d27bd79e55f6 (diff) |
Correctly initialize QAbstractVideoBuffer::m_rhi
This fixes a regression introduced in a443ea329f681ee which broke
mapping and reading video frame content.
Pick-to: 6.5
Change-Id: I45f862a25494d3161fc118ce593ab3e0a04b2955
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
(cherry picked from commit e1b4840eb488165dcd3b1770aa7a64e0077e1907)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit fb3739afd20e8d60891425e4457939f88cacd2f1)
-rw-r--r-- | src/plugins/multimedia/android/common/qandroidvideooutput.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/plugins/multimedia/android/common/qandroidvideooutput.cpp b/src/plugins/multimedia/android/common/qandroidvideooutput.cpp index 16bbc0d7a..5a4eebf51 100644 --- a/src/plugins/multimedia/android/common/qandroidvideooutput.cpp +++ b/src/plugins/multimedia/android/common/qandroidvideooutput.cpp @@ -41,10 +41,11 @@ class QRhiWithThreadGuard : public QObject { Q_OBJECT public: QRhiWithThreadGuard(std::shared_ptr<QRhi> r, std::shared_ptr<AndroidTextureThread> t) - : m_rhi(std::move(r)), m_thread(std::move(t)) {} + : m_guardRhi(std::move(r)), m_thread(std::move(t)) {} ~QRhiWithThreadGuard(); +protected: + std::shared_ptr<QRhi> m_guardRhi; private: - std::shared_ptr<QRhi> m_rhi; std::shared_ptr<AndroidTextureThread> m_thread; }; @@ -56,7 +57,7 @@ public: std::shared_ptr<QRhi> rhi, std::shared_ptr<AndroidTextureThread> thread, std::unique_ptr<QRhiTexture> tex, const QSize &size) : QRhiWithThreadGuard(std::move(rhi), std::move(thread)) - , QAbstractVideoBuffer(QVideoFrame::RhiTextureHandle, rhi.get()) + , QAbstractVideoBuffer(QVideoFrame::RhiTextureHandle, m_guardRhi.get()) , m_size(size) , m_tex(std::move(tex)) {} @@ -367,7 +368,7 @@ private: QRhiWithThreadGuard::~QRhiWithThreadGuard() { // It may happen that reseting m_rhi shared_ptr will delete it (if it is the last reference) // QRHI need to be deleted from the thread that created it. - QMetaObject::invokeMethod(m_thread.get(), [&]() {m_rhi.reset();}, Qt::BlockingQueuedConnection); + QMetaObject::invokeMethod(m_thread.get(), [&]() {m_guardRhi.reset();}, Qt::BlockingQueuedConnection); } QAndroidTextureVideoOutput::QAndroidTextureVideoOutput(QVideoSink *sink, QObject *parent) |