summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPiotr Srebrny <piotr.srebrny@qt.io>2021-06-28 12:00:42 +0200
committerPiotr Srebrny <piotr.srebrny@qt.io>2021-08-06 13:44:38 +0200
commitd663c31172e93cb6a54e2704310c5f2da3cd1863 (patch)
tree5f2dd683ada63205244b9373d2a40c43bd750cb9 /tests
parentdf73d1ebb3ab5a7aed3521add0e7fcfefa2a151d (diff)
Resolve media format and provide encoder settings with record()
Media format and other settings is implicitly resolved at the platform backend and the API user cannot get information about what codecs bitrates and other settings are selected for recording. With this patch the resolved media is provided to the backend with the record() function and the backend updates the remaining encoding parameters. Change-Id: I4876397ada2c257e59ebe8fccdd7587b2a628232 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/unit/mockbackend/qmockmediaencoder.h13
-rw-r--r--tests/auto/unit/multimedia/qmediarecorder/tst_qmediarecorder.cpp11
2 files changed, 3 insertions, 21 deletions
diff --git a/tests/auto/unit/mockbackend/qmockmediaencoder.h b/tests/auto/unit/mockbackend/qmockmediaencoder.h
index 988ce8f10..ca6c3ef7c 100644
--- a/tests/auto/unit/mockbackend/qmockmediaencoder.h
+++ b/tests/auto/unit/mockbackend/qmockmediaencoder.h
@@ -40,8 +40,7 @@ public:
QMockMediaEncoder(QMediaRecorder *parent):
QPlatformMediaEncoder(parent),
m_state(QMediaRecorder::StoppedState),
- m_position(0),
- m_settingAppliedCount(0)
+ m_position(0)
{
}
@@ -60,12 +59,6 @@ public:
return m_position;
}
- void applySettings(const QMediaEncoderSettings &settings) override
- {
- m_settings = settings;
- m_settingAppliedCount++;
- }
-
virtual void setMetaData(const QMediaMetaData &m) override
{
m_metaData = m;
@@ -76,9 +69,10 @@ public:
using QPlatformMediaEncoder::error;
public:
- void record(const QMediaEncoderSettings &) override
+ void record(QMediaEncoderSettings &settings) override
{
m_state = QMediaRecorder::RecordingState;
+ m_settings = settings;
m_position=1;
emit stateChanged(m_state);
emit durationChanged(m_position);
@@ -111,7 +105,6 @@ public:
QMediaRecorder::RecorderState m_state;
QMediaEncoderSettings m_settings;
qint64 m_position;
- int m_settingAppliedCount;
};
#endif // MOCKRECORDERCONTROL_H
diff --git a/tests/auto/unit/multimedia/qmediarecorder/tst_qmediarecorder.cpp b/tests/auto/unit/multimedia/qmediarecorder/tst_qmediarecorder.cpp
index 36fd0a16d..ceed4eeff 100644
--- a/tests/auto/unit/multimedia/qmediarecorder/tst_qmediarecorder.cpp
+++ b/tests/auto/unit/multimedia/qmediarecorder/tst_qmediarecorder.cpp
@@ -361,22 +361,11 @@ void tst_QMediaRecorder::testSettingsApplied()
session.setRecorder(&encoder);
auto *mock = mockIntegration->lastCaptureService()->mockControl;
- //if the media recorder is not configured after construction
- //the settings are applied in the next event loop
- QCOMPARE(mock->m_settingAppliedCount, 0);
- QTRY_COMPARE(mock->m_settingAppliedCount, 1);
-
encoder.setVideoResolution(640,480);
- QCOMPARE(mock->m_settingAppliedCount, 1);
- QTRY_COMPARE(mock->m_settingAppliedCount, 2);
-
//encoder settings are applied before recording if changed
encoder.setQuality(QMediaRecorder::VeryHighQuality);
-
- QCOMPARE(mock->m_settingAppliedCount, 2);
encoder.record();
- QCOMPARE(mock->m_settingAppliedCount, 3);
encoder.stop();
}