GstEnginePipeline: Fix crash in GStreamer decodebin3 when switching tracks
Add guard in AboutToFinishCallback to prevent race condition when pipeline is being torn down. This prevents the callback from trying to set next URL while the pipeline is being destroyed, which caused crashes in GStreamer's decodebin3. Fixes issue where rapidly switching tracks could cause segmentation fault in gst_decodebin_input_link_to_slot. See: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/4626 Fixes #1863 Co-Authored-By: Jonas Kvinge <jonas@jkvinge.net>
This commit is contained in:
committed by
Jonas Kvinge
parent
39f9128ecf
commit
1d03bb2178
@@ -1364,6 +1364,13 @@ void GstEnginePipeline::AboutToFinishCallback(GstPlayBin *playbin, gpointer self
|
||||
|
||||
GstEnginePipeline *instance = reinterpret_cast<GstEnginePipeline*>(self);
|
||||
|
||||
// Ignore about-to-finish if we're in the process of tearing down the pipeline
|
||||
// This prevents race conditions in GStreamer's decodebin3 when rapidly switching tracks
|
||||
// See: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/4626
|
||||
if (instance->finish_requested_.value()) {
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
QMutexLocker l(&instance->mutex_url_);
|
||||
qLog(Debug) << "Stream from URL" << instance->gst_url_ << "about to finish.";
|
||||
|
||||
Reference in New Issue
Block a user