summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtem Dyomin <artem.dyomin@qt.io>2023-09-06 10:06:27 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-09-08 18:40:45 +0000
commitff4ddd4d5edd0fcc99c6d4cc864b8e0090c680da (patch)
tree75cc6019231670650a2ec3e1d55f63af84d72633
parent61cb74fa54585c75c6748c5b4853d30f1972d08e (diff)
Move formatInfo initialization delay to the QMediaRecorder construction
First initialization of MediaFormatInfo may take some time, it causes some issues for users when they call QMediaRecorder::record. The idea is to move the first initialization to the constructor. Task-number: QTBUG-116075 Change-Id: I90add1079b0cecfa457af9153b62e08d31c3d101 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> (cherry picked from commit d2feae42ca6f8172dc123fecef2626da3a941b51) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/multimedia/recording/qmediarecorder.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/multimedia/recording/qmediarecorder.cpp b/src/multimedia/recording/qmediarecorder.cpp
index 56869b4e1..00e7d41ad 100644
--- a/src/multimedia/recording/qmediarecorder.cpp
+++ b/src/multimedia/recording/qmediarecorder.cpp
@@ -109,9 +109,17 @@ QMediaRecorder::QMediaRecorder(QObject *parent)
d_ptr(new QMediaRecorderPrivate)
{
Q_D(QMediaRecorder);
+
+ auto &mediaIntegration = *QPlatformMediaIntegration::instance();
+
d->q_ptr = this;
- auto maybeControl = QPlatformMediaIntegration::instance()->createRecorder(this);
+ auto maybeControl = mediaIntegration.createRecorder(this);
if (maybeControl) {
+ // The first format info initialization may take some time,
+ // for users it seems to be more suitable to have a delay on the object construction
+ // rather than on QMediaRecorder::record
+ mediaIntegration.formatInfo();
+
d->control = maybeControl.value();
} else {
d->initErrorMessage = maybeControl.error();