summaryrefslogtreecommitdiffstats
path: root/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp
Commit message (Collapse)AuthorAgeFilesLines
* GStreamer: QGstreamerImageCapture - set metadata immediatelyTim Blechmann2024-05-061-1/+0
| | | | | | | | | | | | | Originally the metadata was populated with "Resolution" / "Date" from the `probeBuffer` handler. However according to imagemagick's `identify` these metadata do not seem to affect the generated images, probably they are generated from the timestamps/buffer image resolution Pick-to: 6.5 6.7 Change-Id: I81491e51c5b7a50c9aec23e1d7cf549382246b7d Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Tests: camera backend - test image metadataTim Blechmann2024-05-031-0/+23
| | | | | | | | Validate metadata emitted by `QImageCapture` Pick-to: 6.5 6.7 Change-Id: Ibd9a517b37f57a1c637dafac26779a52a74e6343 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* GStreamer: fix QGstreamerMediaPlayer - fix metadata testTim Blechmann2024-05-021-6/+5
| | | | | | | | | | | | | | | QGstreamerMediaPlayer did not emit metaDataChanged after parsing GST_MESSAGE_TAG. This caused metadata to be changed without notifying the application. In the unit test we need to wait for `metaDataChanged` at least twice, since it is called from both the GST_MESSAGE_TAG handler and from parseStreamsAndMetadata. Fixes: QTBUG-124182 Pick-to: 6.5 6.7 Change-Id: I68f81d5bcb1a2c809f3641ec11356f5b9a8cb601 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Tests: apply clazy's old-style-connectTim Blechmann2024-05-011-22/+22
| | | | | | | | | | Automated refactoring done via clazy. PMF syntax is faster and more tooling-friendly. Pick-to: 6.5 6.7 Change-Id: Iaa31b2ab00ca032cf4f02d7565b910a0b3d22e5e Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Tests: improve mediabackendutils.hTim Blechmann2024-04-181-1/+1
| | | | | | | | some quality of life improvements Pick-to: 6.5 6.7 Change-Id: I8cee3f6f59584b95a09569d5a92a2381a5796bfd Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* QCamera: disable multi-camera test on linuxTim Blechmann2024-04-171-0/+4
| | | | | | | | | | | | These tests failed on my workstation with cameras attached: the first could be opened, the second could not. Both with gstreamer and ffmpeg. Pick-to: 6.5 6.7 Change-Id: I1f149a12fdc664625e5f33470445c26df11391d6 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Mikko Hallamaa <mikko.hallamaa@qt.io> Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Lars Sutterud <lars.sutterud@qt.io>
* Tests: remove TESTED_COMPONENTTim Blechmann2024-04-161-2/+0
| | | | | | | | TESTED_COMPONENT comments seem to be legacy Pick-to: 6.5 6.7 Change-Id: Iaa5b153faa4b532a72c58695fc64f7e4e3fd0775 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* Tests: camera backend - tweak timing and event loop to make tests passTim Blechmann2024-04-091-6/+12
| | | | | | | | | | | * increase some timeouts * validate recorder states * skip spuriously failing testNativeMetadata * introduce helper header for platform-related qttest macros Pick-to: 6.5 6.6 6.7 Change-Id: I9b491d6fff7a93a2430e6f1f398dd7333ca6f6d2 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* GStreamer: mark known failureTim Blechmann2024-04-091-0/+4
| | | | | | | Pick-to: 6.5 6.6 6.7 Change-Id: I07b8a98d8da15468a24e98f5aff5c5bd48c26fca Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* strings: use QStringLiteral instead of fromUtf8Tim Blechmann2024-04-091-3/+3
| | | | | | | | This avoids run-time unicode conversions. Pick-to: 6.5 6.6 6.7 Change-Id: Ief6aa32288b300ee05232e7372b6f701562194fc Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* GStreamer: small quality-of-life improvementsTim Blechmann2024-04-091-1/+1
| | | | | | | | | | * reference signal by function pointer * reformat lambda body Pick-to: 6.5 6.6 6.7 Change-Id: I735d3edc31ff59f75f7f51d8f5e0a81721420d11 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* GStreamer: tests - increase timeout in camera backend testTim Blechmann2024-04-051-1/+1
| | | | | | | | | | The timeout caused a unit test failure on my workstation, most likely because of the asynchronous nature of gstreamer. Pick-to: 6.5 6.6 6.7 Change-Id: I664f4dd12ba3cf8aed7fb2f30e38744acc62389a Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Tests: testCameraCapture - increase timeoutTim Blechmann2024-04-041-1/+1
| | | | | | | | | The 5s timeout in `tst_QCameraBackend::testCameraCapture` seems to be too less, this caused a unit test failure of the gstreamer backend Pick-to: 6.5 6.6 6.7 Change-Id: I046f1eaec6d2121bd0dde5bb0cbe655dc2d023a9 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Change license for test filesLucie Gérard2024-03-261-1/+1
| | | | | | | | | | | | According to QUIP-18 [1], all test files should be LicenseRef-Qt-Commercial OR GPL-3.0-only [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I4893431670b557d89db086ea8a35ee4c058ec98a Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* tst_qcamerabackend: Wait until file is loadedBartlomiej Moskal2023-11-291-0/+2
| | | | | | | | | | | | After 4b51aa786a0a75dc2f193a2d2a16080fc12ec24f commit media are loaded by separate thread. Because of that we cannot assume that file is loaded immediately after setSource() call. That is why we need to wait for LoadedMedia state before checking tested metaData. Pick-to: 6.6 6.5 Task-number: QTBUG-118571 Change-Id: I89f5f7c95f8274f7e58898e56391279b238c46c4 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Tests: run tests on Android targetBartlomiej Moskal2023-11-291-0/+3
| | | | | | | | | | | | From some time tests were not run on Android. This patch turn them on again. Task-number: QTBUG-118571 Task-number: QTBUG-118572 Task-number: QTBUG-118573 Pick-to: 6.6 6.5 Change-Id: I7b61d546966a8b43a6fddc0db27e62ad3485fbed Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Fix some qmediaplayer tests flackinessArtem Dyomin2023-05-301-1/+1
| | | | | | | | | | | | | | | Outputs should be removed after QMediaPlayer to avoid having broken references inside the player. Handling of the outputs deleting will be done under the task QTBUG-114072 with new specific unit test case. This patch fixes tests flakiness that improves CI behavior. Task-number: QTBUG-114072 Pick-to: 6.5 Change-Id: I0f4f4a2e9152a2a4dd9572d8060586ee6fb1d647 Reviewed-by: Lars Knoll <lars@knoll.priv.no> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Tests: fix failing tst_QCameraBackend on Android part 3/3Bartlomiej Moskal2023-04-141-0/+8
| | | | | | | | | | | | | | | | YUV420P and NV12 are similar formats. They contain the same data, just slightly differently arranged in memory. On Android we cannot be sure which format we will receive. It dependes on vendors' implementaion. Therefore, it is not a failure when we asked for YUV420P but got NV12. This commit contains fix in comparation format types for Android. Formta_YUV420P and Fromat_NV12 are treated as the same formats. Task-number: QTBUG-112175 Change-Id: Ie166226f43a42b55cfe18864594ff1111cbf79ef Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Tests: fix failing tst_QCameraBackend on Android part 2/3Bartlomiej Moskal2023-03-271-0/+4
| | | | | | | | | | | | | | Multi-camera feature[0] is currently not supported on Android. Therefore, we are not allowed to open the same device twice. When trying to open camera (which is already opened) we receive onDisconnected callback. This commit skips testCameraStartParallel test on Android. [0]https://source.android.com/docs/core/camera/multi-camera Task-number: QTBUG-112175 Change-Id: If81eab99954ee87949e39384c8080ef796710c08 Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Tests: fix failing tst_QCameraBackend on Android part 1/3Bartlomiej Moskal2023-03-271-2/+2
| | | | | | | | | | | | | On Android, camera activation take some time. It may happen that we are trying to start recording on not active camera - which cause test failure. That is why we need to wait for camera activation before test continuation. This commit extends the waiting time for an activity state change. Task-number: QTBUG-112175 Change-Id: Ife9d03ff20fa9136a86fd743a63fb9653696c59f Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Fix ffmpeg encoding issuesArtem Dyomin2023-02-171-21/+29
| | | | | | | | | | | | | | Fixed a bunch of problems: - wrong frame intervals in macos camera and screen capturing - missing frame rate in screen capturing format - wrong scaling in encoder Also, some recording tests have been added Task-number: QTBUG-103226 Pick-to: 6.5 Change-Id: Id775f31e01d75d5c9f3c4ec20c33074acab1ab20 Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Fix ffmpeg camera crash on macOS (double releasing of an object)Artem Dyomin2022-11-291-0/+31
| | | | | | | | | | | | | | The reason for the crash is 'autorelease' and 'release' in the destructor. In applications, QMacAutoReleasePool releases it 2nd time. The application crashed after a few camera changes. So we should use only one approach. The suggestion is to manage the object manually for both backends in order to make the behavior more predictable. The added test checks the case. Pick-to: 6.4 Change-Id: I80a644acd94ae469a16fd95ba971441c78e7a700 Reviewed-by: Doris Verria <doris.verria@qt.io>
* Don't fail tests when recording does not start due to format errorPiotr Srebrny2022-10-171-2/+6
| | | | | | | | | | Recorders don't handle all camera formats and we should not fail test in such case. Specifically Windows encoders do not handle Y8 format that is produced by IR cameras. Pick-to: 6.4 Change-Id: I964d7edc0cef294ceb92932b901af8f3c174fe11 Reviewed-by: André de la Rocha <andre.rocha@qt.io>
* Port from container::count() and length() to size()Marc Mutz2022-10-071-15/+15
| | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8: auto QtContainerClass = anyOf( expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o), expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)); makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container', with the extended set of container classes recognized. Change-Id: I90d9db5c161f499cfabf3ce41f55c3cc4d4ff5d4 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-241-27/+2
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: Ida08dfe6c84778656e942178c3d39042c9ef1ed2 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Fix autotest if no cameras are availableLars Knoll2022-04-041-0/+2
| | | | | Change-Id: Ib82bb3c4ef26fafa8673f8484f8ec3ea3c8b5aa2 Reviewed-by: Rafael Roquetto <rafael.roquetto@qt.io>
* Fix qcamerabackend testLars Knoll2022-04-041-3/+5
| | | | | | | | Don't expect the stateChanged() signal to come asynchronously when calling stop(). Change-Id: I213e84c20f4e8cf7a7c5563d2a336cb867851c76 Reviewed-by: Rafael Roquetto <rafael.roquetto@qt.io>
* Fix QCameraBackend::testNativeMetadata() on gstreamerLars Knoll2021-10-121-2/+5
| | | | | | | | | | | Let it record a bit, otherwise we don't get anything. Don't check QMediaMetaData::Date, as some encoders set that on their own. Instead use Language and fix issues in correctly writing the language. Pick-to: 6.2 Change-Id: Ib5e2bacc053814afc2fafdae65330950e591d6fc Reviewed-by: Piotr Srebrny <piotr.srebrny@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix qcamerabackend autotest for gstreamerLars Knoll2021-10-111-4/+7
| | | | | | | | | | | Mainly fixes in the auto test to ensure it works correctly. Add one log message to the image capture backend in case we fail to save to a file. Pick-to: 6.2 Change-Id: Ie631ebfdd45d16a16a5b7e22d8bbe00db78afd6f Reviewed-by: Piotr Srebrny <piotr.srebrny@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix QCameraBackend::testCtorWithCameraDevice() testLars Knoll2021-10-061-8/+24
| | | | | | | | | The default constructor of QCamera should pick the default camera. Pick-to: 6.2 Change-Id: I847a2cc65470bf337da6f070d9abbaa3c478f055 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* API fix: Give QVideoSink a videoFrame propertyLars Knoll2021-09-071-1/+1
| | | | | | | | | | | | Gives a more consistent API with a videoFrameChanged() signal instead of a newVideoFrame() signal. Add setters and getters for videoFrame and subtitleText. Pick-to: 6.2 Change-Id: Ib6bb27b76cbf195dcc83eb00bca080ffd64ef538 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Samuel Mira <samuel.mira@qt.io>
* Small fixes to tst_qcamerabackend/tst_qmediaplayerbackendDoris Verria2021-08-231-2/+2
| | | | | | Pick-to: 6.2 Change-Id: Ia5480d4bd51783deaeb3e90646acd4c8af30515c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* tst_qcamerabackend: Fix test case for setting camera formatDoris Verria2021-08-201-11/+10
| | | | | | | | | | | | | | | | Remove framerate comparison between the camera's format and the video buffer's. The QVideoFrame coming from the newVideoFrame signal, doesn't have a framerate set. Also, we are not checking reliably for a format mismatch with QTRY_ VERIFY as it will timeout before even processing a frame (when formatMismatch is 0 upon initialization). Initialize it to -1 and set the value of formatMismatch to 1 in case of a mismatch, 0 otherwise. Blacklist test case for macOS and iOS as viewfinder frame is always set to be in Format_BGRA8888 for now. Pick-to: 6.2 Change-Id: Ia299900fe8f66b0a5613635cc112d14d5ca10b2e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Add auto tests for setting camera formatDoris Verria2021-08-101-2/+95
| | | | | Change-Id: I572840a2adfde7b707288a476aeb842fb44733db Reviewed-by: André de la Rocha <andre.rocha@qt.io>
* Auto test fix after run on Android: qcamerabackendBartlomiej Moskal2021-08-021-4/+3
| | | | | | | | | | | | | | Commit contains two fixes: 1. QCameraDevice is set to default since commit: e045ee08c84fbc6d1c6837e34c30f88c09cd2cdb. That is why check for not starting up camera (without setting device) need to be removed; 2. After commit 2f018aad29cebe4b4db3f69ff2d5e11f8ba2cad2 there was an assertion in android cameraSession for starting preview (for not set video output). Assertion is removed from code. Before testing for camera start - video output is set; Change-Id: I9931d49c8388c92f7159b302afe5e1f5e629e764 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Rename QMediaCaptureSession::encoder to recorderLars Knoll2021-07-081-2/+2
| | | | | | | | | | | | | As the class is called QMediaRecorder this is required for API consistency. Also cleaned up the front end code and examples where they used encoder instead of recorder. Cleanup of the backend will have to come in a separate change. Change-Id: I6e63e607473e68f628b1f89ffa3edcbc5bf5c2c8 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Bartlomiej Moskal <bartlomiej.moskal@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix camera testsPiotr Srebrny2021-06-291-7/+16
| | | | | | | | | | | | Replace the arbitrary wait times by waiting on the duration signals to get non-empty recordings in the miminum time. Addapt changes to the mediaplayer interface and reset the mediaplayer source to be able to delete the recorded file. Change-Id: I9b5fd4bfd2dba36a7f2d7ebc659d58fc45c386d9 Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Kill QMediaRecorder::StatusPiotr Srebrny2021-06-251-23/+0
| | | | | | | | | The recorder Status is quite redundant with respect to the recorder State. The utility of providing information about the Starting and Finalizing states is questionable. Change-Id: I739e0339c26a8c5d70c425dc0023a1868c958875 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Add metadata to audio and video capturing on darwinDoris Verria2021-06-231-0/+89
| | | | | | | | | Add and retrieve common and format specific meta data. Pick-to: 6.2 Change-Id: I3e3f0ffdff52b8cf6e2079fdc1536b130c65773f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Rename QCameraImageCapture to QImageCaptureLars Knoll2021-06-171-10/+10
| | | | | | | | Fixup the backend class and file names while we're at it. Change-Id: Ib0928dfebb6f127b7a43683b2907420c95af6599 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove QCamera::StatusLars Knoll2021-06-171-12/+5
| | | | | | | | The enum is not really useful. Instead isActive() and error() provide all the information required. Change-Id: I2856c833745e79f74bb2a9d95f0ef65eafd24413 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Rename QCamera::cameraInfo to cameraDeviceLars Knoll2021-06-161-10/+10
| | | | | | | | And take the opportunity to clean up variable naming as well. Change-Id: I510cc8295b8d35554534a3c2ac9d83bf6f5a9d65 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io>
* Get rid of QMediaEncoderSettingsLars Knoll2021-06-161-3/+1
| | | | | | | | | | As per API review, fold this class into QMediaRecorder as that's the only place where it is being used. This removes one level of indirection from the API and also makes it possible to use from QML. Change-Id: Id9157df04512382cce28e89b082433ec67d36b28 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Rename QMediaEncoder to QMediaRecorderLars Knoll2021-06-161-13/+15
| | | | | | | | As per API review, this is the better name. Since we removed the old QMediaRecorder class, the name is free as well. Change-Id: I1ec9af3876af8b6957e20c13f9e225bf1e5032d5 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Rename QCameraInfo/QAudioDeviceInfo to QCamera/AudioDeviceLars Knoll2021-06-081-14/+14
| | | | | | | | | Those classes represent the physical device and it's properties, thus that name fits best. Change-Id: I0f45fc875ae6110452c1f2fb17f32adbe5155d01 Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Attempt to make the qcamerabackend test passLars Knoll2021-05-261-0/+1
| | | | | | | | | | | | | Blacklist things that are not yet implemented. Fix a nullptr dereference. There is still some race condition in testCameraStartParallel() that leads to occasional crashes. Change-Id: I35242bc88853870386d09fd6150d7bb8bd137674 Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Some smaller test fixesDoris Verria2021-05-261-1/+1
| | | | | Change-Id: If35ad376f2ca96e740117c71d0e5cc950da9302c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Some QCamera API cleanupsLars Knoll2021-05-251-2/+5
| | | | | | | | | | | | | | * Add QCamera::Features flags to determine supported features. * Rename (manual)shutterSpeed to (manual)ExposureTime, as digital cameras don't have a shutter anymore. Implement support for those feature flags on gstreamer, and add support for querying iso sensitivity, exposure time and setting a manual iso value. Change-Id: I776aa4bc11b02e4de4b02fe33aaccfb83e220ef7 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix tst_qcamerabackend failures for macOS and iOSDoris Verria2021-05-231-6/+6
| | | | | | | | | | | | - Blacklist testCameraStartParallel on iOS as it doesn't seem to support two active capture sessions at the same time. - Fix some erroneous values. - Add some missing keys to the Info.plist. * Blacklist testCameraCaptureMetaData for macOS/iOS for now as it's not yet implemented. Change-Id: If889b7e4537c4f08ea810926420da59bd985e8e1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Correctly resolve the actual output file for QMediaEncoderLars Knoll2021-05-211-24/+26
| | | | | | | | | | | The gstreamer media encoder remembered the last location as something that could be re-used for the next encoding run. Fix that and ensure it'll pick a new file name if the requested output location is empty. Change-Id: I02077c8632fc106701e8c5081ee8b5e1361b18df Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>