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/6121>
This commit is contained in:
Edward Hervey 2024-02-15 09:14:37 +01:00 committed by GStreamer Marge Bot
parent d86a6715e1
commit d62c6e1084

View file

@ -1943,8 +1943,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) {
@ -2014,8 +2019,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:
@ -2024,8 +2029,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;