summaryrefslogtreecommitdiffstats
path: root/tests/auto/unit/mockbackend/qmockintegration.cpp
diff options
context:
space:
mode:
authorArtem Dyomin <artem.dyomin@qt.io>2024-01-18 09:53:08 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-01-22 11:11:59 +0000
commit699bcbbe4308745be55a7db8709ef27c74909488 (patch)
tree269652722db71b86c3569d382543715730f73274 /tests/auto/unit/mockbackend/qmockintegration.cpp
parentb953c12bf7e356b6e6b78c28e3c21309eaebf274 (diff)
Implement lazy initialization of VideoDevices
As we extend the usage of QPlatformMediaIntegration, adding it in QSoundEffect, we should make the initialization of not necessary things lazy. VideoDevices might run their own cameras tracking pipeline, so we fix video devices firstly. Pick-to: 6.5 Change-Id: I8e447452b4b02247c0708569539d7f9c35b47799 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> (cherry picked from commit 2d19467fba0f2ad72d033cfd9b7230cc78d65b7a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit b4a22952e1ffc0da9335586e162d654f1567279e)
Diffstat (limited to 'tests/auto/unit/mockbackend/qmockintegration.cpp')
-rw-r--r--tests/auto/unit/mockbackend/qmockintegration.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/auto/unit/mockbackend/qmockintegration.cpp b/tests/auto/unit/mockbackend/qmockintegration.cpp
index 0cdb21491..8330fcd7f 100644
--- a/tests/auto/unit/mockbackend/qmockintegration.cpp
+++ b/tests/auto/unit/mockbackend/qmockintegration.cpp
@@ -77,13 +77,15 @@ private:
QList<QCameraDevice> m_cameraDevices;
};
-QMockIntegration::QMockIntegration()
-{
- m_videoDevices = std::make_unique<QMockVideoDevices>(this);
-}
+QMockIntegration::QMockIntegration() = default;
QMockIntegration::~QMockIntegration() = default;
+QPlatformVideoDevices *QMockIntegration::createVideoDevices()
+{
+ return new QMockVideoDevices(this);
+}
+
QMaybe<QPlatformAudioDecoder *> QMockIntegration::createAudioDecoder(QAudioDecoder *decoder)
{
if (m_flags & NoAudioDecoderInterface)
@@ -163,7 +165,7 @@ QMaybe<QPlatformAudioOutput *> QMockIntegration::createAudioOutput(QAudioOutput
void QMockIntegration::addNewCamera()
{
- static_cast<QMockVideoDevices &>(*m_videoDevices).addNewCamera();
+ static_cast<QMockVideoDevices *>(videoDevices())->addNewCamera();
}
bool QMockCamera::simpleCamera = false;