uridecodebin3: Remove play items that were never connected

This is a follow-up of the previous commit that enabled support for redirection.

The problem is that the urisourcebin that emitted the error redirection never
produced any pads, and therefore was never linked to decodebin3. This resulted
in the code waiting for that (output) item to finally switch over ... which will
never happen.

The fix is done by removing it early if it was never connected to decodebin3.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4252>
This commit is contained in:
Edward Hervey 2023-03-23 07:39:48 +01:00 committed by Edward Hervey
parent 4f988e24d2
commit 0be233a446

View file

@ -1059,6 +1059,7 @@ switch_and_activate_input_locked (GstURIDecodeBin3 * uridecodebin,
GList *old_pads = get_all_play_item_source_pads (uridecodebin->input_item); GList *old_pads = get_all_play_item_source_pads (uridecodebin->input_item);
GList *to_activate = NULL; GList *to_activate = NULL;
GList *iternew, *iterold; GList *iternew, *iterold;
gboolean inactive_previous_item = old_pads == NULL;
/* Deactivate old urisourcebins first ? Problem is they might remove the pads */ /* Deactivate old urisourcebins first ? Problem is they might remove the pads */
@ -1126,6 +1127,17 @@ switch_and_activate_input_locked (GstURIDecodeBin3 * uridecodebin,
uridecodebin->input_item->sub_item = NULL; uridecodebin->input_item->sub_item = NULL;
} }
/* If the previous play item was not active at all (i.e. was never linked to
* decodebin3), this one *also* becomes the output one */
if (inactive_previous_item) {
GST_DEBUG_OBJECT (uridecodebin,
"Previous play item was never activated, discarding");
uridecodebin->play_items =
g_list_remove (uridecodebin->play_items, uridecodebin->input_item);
free_play_item (uridecodebin, uridecodebin->input_item);
uridecodebin->output_item = new_item;
}
/* and set new one as input item */ /* and set new one as input item */
uridecodebin->input_item = new_item; uridecodebin->input_item = new_item;