mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 03:01:03 +00:00
element: re-create threadpool after cleaning up tasks
We don't free this from gst_deinit() but from gst_task_cleanup_all(), so more GStreamer API may be called. In particular makes unit tests work again with CK_FORK=no. https://bugzilla.gnome.org/show_bug.cgi?id=768577
This commit is contained in:
parent
9ba53ff1fc
commit
7a0f4422fa
1 changed files with 17 additions and 10 deletions
|
@ -186,11 +186,25 @@ gst_element_get_type (void)
|
|||
return gst_element_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_element_setup_thread_pool (void)
|
||||
{
|
||||
GError *err = NULL;
|
||||
|
||||
GST_DEBUG ("creating element thread pool");
|
||||
gst_element_pool =
|
||||
g_thread_pool_new ((GFunc) gst_element_call_async_func, NULL, -1, FALSE,
|
||||
&err);
|
||||
if (err != NULL) {
|
||||
g_critical ("could not alloc threadpool %s", err->message);
|
||||
g_clear_error (&err);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_element_class_init (GstElementClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GError *err = NULL;
|
||||
|
||||
gobject_class = (GObjectClass *) klass;
|
||||
|
||||
|
@ -252,14 +266,7 @@ gst_element_class_init (GstElementClass * klass)
|
|||
|
||||
klass->elementfactory = NULL;
|
||||
|
||||
GST_DEBUG ("creating element thread pool");
|
||||
gst_element_pool =
|
||||
g_thread_pool_new ((GFunc) gst_element_call_async_func, NULL, -1, FALSE,
|
||||
&err);
|
||||
if (err != NULL) {
|
||||
g_critical ("could not alloc threadpool %s", err->message);
|
||||
g_clear_error (&err);
|
||||
}
|
||||
gst_element_setup_thread_pool ();
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -3429,6 +3436,6 @@ _priv_gst_element_cleanup (void)
|
|||
{
|
||||
if (gst_element_pool) {
|
||||
g_thread_pool_free (gst_element_pool, FALSE, TRUE);
|
||||
gst_element_pool = NULL;
|
||||
gst_element_setup_thread_pool ();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue