summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Fix mediaplayer scroll issue if stream duration is missingJøger Hansegård2023-08-101-13/+59
| | | | | | | | | | | | | | | | | If a media file is missing per stream duration data, the mediaplayer slider operations to scroll in video would restart the video from start. The cause of the issue was that the mediaplayer duration was calculated from the stream durations and became 0. The ffmpeg demuxer already has more advanced heuristics to calculate the media file duration, and this patch fixes the issue by also taking the media file duration into account. Fixes: QTBUG-115747 Change-Id: I906f62c15ffdccadf1da07a75a109961d897b1b0 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> (cherry picked from commit 42107b9d263802d361451c00c8b623fcd45e6922) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix possible reason of video sink frame setting test flakynessArtem Dyomin2023-08-031-1/+2
| | | | | | | | | | | | Let's filter possible end frame handling. Change-Id: Ib46b131f85afe2fc27ab144d573e0b8bd5e4daf2 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Pavel Dubsky <pavel.dubsky@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit fb9b9a313d856a196ba3c5aae53299457f8dfe01) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Refactor DarwinAudioSink and PulseAudioSink and run CI testArtem Dyomin2023-07-145-94/+783
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - the main change: implemented QAudioStateMachine allowing atomic state changing. The main reasons for creating the state machine: * get rid of state changing race conditions without mutex lockings and contentions. * it's good to have a common approach for audio states changings and notifications. The implementation of the state machine supports synchronization of actions after states toggling (turned off for pulse slink sinse it has own synchronization approach). Other audio sinks and sources might be refactored in the future. - remove a hack in PulseAudioSink with a callback based on QObject::destroyed connection, the hack appeared to cause a memory leak time-to-time. - the main business logic is not changed Testing: - tested manually on linux and macOS - auto tests * Linux QAudioSink tests became working locally and on CI. * macOS tests work locally, on CI only one test is blacklisted due to the issue not related to race conditions. Task-number: QTBUG-113194 Change-Id: I68002c243dea874c4309b14b1fbd7b618392ab1f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> (cherry picked from commit feffdf7cfef2d2ca69906aca9a11fe46acee7fa4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix screen capture testsArtem Dyomin2023-07-071-13/+15
| | | | | | | | | | | * Don't check the last null video frame from QMediaPlayer * Use receiver for video frames to ensure safe queued connection Change-Id: I70798b0b99abcc53d180e36bc80cabc1cc30ead2 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> (cherry picked from commit 0d0ed1b411143141cfb42bb4299c7bd0085e04cb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix QMediaCaptureSession::windowCaptureChanged emission on the capture deletingArtem Dyomin2023-06-271-0/+4
| | | | | | | | | | Applying the same approach as for othes captures. Adding a unit test for this. Change-Id: Ifa8fcf7e644ab481d7b710540ff4be71af4c8974 Reviewed-by: Lars Knoll <lars@knoll.priv.no> (cherry picked from commit d337f194cf8b8d03d1d4002af31568f6b957a451) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Implement initialization of video devices on the first connectionArtem Dyomin2023-06-2617-52/+165
| | | | | | | | | | | | | | | | | | | | | | | The problem is that VideoDevices are created and managed by QPlatformMediaIntegration, but signals are connected to QPlatformMediaDevices. A possible redesign is here codereview.qt-project.org/c/qt/qtmultimedia/+/484647, but the concern is that it's a bit of controversy with the initial idea. Current patchs solves the poblem directly and covers with UTs. Idea of the patch: let's handle connection to QMediaDevices::videoInputsChanged and initialize QPlatformMediaIntegration and video devices connection. I propose postpone initialization because users don't expect us doing any serious magic just on the signal connection. The UTs were slightly refactored in order to test the case. Change-Id: I0ca3dfb2126daf69746380fa65096d9d05327f5e Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> (cherry picked from commit 3d23c26565f087c2be2bb13cb511536ab05ab4d6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix QMediaCaptureSession::screenCaptureChanged emission on the capture deletingArtem Dyomin2023-06-261-12/+34
| | | | | | | | | | Applying the same approach as for other captures. Adding a unit test for this. Change-Id: Ie7e9b6c7e82d134508e4d0e5a9b5b9558bfe928f Reviewed-by: Lars Knoll <lars@knoll.priv.no> (cherry picked from commit 6cb1630edf81845f9c05d005f5e8c3ef13ac4156) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Refactor internal design for QWindowCapture implementationsArtem Dyomin2023-06-233-15/+21
| | | | | | | | | | | | | | | | | | | The idea is having internal naming ***SurfaceCapture for those ones that can capture windows and screens, and specific naming ***ScreenCapture, ***WindoiwCapture. QPlatformSurfaceCapture is a base class that is able to work with both, screens and windows. It should be useful since there's a bunch of similar code for screens a windows copturing. It's the first step of the refactoring, other steps are coming soon. Change-Id: I9b03e4d0b1129f8d39a16195fe3261001eb451f4 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 2bca3087d2b48bed46e6d959b35ebf34d5d256ac) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Renamings before QWindowCapture integrationArtem Dyomin2023-06-225-23/+23
| | | | | | | | | | | QPlatformScreenCapture will be used for both, screens and windows. Change-Id: I987dfc39f9558f9719b41e490c67de036cb07a5c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> (cherry picked from commit aff72ee9082ae770746b4da9ddafa1a867ba31d2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Handle QMediaPlayer outputs corner casesArtem Dyomin2023-06-021-2/+162
| | | | | | | | | | | | | | | | | | | | | - Clean-up the video sink frame after stop, QMediaPlayer deleting, and after setting new media. - ensure no frames lost if change QVideoSink - ensure no frames sent after changing of outputs. The patch fixes problems with tests on Android, summarizing of the related commits: codereview.qt-project.org/c/qt/qtmultimedia/+/472214 codereview.qt-project.org/c/qt/qtmultimedia/+/470890 codereview.qt-project.org/c/qt/qtmultimedia/+/472052 Users want to have flush mode customization as it was it Qt5. It might be added in 6.6 afterwards. Fixes: QTBUG-112173 Task-number: QTBUG-111912 Change-Id: I0e4d34de06fcf23adf8a5736cbff4119478e9baf Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Add QWindowCapure and QCapturableWindow for window capturingArtem Dyomin2023-06-021-14/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The design of QMediaCaptureSession already uses different types and setters/gettes for each video source, like QCamera, QImageCapture, and QScreenCapture, so a new source type, QWindowCapure, has been added instead of extending QScreenCapture. For now we only cover the case of capturing windows enumerated though the capturing API itself, via a list of QCapturableWindow instances, as this is considered the primary use-case for such an API. An extension to this would be to add a QWindow overload to either QCapturableWindow's constructor or QWindowCapture::setWindow, to allow capturing of windows in the application itself, either created by Qt, or via QWindow::fromWinId(), but this has been left out for the initial API to keep things minimal. A WId overload has been intentionally left out of this API, as the path for capturing by WId should go via QWindow::fromWinId(). Finally, capture of windows from other applications without enumerating them via QWindowCapure is left out, as adding such an API would require us to build a more generic WId replacement that isn't tied to a single type for each OS, like WId is (it's a NSView* on macOS e.g., but windows can also be represented by CGWindowID). Task-number: QTBUG-103226 Change-Id: I99e3b8bde62250aba35abcedbc8680a299a3cbb2 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix some qmediaplayer tests flackinessArtem Dyomin2023-05-306-29/+37
| | | | | | | | | | | | | | | 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>
* Improve naming of screen capture integration testsJøger Hansegård2023-05-302-19/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Reviewing test logs and maintaining tests can be easier if the tests are explicit in what they test. It can therefore be useful to document in the tests what function is being tested, what the expectation is, and which conditions applies to a test. The proposed naming turns the tests into requirements, and can be read as (Require that) FunctionName DoesWhat UnderWhichConditions. For example: setWindow_selectsWindow_whenWindowIsOverlapped Here, the function under test is setWindow. When it is called, we expect that the window is selected (when capturing). The condition is that the window is overlapped. In some cases, the test may not test a single function, where the proposal is to do as best as we can to document what functionality is tested, what the expectation is, and under what conditions the test is performed. Task-number: QTBUG-113460 Pick-to: 6.5 Change-Id: Ie001e464a4c92d468b5b58160b1cdaa2aea858ee Reviewed-by: Lars Knoll <lars@knoll.priv.no> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* wasm: add manual camera testLorn Potter2023-05-057-0/+555
| | | | | | | | this also tests local video playback Pick-to: 6.5 Change-Id: I82fff701d82f61ed06aa150d357fdede712ae6c0 Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
* Fix tst_QScreenCaptureIntegration::captureSecondaryScreen()Lars Sutterud2023-05-041-7/+4
| | | | | | | | | | | | | | | widgetOnSecondaryScreen is now positioned on the correct screen, avoiding a bug where screencapture would record with frameRate equal to the primary screen's refresh rate. Solution: - Creating the TestWidget with geometry corresponding to secondary screen, using screens.back()->geometry().topLeft().x(); - Sending correct screen size to capture(). Change-Id: I16c19bdfcb0cb713bfc4b7feab92eb3b1c04e716 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Add test for non-ASCII characters in file namePavel Dubsky2023-05-041-0/+27
| | | | | | | | | | | The test is supposed to check whether media file can be opened and played if its name contains non-ASCII characters. Task-number: QTBUG-112707 Pick-to: 6.5 Change-Id: I9703869039cfdb9c5f994d5403f1bbfd0d23118e Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Fix compiler warnings from mixing int and size_tVolker Hilsheimer2023-04-252-6/+6
| | | | | | | | Since the internal datastructures in the tests use std::vector, we cannot compare their size() to int literals without upsetting MSVC. Change-Id: I4f657a8ca4081ac30da8a438c89b829e1856f914 Reviewed-by: Doris Verria <doris.verria@qt.io>
* Fix qmediaplayer tests flakyness with QSignalSpyArtem Dyomin2023-04-191-1/+5
| | | | | | | | | | | | QSignalSpy is not safe if signals are emitted from another thread, on windows the collision of removing QSignalSpy and receiving a new frame occurredpretty often (around 20% of running attempts). Catching the signal in the main thread fixes the problem. Pick-to: 6.5 Change-Id: Id9630a5ee32e261b308ea61dc0a61b424f5239c0 Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Android-tests: Fix tst_qscreencapture_integration part 5Bartlomiej Moskal2023-04-171-1/+2
| | | | | | | | | | | | | | | tst_QScreenCaptureIntegration testset is currently Blacklisted on CI for Android platform (also for Windows, MacOs and Linux). This commit contains part of fix for the testset. This commit turns on mentioned testset for Android on CI. Only recordToFile test will be still blacklisted according to QTBUG-112827 Task-number: QTBUG-112176 Task-number: QTBUG-112827 Change-Id: I6b9a35d663bf980550a7f3d91b172de007ede5d3 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Android-tests: Fix tst_qscreencapture_integration part 4Bartlomiej Moskal2023-04-171-0/+12
| | | | | | | | | | | | | | | tst_QScreenCaptureIntegration testset is currently Blacklisted on CI for Android platform (also for Windows, MacOs and Linux). This commit contains part of fix for the testset. Android is not the underlying windowing system. Skip the tests that rely on windows: captureWindow, captureWindowById, captureOverlappedWindow, removeWindowWhileCapture. Task-number: QTBUG-112176 Change-Id: Ifede4f041dfd9629c9ca16eeef7e1e63fd3653ca Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Android-tests: Fix tst_qscreencapture_integration part 3Bartlomiej Moskal2023-04-171-2/+10
| | | | | | | | | | | | | | tst_QScreenCaptureIntegration testset is currently Blacklisted on CI for Android platform (also for Windows, MacOs and Linux). This commit contains part of fix for the testset. Android is not the underlying windowing system. Set tested widget as Popup type to force changing position by setGeometry method. Task-number: QTBUG-112176 Change-Id: I3e4fb766075977bea83ddd89e56e185442c1e82a Reviewed-by: Lars Knoll <lars@knoll.priv.no> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Android-tests: Fix tst_qscreencapture_integration part 2Bartlomiej Moskal2023-04-171-1/+4
| | | | | | | | | | | | | | | | | | | | tst_QScreenCaptureIntegration testset is currently Blacklisted on CI for Android platform (also for Windows, MacOs and Linux). This commit contains part of fix for the testset. Expected captured screen size was calculated as multiplication screen size and device pixel ratio. Such multiplication may not return an integer value (when device pixel ratio is not integer). For example when screen size is 393x873 and pixelRatio is 2,75 expected caprutered screen size is 1081x2401 (because of rounding 1080,75x2400,75). This commit, to avoid wrong rounded values, uses qFloor to calculate the expected size of the captured screen. Task-number: QTBUG-112176 Change-Id: Ib3daaf93e609b96e2d51efb8a4640f45a9125329 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Android-tests: Fix tst_qscreencapture_integration part 1Bartlomiej Moskal2023-04-171-0/+7
| | | | | | | | | | | | | | | | | | | | | | tst_QScreenCaptureIntegration testset is currently Blacklisted on CI for Android platform (also for Windows, MacOs and Linux). This commit contains part of fix for the testset. According bacf9cd04c21c62075087febe0a799ed8d1c5f8c commit (in qtBase module) grabWindow handling works on Android only for QtWidgets application. To make this feature work, we need to have visible raster window. Otherwise, activation of QMediaCaptureSession will failed with an error: "Failed to grab the screen content" Therefore, an additional QWidget is created. We also need to wait some time to make sure that doRedraw was finished. Task-number: QTBUG-112176 Task-number: QTBUG-112855 Change-Id: I5599c2800c7a41e6fc0168b6ffe6835aeeb3bc89 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Fix threading problems of QVideoSinkArtem Dyomin2023-04-151-0/+35
| | | | | | | | | | | | | | - change notification signals should be emitted out of the mutex since it causes a deadlock if the user connects directly and call QVideoSink getters. - currentVideoFrame should be under the mutex since frames assignment is not atomic. - minor clean up with moving to cpp file. Pick-to: 6.5 Change-Id: I07a7e54108c100cd18dc71c88acd93a5622bd2f5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* 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>
* Android-Tests: Skip few tests from tst_qmediaplayerbackendBartlomiej Moskal2023-04-141-0/+9
| | | | | | | | | | | | | | There is known issue with creating hardware frame context for video renderer (QTBUG-108446). Because of that, frame.toImage() method returns invalid qImage object. Tests should be skipped until QTBUG-108446 is fixed. Task-number: QTBUG-112173 Task-number: QTBUG-108446 Pick-to: 6.5 Change-Id: Ia6d0d5dd2b005e3312d94d1dbe62f0b6d173217a Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Fix a few memory leaksArtem Dyomin2023-04-131-10/+11
| | | | | | | | | | - avcodec_open2 doesn't take ownership of options - fix not deleted surface in tests Pick-to: 6.5 Change-Id: Ia410792b27af4ef5ccaf1c6774344d3b6571952a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Implement seamless ffmpeg playback loopingArtem Dyomin2023-04-121-11/+106
| | | | | | | | | | | | | | | | | | | | | | | Users need seamless looping, in other words, looping without little delays on jumping from the media end to the start. The only way to make it seamles and smooth is to intrude into the playback engine. As result, we have just a regular delay between frames on shifting. Also, a bunch of adjuscent small improvements have been introduced: - simplify criteria of the demuxer's buffer size, it was more complex and a bit not relevant before. Actually, we need to check only max buffering time. - Improve handling of media with streams of different length. - Fix setting of the playback rate before opening sources. - Add new auto tests for looping. - Add debug logs. Pick-to: 6.5 Task-number: QTBUG-112305 Change-Id: Ic9073d77535f5aae19f9ea48d4e745c9f2fa9ea3 Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Android-tests: Remove QEXPECT_FAIL from tst_qmediaplayerbackendBartlomiej Moskal2023-04-061-12/+0
| | | | | | | | | | | | Android is using now ffmpeg backend by default. That is why all QEXPECT_FAIL macros can be removed from tst_qmediaplayerbackend. All of them were related to android-backend (QTBUG-96952). For FFmpeg this QEXPECT_FAIL is not valid. Task-number: QTBUG-112173 Pick-to: 6.5 Change-Id: Ic36f8de9852d501837e3459ae8cdb133545075c1 Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Tests: fix for tst_QAudioSink testset part 2/2Bartlomiej Moskal2023-03-301-1/+0
| | | | | | | | | | | | | | | | | | | | | tst_QAudioSink testset is currently skipped on CI. Need to be fixed. This is part of the fix related with running tests on Android. In the pullResumeFromUnderrun test, the signalEnd was set to true before resuming pull. That is why, AudioPullSource::atEnd will also return true after reading all the data. UnderrunError should be set when "Audio data is not being fed to the audio device at a fast enough rate", but the error should not be set when all data has already been read. That is why it should not be expected to get UnderrunError at the end of the test. This commit removes comparing error state to UnderrunError at the end of the pullResumeFromUnderrun test. Task-number: QTBUG-112172 Pick-to: 6.5 Change-Id: Ia2a0e40c3227a7819d1bf275f04738a0e780eee0 Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Tests: fix for tst_QAudioSink testset part 1/2Bartlomiej Moskal2023-03-301-1/+1
| | | | | | | | | | | | | | | | | | | | tst_QAudioSink testset is currently skipped on CI. Need to be fixed. This is part of the fix related with running tests on Android. SampleRate was set to 1024 in pullResumeFromUnderrun test. It seems that the sampleRate was too low and may not be supported by some Android Devices. According OpenSLES implementation, the lowest hardcoded Sample Rate is 8000000 milliHertz (8000Hz)[0]. This commit changed sampleRate in pullResumeFromUnderrun test from 1024 to 8000. [0]https://chromium.googlesource.com/android_ndk.git/+/refs/tags/r14b/sysroot/usr/include/SLES/OpenSLES.h#157 Task-number: QTBUG-112172 Pick-to: 6.5 Change-Id: Iebc673558afb1219423ccd138539284e42d9c8be Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Fix signedness difference in comparisonEdward Welbourne2023-03-301-1/+1
| | | | | | | | | The intervals list apparently has an unsigned size(), not a signed one like Qt containers do. So compare to an unsigned integer literal. Pick-to: 6.5 Change-Id: I13563b6a92643b778eb918b5832c81a1b67b1352 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>
* Tests: fix failing tst_qaudiodecoderbackend on AndroidBartlomiej Moskal2023-03-271-4/+14
| | | | | | | | | | | | | | | Test set contains testFileUrl method. Inside the method QTemporaryFile was used for Android. Calling deleteLater on it, schedules this object for deletion. On some tests (like restartOnBufferReady) temporaryFile was destroyed too fast and the test may be finished with error because of that.  This commit contains the fix for a better control of deletion QTemporaryFile for Android (in tst_qaudiodecoderbackend). Fixes: QTBUG-112171 Change-Id: I568c75374aa16018b5dc67d31b733ceb65e91a70 Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Implement the base video source class for camera and screen capturingArtem Dyomin2023-03-221-1/+1
| | | | | | | | | | | | QPlatformVideoSource becomes the base of QPlatformCamera and QPlatformScreenCapture The advantage is using the single video source interface in the encoder instead of defferent ones. Pick-to: 6.5 Change-Id: Ic8bab3258dbe3efe851330d9a0e0461266dc64c9 Reviewed-by: Lars Knoll <lars@knoll.priv.no> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Extend recordToFile() in tst_qscreencapture_integration.cpp w/windowLars Sutterud2023-03-141-5/+61
| | | | | | | | | | | | The test now checks the recorded file for errors by measuring color changes at one pixel point of multiple frames at the start and end of the file. Task-number: QTBUG-103226 Pick-to: 6.5 Change-Id: I07b47f6482b868fc68c967d558f89838bf705ed5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Tests: check camera activity in tst_qmediacapturesessionBartlomiej Moskal2023-03-101-0/+15
| | | | | | | | | | | | | | | | | Make sure that the camera activity was correctly set when it should be. 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. Activity checks perform the function of synchronization which is necessary for android, but can be also valuable for other platforms. Task-number: QTBUG-99098 Pick-to: 6.5 Change-Id: I65388d92fe55fb17f0aa1ca1c0fc86e84651299a Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Fix setting pixel format to AVFVideoSinkDoris Verria2023-03-093-0/+103
| | | | | | | | | | | | | | | | | | | | | - When lazy loading the video, the output settings dictionary was invalid. Properly initialize and release m_outputSettings to fix. - Unify and refactor code to set the output settings and pixel format - Set the pixel format only once rhi is set on the sink so we know the rhi backend. This is because the openGL backend accepts only RGBA pixel format. - Fix the incorrect assigning of a QVideoFrameFormat::PixelFormat to avPixelFormat when the rhi was openGL. Fixes: QTBUG-110868 Fixes: QTBUG-110812 Change-Id: I98de219bcc94dad04c4db9ea22aeb852dc2a193b Pick-to: 6.5.0 6.5 6.4 6.2 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Disable flaky tst_qcamera testArtem Dyomin2023-03-081-0/+4
| | | | | | | | | | | | The previous attempt to fix it failed, the best option now is to turn it of and fix under a separate ticket. Ticket-number: QTBUG-111812 Change-Id: Ia1d86ae758f22143ed589f54312836c66bbf3070 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 0f4e33e347142fe4ae9b497f2aa6428e5217b20d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Temporarily disable new tests on macOS CIArtem Dyomin2023-03-061-1/+13
| | | | | | | | | | These tests crash accidently on macOS CI, not reproduced locally. They will be turn on after figuring out the problem. Task-number: QTBUG-111744 Pick-to: 6.5 6.5.0 Change-Id: I0894afa356a9d34eaa5e6813fb106c656b310b22 Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Implement looping for ffmpeg mediaplayer backendArtem Dyomin2023-03-051-0/+114
| | | | | | | | | | | - Looping of ffmpeg mediaplayer has been added with auto tests - Minor code cleanup (that left from previous implmntations) Pick-to: 6.5 Task-number: QTBUG-111209 Change-Id: I3839ee866bc2dc571919e41a18b093fb15165293 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Fix audiosink issues on darwinArtem Dyomin2023-03-031-27/+120
| | | | | | | | | | | | | | | | | Fixed problems: - Fix sound stucks on multiple resets/starts of QAudioSink. It was possible to reproduce on playback position change in mediaplayer. - Improve audiosink stop (reduce waiting time). The optimization is based on the fact that it's possible to call AudioOutputUnitStop from the thread where it was started. - add some auto test + imrove errors logging in tests. Tests work fine locally but still need some tune on CI Pick-to: 6.5 6.4 6.5.0 Task-number: QTBUG-111567 Change-Id: I0eb5c32af4c12dfc0694ee8f5967b4960a0b4ab2 Reviewed-by: Doris Verria <doris.verria@qt.io>
* Fix ffmpeg encoding issuesArtem Dyomin2023-02-173-21/+97
| | | | | | | | | | | | | | 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>
* Implement custom X11 screen capturingArtem Dyomin2023-02-121-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The implementation works on linux with run X11. It's disabled with wayland. Achivements - Fixed problem with performance. The standard implementation affected CPU too much. On my local release build the speedup in capturing of a single frame is 4-5 times. The explanation of such a huge difference is that opening of capturing contexts on X11 is an expensive action, whereas implemented single context allocation and transferring images through shared memory (Xshm) is pretty fast. Also, QScreen::grabWindow permorms additional pixels processings under the hood what is not needed for videoframes. - Improved errors handling - The patch allows to run screen capture backend UTs on linux CI with X11, namely, ubuntu, opensuse. Test results: https://testresults.qt.io/coin/integration/qt/qtmultimedia/tasks/web_qt_qtmultimedia_1675977558004 - Probably, fixed problem with windows overlaping, the matching tests became pass, it should be checked on different platforms. Also, the approach cannot capture windows out of the screen borders, we throw an error signal. Both windows issues are to be investigated deeper in 6.6. With the next commits I might move some common threading code for SC to a separate class. Task-number: QTBUG-103226 Pick-to: 6.5 Change-Id: Ibd3600fdbc9714f14dc80c2a330aea5e0d064791 Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Rewrite screen capturing on macosArtem Dyomin2023-02-071-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | The previous generic implementation uses QScreen::grabWindow that is not stable for both cases, screens and windows capturing. In order to fix it, I've reimplemented it via native macos functionality. Some part of the functionality is shared with avfcamera. As a result, we got the following: - fix not capturing of some windows on the screen - enable hw acceleration for screens capturing (shared with camera functionality) - enable foreign app windows capturing (by CGWindowID as WId). We might need some additional api for getting the list of ids. Probably, the code is reusable for ios, to be investigated. Screen capturing tests work locally if permissions are granted; on CI some problems with giving the permissions. Task-number: QTBUG-103226 Pick-to: 6.5 Change-Id: Iada34467e4b9074eb43a1fbbdc4409e663ea668a Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Fix behavior of QAudioSink::resume in push modeVolker Hilsheimer2023-02-061-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Up to now, a QAudioSink in push mode (ie. started without a QIODevice, but returning a QIODevice buffer that the client has to push data into) transitioned to IdleState when resuming after a suspend, even if there was still data in the buffer or device to play. This resulted in the sink playing audio even though it was in IdleState, and the client not getting notified when the audio data was actually drained (as the stateChanged signal did not get emitted again). Fix this by storing the state in which the sink gets suspended, and restore to that state when resuming. If the sink then runs into an underrun because not enough data is available in the push-buffer, then it will transition to IdleState with UnderrunError later. Implement this consistently in all platform implementations, adjust the test, which previously verified that a push-sink transitions to IdleState when resuming, and change the documentation accordingly. [ChangeLog][QtMutimedia][QAudioSink] Calling QAudioSink::resume() now returns the sink to the state it had when QAudioSink::suspend() was called, no matter whether the sink operates in pull or push mode. Pick-to: 6.5 Change-Id: If0c7fe8629627de814276d629d825e469c998d2d Reviewed-by: Lars Knoll <lars@knoll.priv.no> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Clean up and fix QAudioSink::pullResumeFromUnderrun testVolker Hilsheimer2023-02-051-35/+40
| | | | | | | | | | | | | | | | | | | When the source is drained completely, then the sink should become idle with UnderrunError. Replace QVERIFY(actual == expected) with QCOMPARE, and move the source-class into the test function (without unneeded Q_OBJECT). Replace hardcoded constants with named variables and calculated values. This test function now passes with the Darwin audio sink. It still fails on Android as the sink doesn't correctly emit stateChanged. The test crashed on Windows before (and still crashes), and still fails with the PulseAudio backend (too many signal emissions at the beginning). Pick-to: 6.5 Change-Id: I876e3b6b70caa90b8261bd1360b3790f2a7166c8 Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Change blacklisting of tst_QVideoWidget::fullScreen to androidHeikki Halmet2023-01-221-1/+1
| | | | | | | | Task-number: QTBUG-110453 Change-Id: Iaf7f8dce951174aa1bf46e1fe261b49ae336db33 Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io> (cherry picked from commit 6220c1036e576d232d3a9cc3e71d89367b838f1c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Blacklist tst_QVideoWidget::fullScreen for Red Hat 8.4Heikki Halmet2023-01-211-0/+3
| | | | | | | | Task-number: QTBUG-110453 Change-Id: I3be638d836368ada78ce64d9771995e158a6baa9 Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io> (cherry picked from commit bc43e99c57f84e8d8fe6773c71de1181d4a173e1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>