diff options
author | Piotr Srebrny <piotr.srebrny@qt.io> | 2021-09-30 14:00:50 +0200 |
---|---|---|
committer | Piotr Srebrny <piotr.srebrny@qt.io> | 2021-10-01 17:29:37 +0000 |
commit | 078701abf256fb91cd9824cc8e6d48556200c1ef (patch) | |
tree | 9462e27fe267760e4bd88d0f08fd5aeb50155f11 /tests | |
parent | 0964df62a9d6e1b2cdeeb201f4e06481c3f5a760 (diff) |
GStreamer: remove an element from a pipeline before setState(NULL)
If an element is a part of a pipeline bin, the bin tries to synchronize
its state with its own. Thus, after setting the element state to NULL,
the state can be set back to READY, PAUSE, or PLAYING before it is
removed from the pipeline. This patch first removes an element from
the pipeline and then sets its state to NULL to avoid this race.
Pick-to: 6.2
Change-Id: Ied9cd037fabab19682a53c5ab3d0c7335c58d9c9
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/integration/qmediacapturesession/CMakeLists.txt | 6 | ||||
-rw-r--r-- | tests/auto/integration/qmediacapturesession/tst_qmediacapturesession.cpp | 23 |
2 files changed, 29 insertions, 0 deletions
diff --git a/tests/auto/integration/qmediacapturesession/CMakeLists.txt b/tests/auto/integration/qmediacapturesession/CMakeLists.txt index 60fcace14..63ac2e99f 100644 --- a/tests/auto/integration/qmediacapturesession/CMakeLists.txt +++ b/tests/auto/integration/qmediacapturesession/CMakeLists.txt @@ -12,3 +12,9 @@ qt_internal_add_test(tst_qmediacapturesession Qt::MultimediaPrivate Qt::MultimediaWidgets ) + +if(QT_FEATURE_gstreamer) + set_tests_properties(tst_qmediacapturesession + PROPERTIES ENVIRONMENT "G_DEBUG=fatal_criticals" + ) +endif() diff --git a/tests/auto/integration/qmediacapturesession/tst_qmediacapturesession.cpp b/tests/auto/integration/qmediacapturesession/tst_qmediacapturesession.cpp index 97e977288..76a69b205 100644 --- a/tests/auto/integration/qmediacapturesession/tst_qmediacapturesession.cpp +++ b/tests/auto/integration/qmediacapturesession/tst_qmediacapturesession.cpp @@ -63,6 +63,8 @@ class tst_QMediaCaptureSession: public QObject Q_OBJECT private slots: + void stress_test_setup_and_teardown(); + void can_add_and_remove_AudioInput_with_and_without_AudioOutput_attached(); void can_change_AudioDevices_on_attached_AudioInput(); void can_change_AudioInput_during_recording(); @@ -132,6 +134,27 @@ void tst_QMediaCaptureSession::recordFail(QMediaCaptureSession &session) QTRY_VERIFY_WITH_TIMEOUT(recorder.recorderState() == QMediaRecorder::StoppedState, 1000); } +void tst_QMediaCaptureSession::stress_test_setup_and_teardown() +{ + for (int i = 0; i < 50; i++) { + QMediaCaptureSession session; + QMediaRecorder recorder; + QCamera camera; + QAudioInput input; + QAudioOutput output; + QVideoWidget video; + + session.setAudioInput(&input); + session.setAudioOutput(&output); + session.setRecorder(&recorder); + session.setCamera(&camera); + session.setVideoOutput(&video); + + QRandomGenerator rng; + QTest::qWait(rng.bounded(200)); + } +} + void tst_QMediaCaptureSession::can_add_and_remove_AudioInput_with_and_without_AudioOutput_attached() { QAudioInput input; |