mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-22 09:41:07 +00:00
decodebin3: Fix collection identity check
Collections can be auto-generated from upstream and yet have exactly the same streams in it. Therefore do a more in-depth check for equality. Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3742 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7401>
This commit is contained in:
parent
87c69e5174
commit
ea59c921d6
1 changed files with 25 additions and 1 deletions
|
@ -2609,6 +2609,29 @@ db_collection_new (GstStreamCollection * collection)
|
||||||
return db_collection;
|
return db_collection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
collections_are_identical (GstStreamCollection * collection,
|
||||||
|
GstStreamCollection * previous)
|
||||||
|
{
|
||||||
|
guint i;
|
||||||
|
|
||||||
|
if (collection == previous)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
if (gst_stream_collection_get_size (collection) !=
|
||||||
|
gst_stream_collection_get_size (previous))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
for (i = 0; i < gst_stream_collection_get_size (previous); i++) {
|
||||||
|
GstStream *stream = gst_stream_collection_get_stream (previous, i);
|
||||||
|
const gchar *sid = gst_stream_get_stream_id (stream);
|
||||||
|
if (!stream_in_collection (collection, (gchar *) sid))
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/** handle_stream_collection_locked:
|
/** handle_stream_collection_locked:
|
||||||
* @dbin:
|
* @dbin:
|
||||||
* @collection: (transfer none): The new collection for @input. Can be %NULL.
|
* @collection: (transfer none): The new collection for @input. Can be %NULL.
|
||||||
|
@ -2683,12 +2706,13 @@ handle_stream_collection_locked (GstDecodebin3 * dbin,
|
||||||
if (dbin->input_collection) {
|
if (dbin->input_collection) {
|
||||||
GstStreamCollection *previous = dbin->input_collection->collection;
|
GstStreamCollection *previous = dbin->input_collection->collection;
|
||||||
|
|
||||||
if (collection == previous) {
|
if (collections_are_identical (collection, previous)) {
|
||||||
GST_DEBUG_OBJECT (dbin, "Collection didn't change");
|
GST_DEBUG_OBJECT (dbin, "Collection didn't change");
|
||||||
gst_object_unref (collection);
|
gst_object_unref (collection);
|
||||||
SELECTION_UNLOCK (dbin);
|
SELECTION_UNLOCK (dbin);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if this collection is an update of the previous one */
|
/* Check if this collection is an update of the previous one */
|
||||||
if (gst_stream_collection_get_size (collection) >
|
if (gst_stream_collection_get_size (collection) >
|
||||||
gst_stream_collection_get_size (previous)) {
|
gst_stream_collection_get_size (previous)) {
|
||||||
|
|
Loading…
Reference in a new issue