urisourcebin: Don't acquire STATE_LOCK if shutting down

If we are shutting down (PAUSED->READY) we shouldn't take the STATE LOCK since
this function is being called from a streaming thread (which is trying to be
deactivated while the STATE LOCK is held)

Fixes #3292

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6123>
This commit is contained in:
Edward Hervey 2024-02-15 09:14:37 +01:00 committed by Tim-Philipp Müller
parent dcd9d8a87d
commit 4e01c01483

View file

@ -1878,8 +1878,13 @@ setup_parsebin_for_slot (ChildSrcPadInfo * info, GstPad * originating_pad)
GST_DEBUG_OBJECT (urisrc, "Setting up parsebin for %" GST_PTR_FORMAT,
originating_pad);
GST_STATE_LOCK (urisrc);
GST_URI_SOURCE_BIN_LOCK (urisrc);
if (urisrc->flushing) {
GST_DEBUG_OBJECT (urisrc, "Shutting down, returning early");
GST_URI_SOURCE_BIN_UNLOCK (urisrc);
return FALSE;
}
GST_STATE_LOCK (urisrc);
/* Set up optional pre-parsebin download/ringbuffer elements */
if (info->use_downloadbuffer || urisrc->ring_buffer_max_size) {
@ -1949,8 +1954,8 @@ setup_parsebin_for_slot (ChildSrcPadInfo * info, GstPad * originating_pad)
}
gst_element_set_locked_state (info->demuxer, FALSE);
gst_element_sync_state_with_parent (info->demuxer);
GST_URI_SOURCE_BIN_UNLOCK (urisrc);
GST_STATE_UNLOCK (urisrc);
GST_URI_SOURCE_BIN_UNLOCK (urisrc);
return TRUE;
could_not_link:
@ -1959,8 +1964,8 @@ could_not_link:
gst_element_set_locked_state (info->pre_parse_queue, FALSE);
if (info->demuxer)
gst_element_set_locked_state (info->demuxer, FALSE);
GST_URI_SOURCE_BIN_UNLOCK (urisrc);
GST_STATE_UNLOCK (urisrc);
GST_URI_SOURCE_BIN_UNLOCK (urisrc);
GST_ELEMENT_ERROR (urisrc, CORE, NEGOTIATION,
(NULL), ("Can't link to (pre-)parsebin element"));
return FALSE;