summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Blechmann <tim@klingt.org>2024-03-14 23:17:57 +0800
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-03-16 00:44:59 +0000
commit7af4ecb2d7807139142cbb7e824920c4eb673cfc (patch)
treea9cf7bb6990594573bc01148160130091d9b7965
parent6c46d2f5f50f059e2102f52ff29506959166747b (diff)
GStreamer: mark videosinks as "async"
`finishStateChange` and friends don't fully wait for the pipeline state to be changed, since the sink elements is marked as async. Therefore `gst_element_get_state` replies with `GST_STATE_CHANGE_ASYNC`. This seems to have some side effects like crashes/deadlocks when switching cameras or switching output sinks. Fixes: QTBUG-122638 Fixes: QTBUG-123139 Fixes: QTBUG-113421 Pick-to: 6.5 Change-Id: I770aaec5c0f35b7aa9fd52c3484608b1c8114ba2 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> (cherry picked from commit 6e0a706d907152a51c093cd37113c324d243d039) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit bc8ff8da8b952afd9e9607212f04e05fa39c36a7)
-rw-r--r--src/plugins/multimedia/gstreamer/common/qgstreamervideooutput.cpp5
-rw-r--r--src/plugins/multimedia/gstreamer/common/qgstreamervideosink.cpp2
2 files changed, 7 insertions, 0 deletions
diff --git a/src/plugins/multimedia/gstreamer/common/qgstreamervideooutput.cpp b/src/plugins/multimedia/gstreamer/common/qgstreamervideooutput.cpp
index 66d5b4734..929375a0b 100644
--- a/src/plugins/multimedia/gstreamer/common/qgstreamervideooutput.cpp
+++ b/src/plugins/multimedia/gstreamer/common/qgstreamervideooutput.cpp
@@ -54,6 +54,10 @@ QGstreamerVideoOutput::QGstreamerVideoOutput(QGstElement convert, QGstElement sc
videoSink(std::move(sink))
{
videoQueue = QGstElement::createFromFactory("queue", "videoQueue");
+
+ videoSink.set("sync", true);
+ videoSink.set("async", false); // no asynchronous state changes
+
if (videoScale) {
gstVideoOutput.add(videoQueue, videoConvert, videoScale, videoSink);
qLinkGstElements(videoQueue, videoConvert, videoScale, videoSink);
@@ -91,6 +95,7 @@ void QGstreamerVideoOutput::setVideoSink(QVideoSink *sink)
gstSink = QGstElement::createFromFactory("fakesink", "fakevideosink");
Q_ASSERT(gstSink);
gstSink.set("sync", true);
+ gstSink.set("async", false); // no asynchronous state changes
isFakeSink = true;
}
diff --git a/src/plugins/multimedia/gstreamer/common/qgstreamervideosink.cpp b/src/plugins/multimedia/gstreamer/common/qgstreamervideosink.cpp
index f3dc36271..7f7d9a49b 100644
--- a/src/plugins/multimedia/gstreamer/common/qgstreamervideosink.cpp
+++ b/src/plugins/multimedia/gstreamer/common/qgstreamervideosink.cpp
@@ -180,6 +180,8 @@ void QGstreamerVideoSink::updateSinkElement()
if (!gstVideoSink.isNull())
sinkBin.stopAndRemoveElements(gstVideoSink);
+ newSink.set("async", false); // no asynchronous state changes
+
gstVideoSink = newSink;
sinkBin.add(gstVideoSink);
qLinkGstElements(gstCapsFilter, gstVideoSink);