decodebin3: Remove un-needed variable

pending_select_streams was only set just before releasing/taking the selection
lock in a single place. That temporary lock release is not needed and therefore
the variable isn't needed either

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6774>
This commit is contained in:
Edward Hervey 2024-03-25 12:05:36 +01:00 committed by GStreamer Marge Bot
parent 1ab0936196
commit 3acb219b76

View File

@ -258,8 +258,6 @@ struct _GstDecodebin3
GList *to_activate; GList *to_activate;
/* Pending select streams event */ /* Pending select streams event */
guint32 select_streams_seqnum; guint32 select_streams_seqnum;
/* There is a pending GST_EVENT_SELECT_STREAMS being handled */
gboolean pending_select_streams;
/* TRUE if requested_selection was updated, will become FALSE once /* TRUE if requested_selection was updated, will become FALSE once
* it has fully transitioned to active */ * it has fully transitioned to active */
gboolean selection_updated; gboolean selection_updated;
@ -730,8 +728,6 @@ gst_decodebin3_reset (GstDecodebin3 * dbin)
dbin->select_streams_seqnum = GST_SEQNUM_INVALID; dbin->select_streams_seqnum = GST_SEQNUM_INVALID;
dbin->pending_select_streams = FALSE;
dbin->selection_updated = FALSE; dbin->selection_updated = FALSE;
} }
@ -2315,12 +2311,6 @@ update_requested_selection (GstDecodebin3 * dbin)
/* 1. Is there a pending SELECT_STREAMS we can return straight away since /* 1. Is there a pending SELECT_STREAMS we can return straight away since
* the switch handler will take care of the pending selection */ * the switch handler will take care of the pending selection */
SELECTION_LOCK (dbin); SELECTION_LOCK (dbin);
if (dbin->pending_select_streams) {
GST_DEBUG_OBJECT (dbin,
"No need to create pending selection, SELECT_STREAMS underway");
goto beach;
}
collection = dbin->collection; collection = dbin->collection;
if (G_UNLIKELY (collection == NULL)) { if (G_UNLIKELY (collection == NULL)) {
GST_DEBUG_OBJECT (dbin, "No current GstStreamCollection"); GST_DEBUG_OBJECT (dbin, "No current GstStreamCollection");
@ -4017,11 +4007,19 @@ mq_slot_unassign_probe (GstPad * pad, GstPadProbeInfo * info,
return GST_PAD_PROBE_REMOVE; return GST_PAD_PROBE_REMOVE;
} }
static gboolean /** handle_stream_switch:
* @dbin: A #GstDecodebin3
* @select_streams: The list of stream-id to switch to
* @seqnum: The seqnum of the event that triggered this
*
* Figures out which slots to (de)activate for the given @select_streams.
*
* Must be called with SELECTION_LOCK taken.
*/
static void
handle_stream_switch (GstDecodebin3 * dbin, GList * select_streams, handle_stream_switch (GstDecodebin3 * dbin, GList * select_streams,
guint32 seqnum) guint32 seqnum)
{ {
gboolean ret = TRUE;
GList *tmp; GList *tmp;
/* List of slots to (de)activate. */ /* List of slots to (de)activate. */
GList *slots_to_deactivate = NULL; GList *slots_to_deactivate = NULL;
@ -4034,14 +4032,10 @@ handle_stream_switch (GstDecodebin3 * dbin, GList * select_streams,
GList *pending_streams = NULL; GList *pending_streams = NULL;
GList *slots_to_reassign = NULL; GList *slots_to_reassign = NULL;
SELECTION_LOCK (dbin);
if (G_UNLIKELY (seqnum != dbin->select_streams_seqnum)) { if (G_UNLIKELY (seqnum != dbin->select_streams_seqnum)) {
GST_DEBUG_OBJECT (dbin, "New SELECT_STREAMS has arrived in the meantime"); GST_DEBUG_OBJECT (dbin, "New SELECT_STREAMS has arrived in the meantime");
SELECTION_UNLOCK (dbin); return;
return TRUE;
} }
/* Remove pending select_streams */
dbin->pending_select_streams = FALSE;
/* COMPARE the requested streams to the active and requested streams /* COMPARE the requested streams to the active and requested streams
* on multiqueue. */ * on multiqueue. */
@ -4226,7 +4220,7 @@ handle_stream_switch (GstDecodebin3 * dbin, GList * select_streams,
if (slots_to_reassign) if (slots_to_reassign)
g_list_free (slots_to_reassign); g_list_free (slots_to_reassign);
return ret; SELECTION_LOCK (dbin);
} }
/* /*
@ -4248,28 +4242,30 @@ handle_select_streams (GstDecodebin3 * dbin, GstEvent * event)
return FALSE; return FALSE;
} }
SELECTION_LOCK (dbin); gst_event_parse_select_streams (event, &streams);
if (seqnum == dbin->select_streams_seqnum) { if (streams == NULL) {
SELECTION_UNLOCK (dbin); GST_DEBUG_OBJECT (dbin, "No streams in select streams");
GST_DEBUG_OBJECT (dbin,
"Already handled/handling that SELECT_STREAMS event");
gst_event_unref (event); gst_event_unref (event);
return TRUE; return TRUE;
} }
dbin->select_streams_seqnum = seqnum; SELECTION_LOCK (dbin);
if (dbin->pending_select_streams) /* Find the collection to which these list of streams apply */
GST_LOG_OBJECT (dbin, "Replacing pending select streams");
dbin->pending_select_streams = TRUE;
gst_event_parse_select_streams (event, &streams);
SELECTION_UNLOCK (dbin);
/* Finally handle the switch */ if (seqnum == dbin->select_streams_seqnum) {
if (streams) { GST_DEBUG_OBJECT (dbin,
handle_stream_switch (dbin, streams, seqnum); "Already handled/handling that SELECT_STREAMS event");
g_list_free_full (streams, g_free); goto beach;
} }
dbin->select_streams_seqnum = seqnum;
/* Finally handle the switch */
handle_stream_switch (dbin, streams, seqnum);
g_list_free_full (streams, g_free);
beach:
SELECTION_UNLOCK (dbin);
gst_event_unref (event); gst_event_unref (event);
return TRUE; return TRUE;
} }