summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Fix build with ffmpeg swrresample version < 4.9.100v6.7.0-beta2Artem Dyomin2024-01-242-2/+11
| | | | | | | | | | | | swr_alloc_set_opts2 takes 'const AVChannelLayout*' from LIBSWRESAMPLE_VERSION 4.9.100 Fixes: QTBUG-121455 Pick-to: 6.6 6.5 Change-Id: I06812f9efedd53e12152fb3cf1574ad8c7c61d27 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> (cherry picked from commit b0cffad4411a0c8d6469a892bcf98cf4384ae6f5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Implement fixing of QImage by QImageVideoBufferArtem Dyomin2024-01-233-3/+57
| | | | | | | | | | | | | | | | Many of QImage formats are not mapped to QVideoFrame formats without conversions. Let's consider this and ensure a correct video frame format. Eglfs screen capture is to be fixed in the next commits. The relevant unit test is added to the patch. Pick-to: 6.6 6.5 Change-Id: Ic4a490392ec2b6aa63e752badea7269a07d93af9 Reviewed-by: Lars Knoll <lars@knoll.priv.no> (cherry picked from commit f9edbcb7fedcd7e2e2c274dcda1979e304245b32) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix conversion of QImage::Format_RGBA8888_Premultiplied to PixelFormatArtem Dyomin2024-01-231-1/+3
| | | | | | | | | | | | | | | | QImage::Format_RGBA8888_Premultiplied should be converted to QVideoFrameFormat::Format_RGBA8888_Premultiplied which is not present in the list of formats. It should be added in 6.8. We've got the format on eglfs, when we grab a frame by OpenglCompositor. The best workaround is conversion to QVideoFrameFormat::Format_RGBX8888. Pick-to: 6.6 6.5 Change-Id: Ic84d47f62c379e4a476a868b2985b525c0ec7edb Reviewed-by: Lars Knoll <lars@knoll.priv.no> (cherry picked from commit bdc9e0a2e30d2a7a7edf0c52630eb8137038cd89) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Apply API review comment: qmmetaobject.h => qobjectdefs.hArtem Dyomin2024-01-231-1/+1
| | | | | | | Change-Id: I2c5928a5ca8fe70d0bc0d04e2f3054c9a49699b0 Reviewed-by: Lars Knoll <lars@knoll.priv.no> (cherry picked from commit 6cba346d6e378bcb2c6d26edfc44d7004e8a599c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Implement audio resampler in the ffmpeg pluginArtem Dyomin2024-01-237-30/+62
| | | | | | | | | | | | | | | | | QFFmpeg::Resampler has been renamed and reworked for inheritance from QPlatformAudioResampler. The main purpose of the set of commits is to align the sound played by QMediaPlayer and QSoundEffect. The classes have different volume levels and channel mixing factors if we use ffmpeg resampling in one and doesn't use in another one. Pick-to: 6.6 6.5 Task-number: QTBUG-118099 Change-Id: I01cb909de756d5e7cd0f1c40e749f186efd2f649 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> (cherry picked from commit 5d1c4ae289a1e22662c7c7c192481b386a21a84c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Implement audio resampling in QSoundEffectArtem Dyomin2024-01-234-3/+76
| | | | | | | | | | | | | | | | | | The resampling in QSoundEffect is needed to align the audio playback functionality with QMediaPlayer, otherwise, we get different volume levels when channels configurations of the source file and the audiodevice are different. QMediaPlayer uses ffmpeg resampling, so QSoundEffect is supposed to use it too. FFmpeg implementation is to be added in the following commits. Pick-to: 6.6 6.5 Task-number: QTBUG-118099 Change-Id: I24d0ca394635d53e8fdd4b09f328725dd4f51027 Reviewed-by: Lars Knoll <lars@knoll.priv.no> (cherry picked from commit f0016c4763361292c3eaf153e184b9b110f44c61) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix abrupt termination during static destruction in QtMultimediaJøger Hansegård2024-01-222-3/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Breaking change: After this change, QtMultimedia requires a QCoreApplication to access or enumerate media devices (microphone, speakers, and camera). During destruction, a Windows application using QtMultimedia could exit with success return code without having called all static destructors. The root cause of the issue was that the internal QWindowsMediaDevices singleton was making outgoing COM-calls during static destruction. This is not handled well by the COM runtime, and resulted in NtTerminateProcess being called from within the implementation of Microsoft IMMDeviceEnumerator::UnregisterEndpointNotificationCallback. After this point, destructors were never called even if the application returned 0, indicating success. This patch fixes this issue by ensuring that the QWindowMediaDevices instance are deleted when the QCoreApplication is terminated, instead of waiting until static destruction. If no QCoreApplication exists, a warning is emitted, and destruction is executed as before, with possible interruption of static destructors. Fixes: QTBUG-120198 Pick-to: 6.6 6.5 Change-Id: I52a2b355052d61333fbff382dc4d4cd059d99d52 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> (cherry picked from commit 44f1e17d2843851d00c546f944582ab3fb409a45) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* EVRCustomPresenter: skip samples that came too lateVladimir Belyavsky2024-01-221-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | In some cases, the mixer may produce output samples that are already stale, i.e. their presentation + duration extends beyond the current clock time. This occurs when the video file's native sample rate exceeds the actual video frame rendering rate. This is especially true when HW acceleration is not used, so we spent more time presenting each video frame. The current implementation simply schedules _all_ video samples for presentation, which can lead to problems when the video plays at a slower speed and reaches the end later than expected. So, to solve this, just check if the sample time is already passed, and if yes - discard, i.e. return it to the pool immediately. Fixes: QTBUG-118587 Pick-to: 6.6 6.5 Change-Id: I449e4ea7ef7b74a843e12ce7f488bc10c5087f76 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> (cherry picked from commit ecf836403022d766b4c38b9f413d551939cfb059) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix regression causing asserts with FFmpeg media playerJøger Hansegård2024-01-221-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | While fixing bumpy video playback on Windows with FFmpeg, we introduced two regressions that cause application to assert in debug (3363496a7f0a0690bc3a2e50172cf6563f198701). These bugs were not discovered because I was testing with a WARP device, not a proper GPU. The first issue is that the shared texture between FFmpeg and RHI was created with 0 mip levels. This causes validation error in the D3D debug layer, and causes assert when playing the first frame. The fix is to set 1 as MipLevels. The second issue is that when opening a second file in media player, we did not close the shared handle before recreating it. This causes an assert. The fix is to close the handle first. Task-number: QTBUG-111815 Task-number: QTBUG-115308 Task-number: QTBUG-111459 Task-number: QTBUG-109213 Pick-to: 6.6 6.5 Change-Id: Ifd621b174fc68ef50e40cb3ad2d1c4bd410cf15e Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> (cherry picked from commit 10ba74ebc89c8134f6bbb126aae7667a92b45742) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Implement lazy initialization of CapturableWindowsArtem Dyomin2024-01-225-18/+36
| | | | | | | | | | | | | The patch initializes CapturableWindows lazily as its instance is needed only in specific cases. Pick-to: 6.6 Change-Id: Ib80dc92b44127a908f47ec893235bece6ec2ef40 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> (cherry picked from commit 4a341efa63036ded55a753c6d723a66afcdaf1c8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Implement lazy initialization of VideoDevicesArtem Dyomin2024-01-2214-31/+73
| | | | | | | | | | | | | | | 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.6 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>
* Fix style issues in qffmpeghwaccel_d3d11Jøger Hansegård2024-01-212-25/+17
| | | | | | | | | | | | | | This patch auto-formats the files and fixes minor style issues in the code, including use of c++ casts instead of C-style casts and prefer anon namespace over static variables. Also, include order is improved, and a member function is made const. Pick-to: 6.6 6.5 Change-Id: Id9bc1bcab773fdf550341623b37a11e13c339290 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Pavel Dubsky <pavel.dubsky@qt.io> (cherry picked from commit b2b1d2b1784cb0af37e0d9b9b128f6d44bdbf30e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix bumpy video playback on Windows with FFmpeg using synced texturesJøger Hansegård2024-01-192-69/+241
| | | | | | | | | | | | | | | | | | | | | | | | | We have been facing issues with bumpy video playback when attempting to keep the decoded textures on the GPU to avoid copying decoded textures to the CPU. This is seen as stuttering in the video playback, and it looks like we are switching between new and old frames during playback. A root cause for this can be that we used texture sharing without properly synchronizing access to it. This patch fixes this issue by using synchronized surface sharing as recommended by Microsoft documentation. This patch also reduces the number of per-frame texture allocations. This way we get flicker free rendering during video playback. Task-number: QTBUG-111815 Task-number: QTBUG-115308 Task-number: QTBUG-111459 Task-number: QTBUG-109213 Pick-to: 6.6 6.5 Change-Id: I6ed34051f138fc845d60b4208fdbef2ae7d68189 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> (cherry picked from commit 3363496a7f0a0690bc3a2e50172cf6563f198701) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Move creation of ffmpeg audio resampler to utilsArtem Dyomin2024-01-193-41/+91
| | | | | | | | | | | | The refactoring is needed for the implementation of QPlatformAudioResampler in the next commits. Pick-to: 6.6 6.5 Task-number: QTBUG-118099 Change-Id: I6372dcba41011717c78bd586adf6c38dba8466d9 Reviewed-by: Lars Knoll <lars@knoll.priv.no> (cherry picked from commit c2f4dae915b8d341a316739a12c0be81abfb836d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Minor cleanup in QSoundEffectArtem Dyomin2024-01-191-41/+57
| | | | | | | | | | | | * rename m_audioOutput -> m_audioSink in order not to mix it up with QAudioOutput * use unique_ptr Pick-to: 6.6 6.5 Change-Id: I2d23e6fb36ba6691c4d5c6fd030f2eb3ec193717 Reviewed-by: Lars Knoll <lars@knoll.priv.no> (cherry picked from commit 61f2d81206ca08361fab2c0c3fc3441e764cc84a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Android: Fix thread race in audio sink for bufferAvailableBartlomiej Moskal2024-01-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | tst_qaudiosink was flaky on Android. There reason was possible thread race when calling bufferAvailable method in QAndroidAudioSink implementation. While one call of bufferAvailable was invoke from QT source on QAndroidAudioSink thread, other call could come from OpenSL ES engine on different thread. That coused the thread race. To fix the problem, bufferAvailable will be called always from QAndroidAudioSink thread. Additionally turned of testdata with Sample Rate 44,1 MHz for tst_QAudioSink for 23 API (because of crash on emulator x86 API 23) Pick-to: 6.6 6.5 Fixes: QTBUG-118572 Change-Id: I8b23c871031d4b243e4c39771db83bd5a02260e3 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit c60c9c9abfb42d99b257a73198f6bb66ace76a2a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Update parameter names in QML ImageCapture's signalsBartlomiej Moskal2024-01-171-12/+11
| | | | | | | | | | | | The ImageCapture QML type contains invalid signal parameter names in the documentation. They should be changed so that they do not mislead users. Pick-to: 6.6 6.5 Fixes: QTBUG-118593 Change-Id: Icb4e46e1081a0b1bfc3eab1362a006eabeab5f7e Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io> (cherry picked from commit dd3701e6c8497947d73ac588c59726a049f50ca0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QVideoWindow: Recreate swapchain if it was previously destroyedDoris Verria2024-01-171-1/+1
| | | | | | | | | | | | | | We release and destroy the swapChain on a PlatformSurface event. If the window is render()-ed again after this, we need to recreate the swapChain using QRhiSwapChain::createOrResize(). Fixes: QTBUG-113498 Pick-to: 6.6 6.5 Change-Id: Ibc8b369c41b9e2e49be4465d6e50e3a5a366e434 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 0fecc9e95244745c88b82964ecda65bbaa53a575) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QVideoWindow: Immediately render window on an Expose eventDoris Verria2024-01-171-1/+1
| | | | | | | | | | | | | | | | | | QWindow::requestUpdate() is used to signal that the window needs to be redrawn (typically because something changed), but the actual drawing will not happen until the next event loop iteration. On an Expose event, we need to immediately draw the window to avoid any delay. Replace the call to requestUpdate() on an Expose event with a direct call to render(), ensuring a prompt window rendering. Pick-to: 6.6 6.5 Change-Id: Ib74c1ca9706fdc6d92ae8ce659a4fc345edc77d5 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> (cherry picked from commit 7318eefeab392d102b9092d649e3f1f3ad12456b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Name flush operation pointerMikko Hallamaa2024-01-161-1/+1
| | | | | | | | | | | | | | | PulseAudio flush operation pointer was unnamed which was flagged by CodeChecker. Now operation is named so it will be deleted at the end of scope instead of immediately, but that should be fine. Pick-to: 6.6 6.5 Change-Id: Iedae2b24253bb1fb515efae61dfb74be11a241ab Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> (cherry picked from commit bda4b38c4dc78c9f97ffa12997e74dfa3121672f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Apply API review comments: fix headersArtem Dyomin2024-01-152-2/+3
| | | | | | | | | | | | | The API review: codereview.qt-project.org/c/qt/qtmultimedia/+/528314 Include <QtCore/qmetaobject.h> cannot be removed as the macros in the file use some QMetaObject functionality. Change-Id: Iecf7585e32d0da1128577448b233e3d052b25d47 Reviewed-by: Lars Knoll <lars@knoll.priv.no> (cherry picked from commit 0bae7e4bf357325c8e64bbf269175f6d39a6dc13) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Apply API review comments: rename QVideo::RotationAngleArtem Dyomin2024-01-1526-90/+101
| | | | | | | | | | | | | | | | | | | | | API review: codereview.qt-project.org/c/qt/qtmultimedia/+/528314 We make the naming consisten with what we already have in another module: doc.qt.io/qt-6/qpdfdocumentrenderoptions.html#Rotation-enum Renamings: namespace QVideo -> namespace QtVideo RotationAngle -> Rotation Rotation::Rotation** -> Rotation::Clockwise** Change-Id: Ie59c30e788478dc4bc21b68a18102aece046960e Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Lars Knoll <lars@knoll.priv.no> (cherry picked from commit 6aa3fa59fb845b20c19a6b043144072bf2c7363e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix conversion of premultiplied rgb formats to ffmpeg formatsArtem Dyomin2024-01-121-2/+4
| | | | | | | | | | | | | | | | FFmpeg doesn't have premultiplied rgb formats, it has 0RGB formats, were alpha component is undefined. In premultiplied components r/g/b components are ready to use, alpha component is supposed to be multiplied with the background. In the light of the above, QtMM premultiplied formats match better 0RGB ffmpeg formats (at least, color components are proper) Pick-to: 6.6 6.5 Change-Id: I6b2810117c7b9d002d7032f905be57962b29e6c5 Reviewed-by: Lars Knoll <lars@knoll.priv.no> (cherry picked from commit 1708bfc413e968683ae2e1d532562ee4e6f29a1b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix build warning on linux regarding qffmpegmediadataholder.cppLars Sutterud2024-01-101-1/+2
| | | | | | | | | | | | | | Fixes a warning introduced by change number 529146 Error message: comparison of integer expressions of different signedness: ‘const int’ and ‘const long unsigned int’ [-Werror=sign-compare] Pick-to: 6.6 6.5 Change-Id: Id91effb01a3abff27d355f605e315ac47b759d47 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> (cherry picked from commit e3817d444d13c0a4c147e50e5a66ff74cabb82d7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix CodeChecker warning in qvideotexturehelperJøger Hansegård2024-01-091-2/+2
| | | | | | | | | | | | | | | | | | | CodeChecker reported warning in qvideotexturehelper.cpp line:638 after commit 70c4bf4c565c3ace547f5cbd0398953fcd1ff4f3 Passing result of std::move() as a const reference argument; no move will actually happen in file:src/multimedia/video/qvideotexturehelper.cpp line:638 col:32 subresDesc.setData(std::move(underlyingByteArray)); This patch fixes this issue by not calling std::move. Pick-to: 6.6 6.5 Change-Id: I04b1fcb4a3e0ce3436f184f4db6ed4b6b512f459 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Lars Knoll <lars@knoll.priv.no> (cherry picked from commit 4f6251cc3f20bf95c6727ea0907a4f7f34dae914) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Fix typosPaul Wicking2024-01-081-2/+4
| | | | | | | | | | | | | | | - Use correct signature in inline code example. - Rephrase the sentence while at it. - Wrap the text at 80 columns (documentation style). - Fix nearby spelling mistake: 'setup' is 'set up' when used as a verb. Fixes: QTBUG-120449 Pick-to: 6.6 Change-Id: I7c89bd69d1b4dc7af2535dee9d90f6a2f95650b8 Reviewed-by: Lorn Potter <lorn.potter@gmail.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 24ec99c5f13e90aecb950ae79a42889440e402dd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add a default PulseAudio buffer lengthMikko Hallamaa2024-01-081-3/+17
| | | | | | | | | | | | | | | | | | | | The target buffer length set by PulseAudio by default is quite long, which causes playback issues in pull mode until the buffer length is adjusted by PulseAudio in subsequent plays to be shorter. This patch sets a default target length if buffer size is not set using setBufferSize(), instead of using the buffer size decided by PulseAudio. This also allows us to conform better to the documented QAudioSink::bufferSize() behavior where it's supposed to return a platform default value if called before start(). Task-number: QTBUG-111045 Pick-to: 6.6 6.5 Change-Id: I67ad7c83cb0f7c34da82a7da7d2f5757f54bdbe5 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> (cherry picked from commit 6ec73a0b6471f311be1092fcff8f97f3b1c9f6c2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fully drain PulseAudio stream when stopping the sinkMikko Hallamaa2024-01-081-9/+30
| | | | | | | | | | | | | | | | | | Currently when a PulseAudio stream is closed, pa_stream_drain is called and the stream is disconnected and deleted, which causes the draining operation to fail. This patch moves stream drain to be handled synchronously when calling stop(), after which close() is called which handles stream disconnect. The stream is flushed in close() so it can be called for sink destruction and reset where draining is not wanted. Task-number: QTBUG-111045 Pick-to: 6.6 6.5 Change-Id: I7a6daf38a410518e98974b807e8f9c8ed9802293 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> (cherry picked from commit 9262a8abde7aa2aa5629bc8c382eda2ab91d8e96) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Implement zero copy rendering of QMemoryVideoBufferArtem Dyomin2024-01-064-2/+29
| | | | | | | | | | | | | | We use QRhiTextureUploadEntry to create textures from memory. QRhiTextureUploadEntry takes QByteArray, let's pass there the array from QMemoryVideoBuffer to get round extra copying. Some of the added functionality is unit-tested in the next CR. Pick-to: 6.6 6.5 Change-Id: Iaa16cbceb189b38713e427eb76f72396ad0d759d Reviewed-by: Lars Knoll <lars@knoll.priv.no> (cherry picked from commit 70c4bf4c565c3ace547f5cbd0398953fcd1ff4f3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Prettify QMemoryVideoBufferArtem Dyomin2024-01-062-12/+12
| | | | | | | | | | | Minor cleanup in QMemoryVideoBuffer. Pick-to: 6.6 6.5 Change-Id: I52a63519bc226bd70322c8e0b2071962bd5e023b Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Lars Knoll <lars@knoll.priv.no> (cherry picked from commit 4c37eb3e481eb8cc70ced61e8d1497317183aab0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Remove not need component avdevice from ffmpeg componentsArtem Dyomin2024-01-061-1/+1
| | | | | | | | | | | | | The component is not used by the ffmpeg plugin and other components don't depend on it. Pick-to: 6.6 6.5 Change-Id: Ia8f66b611c78e70034cb00ac3ca5cb55a1769de9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars@knoll.priv.no> Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> (cherry picked from commit 2fe8338056c51647e1333fc0f351431ff2a3b876) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add implementation to EGLFS screen captureMikko Hallamaa2023-12-292-6/+53
| | | | | | | | | | | | | | Implementation for EGLFS screen capture added in change codereview.qt-project.org/c/qt/qtmultimedia/+/527432. This allows for optimizations as well as handling platform-specific conditions. Task-number: QTBUG-117746 Pick-to: 6.6 6.5 Change-Id: Iadffba1c93bd3bc62c267a096d4ac23f1fedf4fd Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> (cherry picked from commit 0fd782d27e7732040c755a1bf22cc56198d64cac) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix build with ffmpeg 6.1Artem Dyomin2023-12-283-6/+25
| | | | | | | | | | | | | | | In ffmpeg 6.1 stream side data is deprecated, codec params side data is supposed to be used instead. The patch applies changes of ffmpeg 6.1 and ensures compatibility with prev versions on the build step. Pick-to: 6.6 6.5 Change-Id: I65a6e21ac6500269db7866b1e8937b6c4decc90a Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> (cherry picked from commit 7715bc59e11f23cfcd1e38ba8a83c560f8bf8eee) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add an opportunity to select screen capture impl by env variableArtem Dyomin2023-12-281-1/+34
| | | | | | | | | | | | | | | | | | We need this feature for testing screen capturing on the user's side. The same we have for window capturing. In most cases, we will ask users to fall back to 'grabwindow' backend. Specifically, EglfsScreenCapture implementation may have some corner cases that we cannot consider now, so this feature might help us and users. Pick-to: 6.6 6.5 Change-Id: I76717a750c54fb931cca15a2bbaec56f9ab9fc3c Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Mikko Hallamaa <mikko.hallamaa@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 4a269b22a36817b3b5cd4b192f03411d95882978) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Move QImageVideoBuffer to a separate fileArtem Dyomin2023-12-284-36/+83
| | | | | | | | | | | The class is to be resued in eglfs screen capture. Pick-to: 6.6 6.5 Change-Id: I3161757ce7590e4299f9f017d4be4d50a2560db0 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Mikko Hallamaa <mikko.hallamaa@qt.io> (cherry picked from commit 9b737c463cf391928e33addc7320ecd490a21675) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add empty eglfs screen captureArtem Dyomin2023-12-284-0/+120
| | | | | | | | | | | | | | | | We need custom eglfs screen capture implementation as common QScreen::grabWindow implementation has valuable overhead. The patch adds matching classes and methods, implementation is supposed to go in next commits. Pick-to: 6.6 6.5 Change-Id: I40a605f3bd3651de51c75732041ffe28e385db91 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Mikko Hallamaa <mikko.hallamaa@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 8c814014c4131ca1193c443714e2d2756e4f7e58) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QFFmpegMediaPlayer: Fix stop() not resetting position if EndOfMediaLars Sutterud2023-12-221-0/+1
| | | | | | | | | | | | | | | | | | | | | If QFFmpegMediaPlayer::stop() was called after playing a media file all the way to the end, the playback position of the would not be reset. In that scenario, a subsequent call to play() would just reset the position to 0 instead of starting playback from the beginning as expected. Solution: - Call m_playbackEngine->seek(0) in stop() - Write new test that covers the above scenario Fixes: QTBUG-118127 Pick-to: 6.6 6.5 Change-Id: Ibcb313721099c3e53fd6b1b1d52aad712a0c8eb0 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> (cherry picked from commit ad783bb7099fbbc98cf1a27ea8a5910604fc7596) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Implement shipping of dynamic ffmpeg together with the ffmpeg pluginArtem Dyomin2023-12-222-2/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the first patch that implements ffmpeg shipping for both cases, building and installation. * deploy ffmpeg to plugins/multimedia/ffmpeg, as it should go together with the ffmpeg plugin. * ffmpeg deployment should be explicitly enquired via the option: -DQT_DEPLOY_FFMPEG=TRUE. The idea is to turn it on only when we or users need it, as users might have other compilation environments (e.g. it's so with boot2qt). Setting the flag for static qt builds is to be implemented later on. * Tested on Windows, Linux, macOS, some platform-specific details - On Unix platforms, ffmpeg libs might be put to plugins/multimedia/ffmpeg, closer to the ffmpeg plugin. However, on the current step, it was decided to deploy to the library directory. - On Windows, ffmpeg shared libs are linked through auxiliary static ones, it's handled in cmake scripts in the patch. - On Linux and Android, we will compile openssl and maybe vaapi stub shared libs and deploy the together with ffmpeg. - For Unix platforms, we will need to implement fixing of rpaths e.g. set 'ORIGIN' and hardcoded dylib deps (macOS). It will be done on the level of ffmpeg building on CI (install-ffmpeg.sh). Pick-to: 6.6 6.5 Change-Id: Ib7ce480b5412302f5d7ae9b247d5a5e87406a806 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 545ffc25a7d8b544c6257892c24fe4f433c1e5cf) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Reset RHI state on application suspendVolker Krause2023-12-221-0/+20
| | | | | | | | | | | | | | This fixes a crash on Android when mapping a QVideoFrame from the camera after the application has been resumed from suspension. Pick-to: 6.6 6.5 Fixes: QTBUG-113616 Change-Id: If107c7e8b9595f638034ea0bb05995ce5f096c0d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Bartlomiej Moskal <bartlomiej.moskal@qt.io> (cherry picked from commit c1e2f1e0dcac6d553fbef5a8abe7a652b9b3b70e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix PulseAudio sink intermittent hanging and glitching in pull modeMikko Hallamaa2023-12-211-14/+23
| | | | | | | | | | | | | | | | | | | | | | | | PulseAudio sink in pull mode asks the sound server for the amount of bytes it wants the client to write on the playback stream. Data was written from source in chunks of 20 milliseconds, without going over the requested amount. This however sometimes lead to a state where the server asks for less bytes than the sink considers as one chunk, which caused audio hang-ups. Now the PulseAudio sink will completely write the amount requested by the sound server. Additionally the audio source is reset when closing the sink to avoid glitches when playing audio from the same source later. The timing of chunk writes is adjusted according to the buffer target length in order to to lower the chance having to write a chunk in two parts. Fixes: QTBUG-116519 Pick-to: 6.6 6.5 Change-Id: I97816c0b7c3c98f3ff6a9d5b1329c616a0f00aa8 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> (cherry picked from commit 853d36bd80887bb3ba7503c162701b60841a06e2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix broken table in Multimedia Overview doc pageJøger Hansegård2023-12-181-4/+4
| | | | | | | | | | | | | | | The 4 column table "Multimedia Recipes" was broken because more columns were unintentionally added in the last rows. This patch fixes this issue before we update the table with missing features and examples. Pick-to: 6.6 6.5 Change-Id: I92de0636f04e11b55f8ec42ff724e3846c830e78 Reviewed-by: Pavel Dubsky <pavel.dubsky@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> (cherry picked from commit 53688710456b28788dfe2592b04c6e19cd5f69f9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Rename FFmpegSurfaceCaptureThread to FFmpegSurfaceCaptureGrabberMikko Hallamaa2023-12-1810-46/+46
| | | | | | | | | | | | Due to FFmpeg surface capture refactoring, the name of the class should be changed as the class no longer inherits QThread. Pick-to: 6.6 6.5 Change-Id: I2df79bb507b4ef1d730d01e3b76c297c8fadb8af Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> (cherry picked from commit 0bd0da8eab9c138c1017e85763b2866e8da76b76) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Use composition to run screen capture on main thread if neededMikko Hallamaa2023-12-145-72/+139
| | | | | | | | | | | | | | | EGLFS screen capture on embedded Linux platform crashes because of calling QScreen::grabWindow on a separate thread. Need to refactor FFmpeg surface capture to allow choosing whether to run on a separate thread or not. Pick-to: 6.6 6.5 Task-number: QTBUG-117746 Task-number: QTBUG-117878 Change-Id: I30629a3806220f02ca2cc3dc8c2749bd337914de Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> (cherry picked from commit e5d614f599a25e9a7280d16f6a6fe18f73120c56) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Android-backend: Use the same thread by TextureVideoOutput after resetBartlomiej Moskal2023-12-143-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7d53ccf2623dfacd4cc8f400729fb78d886924b4 commit fixed the Memory leak related to not deleted QRhi. QRhiWithThreadGuard was added to keep m_rhi and m_thread until frame will be released. Currently there is a problem when frame is kept too long. After unlocking the screen and going back to app, QRhi is recreated. It is recreated from the new thread. If the old frame (from previous m_rhi and previous m_thread) was somehow still kept and it will be released after that, app will crash with: "Cannot make QOpenGLContext current in a different thread" After mentioned commit, QRhi is recreated from the new thread. The reason of re-creating AndroidTextureThread was to not handle old pending frames after reset. As this solution may cause the crash - it needs to be handled in other way. This commit stops re-creating texture thread during reset. Instead of this, there is an additional check if current surfaceTexture is the same that was used for connection. Pick-to: 6.6 6.5 Fixes: QTBUG-118839 Change-Id: I853c3c96b690778435fd592898973f1f478fcea3 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> (cherry picked from commit c07c261eb311ac4f3a22c03b27d4b0c65cf69917) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Move QMediaDevices example to manual tests and improve documentationJøger Hansegård2023-12-142-0/+51
| | | | | | | | | | | | | | The Devices example is too simple to have as a full fledged example, and can better be expressed through snippets. Therefore, this patch moves the Devices example to manual tests, and improves the QMediaDevices doc by adding some snippets. Task-number: QTBUG-119117 Pick-to: 6.6 6.5 Change-Id: Id7c61e4f1b1047b73bae7e0619cf6238a30b8320 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> (cherry picked from commit 07622ff806324b5d5cf1e208c2110eb193f22103) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Cleanup MFVideoRendererControl in 'windows' backendVladimir Belyavsky2023-12-142-1999/+6
| | | | | | | | | | | | | | | | | | | | | | | | In 40793f147be4160fef7ba2d3a781d02de0661a72 we added custom EVR presenter in order to support HW accelerated video playback (see EVRCustomPresenterActivate). But initially it was only available if the surface supported OpenGL texture handles, and only on Windows Vista or higher. In cases where it was unsupported we fell back to the old flow (VideoRendererActivate). Since 2013, when this change was introduced, we have stopped supporting all Windows versions that do not support EVR, and have improved our custom EVR presenter in order to support rendering on any RHI backend on Windows. Thus, the old unoptimized code (VideoRendererActivate, etc.) is useless now and we can easily remove it to make the rest code more maintainable. Pick-to: 6.6 6.5 Change-Id: I1d1cda13352d8dc70e29f503ee95ebce4979013b Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> (cherry picked from commit 5941227b5e135d9cc4f1f9228f4d7649824bf382) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Fix example file quoting and missing namespace documentationTopi Reinio2023-12-142-4/+8
| | | | | | | | | | | | | | | | | | | | | | Fixes the following documentation warnings: declarative-camera.qdoc:54: (qdoc) warning: Command '\printto' failed at end of file declarative-camera.qdoc:152: (qdoc) warning: Command '\printuntil' failed at end of file qvideo.cpp:8: (qdoc) warning: RotationAngle is documented, but namespace QVideo is not documented in any module. Mark the documentation project free of warnings. Pick-to: 6.6 Change-Id: I45153fa9f6ba29a9d636229ef0a0465916f0291f Reviewed-by: Topi Reiniö <topi.reinio@qt.io> (cherry picked from commit e11d73132d481d0033b2b39124d61fd2163f8959) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Revert "Avoid skipping frames with windows media player"Jøger Hansegård2023-12-141-21/+5
| | | | | | | | | | | | | | | | | Although the proposed fix appeared to mitigate the issue in some video files, more testing revealed that frame jumping got worse in other video files. This shows that creating texture copies did not solve the root cause of the problem. This reverts commit 78c79152bcfda43187cf77d913d887045e14b6bf. Task-number: QTBUG-117099 Pick-to: 6.6 6.5 Change-Id: Ifcb4ca6815e151ce6907500f4de0974eb9976e0e Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Vladimir Belyavsky <belyavskyv@gmail.com> (cherry picked from commit 2f99eaefc24ea1a0b8341a9e442a81a19f25b9a1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Android: Do not add empty data to processed bytesBartlomiej Moskal2023-12-131-1/+3
| | | | | | | | | | | | | | In eec1e986ce6110547975f358adc0a941b53370d5 commit we decided to pass empty data buffer to OpenSL ES engine to make sure that player was not stopped too fast. As those are empyt bytes - they should not be added to processed bytes. Pick-to: 6.6 6.5 Task-number: QTBUG-118572 Change-Id: I0b9c0cc0db77c0c9de06caeee549e789cfb3cbff Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit ddf750681841f35abdc672a5c0aa9e0b5ba6c66d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* EVRCustomPresenter: cleanup processOutput() methodVladimir Belyavsky2023-12-131-43/+32
| | | | | | | | | | | | - get rid goto statements - reorganize the code for better readability Pick-to: 6.6 6.5 Change-Id: Idb2be63f52adb8deacac55ee914049a7705446be Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> (cherry picked from commit cf4ed8bff4db50214925fed4aec294fe86c8f99d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>