ges: discoverer-manager: Allow recursing discovery

When using deeply nested timelines with the `ges:` protocol the
formatters ends up trying to do discovery from the same thread current
discovery happens, leading to infinite freeze as GstDiscoverer can't run
several discoveries at the same time.

By ensuring that when calling `gst_discoverer_discover_uri_async` no
`GstDiscoverer` is set as "thread discoverer" we know that another
discoverer will be created if discovery recurses, effectively removing
the freeze.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5608>
This commit is contained in:
Thibault Saunier 2023-06-22 23:19:05 -04:00 committed by GStreamer Marge Bot
parent 78bc3d53dd
commit 71aa451870

View file

@ -321,11 +321,12 @@ ges_discoverer_manager_get_discoverer (GESDiscovererManager * self)
ret = g_hash_table_lookup (self->discoverers, g_thread_self ());
if (!ret) {
ret = create_discoverer (self);
g_hash_table_insert (self->discoverers, g_thread_self (), ret);
} else {
g_hash_table_steal (self->discoverers, g_thread_self ());
}
g_mutex_unlock (&self->lock);
return gst_object_ref (ret);
return ret;
}
gboolean
@ -339,7 +340,11 @@ ges_discoverer_manager_start_discovery (GESDiscovererManager * self,
discoverer = ges_discoverer_manager_get_discoverer (self);
gboolean res = gst_discoverer_discover_uri_async (discoverer, uri);
gst_object_unref (discoverer);
g_mutex_lock (&self->lock);
g_hash_table_insert (self->discoverers, g_thread_self (), discoverer);
g_mutex_unlock (&self->lock);
return res;
}