decodebin3: Don't duplicate stream selections

Make sure that the requested stream selection isn't identical to the current
one. If that's the case, just carry on as usual.

This avoids multiple `streams-selected` posting ... when the selection didn't
change.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2208>
This commit is contained in:
Edward Hervey 2022-04-14 15:21:48 +02:00 committed by Tim-Philipp Müller
parent f342618329
commit b5b8f0ed22

View file

@ -1094,6 +1094,23 @@ stream_in_list (GList * list, const gchar * sid)
return NULL;
}
static gboolean
stream_list_equal (GList * lista, GList * listb)
{
GList *tmp;
if (g_list_length (lista) != g_list_length (listb))
return FALSE;
for (tmp = lista; tmp; tmp = tmp->next) {
gchar *osid = tmp->data;
if (!stream_in_list (listb, osid))
return FALSE;
}
return TRUE;
}
static void
update_requested_selection (GstDecodebin3 * dbin)
{
@ -1170,8 +1187,15 @@ update_requested_selection (GstDecodebin3 * dbin)
}
beach:
/* Finally set the requested selection */
if (stream_list_equal (tmp, dbin->requested_selection)) {
/* If the selection is equal, there is nothign to do */
GST_DEBUG_OBJECT (dbin, "Dropping duplicate selection");
g_list_free (tmp);
tmp = NULL;
}
if (tmp) {
/* Finally set the requested selection */
if (dbin->requested_selection) {
GST_FIXME_OBJECT (dbin,
"Replacing non-NULL requested_selection, what should we do ??");