QPlatformMediaIntegration: Add setBackend to force a media backend
The current behavior of QPlatformMediaIntegration is to fall back to
other available media plugins if the selected one fails to load. This is
not wanted when running integration tests: if the backend under test
fails to load, it should count as a failed test rather than silently
testing a different backend or the fallback stub. Additionally, several
integration tests will skip if the tested feature is reported as
unsupported, which is the case when we load the fallback backend. These
are then reported as passed.
This patch renames the private setPreferredBackend() to setBackend() and
gives it precedence over the QT_MEDIA_BACKEND environment variable and
the built-in default. When set, backend fallback logic is also disabled.
Integration tests will now call setBackend() to force the backend, and
fail if we end up loading the fallback backend.
Pick-to: 6.12
Change-Id: Ie2835183ee79a15559edfc52576287beb21a88d2
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
| commit | 385ca4368362ff99b8af5ff776f7476e3b975223 |
| parent | 888466b037c72f70780e610703f9b85e7e36cf9b |
| author | Nils Petter Skålerud <nils.petter.skalerud@qt.io> |
| committer | Nils Petter Skålerud <nils.petter.skalerud@qt.io> |
| commit time | Tue, 4 Aug 2026 15:35:09 +0000 |
- M src/multimedia/platform/qplatformmediaintegration.cpp
- M src/multimedia/platform/qplatformmediaintegration_p.h
- M src/multimediatestlib/CMakeLists.txt
- M src/multimediatestlib/mediabackendutils_p.h
- A src/multimediatestlib/qintegrationtestbase.cpp
- A src/multimediatestlib/qintegrationtestbase_p.h
- M tests/auto/integration/qaudiodecoderbackend/tst_qaudiodecoderbackend.cpp
- M tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp
- M tests/auto/integration/qmediacapturesession/tst_qmediacapturesession.cpp
- M tests/auto/integration/qmediaformatbackend/tst_qmediaformatbackend.cpp
- M tests/auto/integration/qmediaframeinputsbackend/tst_qmediaframeinputsbackend.cpp
- M tests/auto/integration/qmediaframeinputsbackend/tst_qmediaframeinputsbackend.h
- M tests/auto/integration/qmediaplayer_concurrent/tst_qmediaplayer_concurrent.cpp
- M tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
- M tests/auto/integration/qmediaplayerformatsupport/tst_qmediaplayerformatsupport.cpp
- M tests/auto/integration/qmediarecorderbackend/tst_qmediarecorderbackend.cpp
- M tests/auto/integration/qml/CMakeLists.txt
- A tests/auto/integration/qml/mediabackendutils.cpp
- A tests/auto/integration/qml/mediabackendutils.h
- M tests/auto/integration/qml/mediaplayer/tst_mediaplayer.qml
- M tests/auto/integration/qml/playbackoptions/tst_playbackoptions.qml
- M tests/auto/integration/qml/screencapture/tst_screencapture.qml
- M tests/auto/integration/qml/soundeffect/tst_soundeffect.qml
- M tests/auto/integration/qml/tst_qml.cpp
- M tests/auto/integration/qml/windowcapture/tst_windowcapture.qml
- M tests/auto/integration/qquickscreencapturebackend/CMakeLists.txt
- M tests/auto/integration/qquickscreencapturebackend/tst_qquickscreencapturebackend.cpp
- M tests/auto/integration/qquickvideooutput/CMakeLists.txt
- M tests/auto/integration/qquickvideooutput/tst_qquickvideooutput.cpp
- M tests/auto/integration/qquickvideooutput_window/tst_qquickvideooutput_window.cpp
- M tests/auto/integration/qscreencapturebackend/tst_qscreencapturebackend.cpp
- M tests/auto/integration/qvideoframebackend/tst_qvideoframebackend.cpp
- M tests/auto/integration/qwindowcapturebackend/tst_qwindowcapturebackend.cpp
- M tests/manual/qml-camera-advanced/qtmultimediaprivateqmlhelper.cpp