ges: Implement our own idle_add which uses the thread local maincontext

This commit is contained in:
Thibault Saunier 2019-07-09 01:03:56 -04:00
parent 35096e4d94
commit 5847c6e5ed
5 changed files with 19 additions and 3 deletions

View file

@ -283,7 +283,7 @@ _load_from_uri (GESFormatter * self, GESTimeline * timeline, const gchar * uri,
return FALSE;
if (priv->pending_assets == NULL)
g_idle_add ((GSourceFunc) _loading_done_cb, g_object_ref (self));
ges_idle_add ((GSourceFunc) _loading_done_cb, g_object_ref (self), NULL);
return TRUE;
}

View file

@ -351,6 +351,9 @@ G_GNUC_INTERNAL gint element_end_compare (GESTimelineElement *
G_GNUC_INTERNAL GstElementFactory *
ges_get_compositor_factory (void);
G_GNUC_INTERNAL void
ges_idle_add (GSourceFunc func, gpointer udata, GDestroyNotify notify);
/****************************************************
* GESContainer *

View file

@ -224,7 +224,7 @@ _load_project (GESProject * project, GESTimeline * timeline, GError ** error)
data->project = gst_object_ref (project);
/* Make sure the signal is emitted after the functions ends */
g_idle_add ((GSourceFunc) _emit_loaded_in_idle, data);
ges_idle_add ((GSourceFunc) _emit_loaded_in_idle, data, NULL);
return TRUE;
}
}

View file

@ -1417,7 +1417,7 @@ child_prop_changed_cb (GObject * child, GParamSpec * arg
data->arg = g_param_spec_ref (arg);
data->self = gst_object_ref (self);
g_idle_add ((GSourceFunc) emit_deep_notify_in_idle, data);
ges_idle_add ((GSourceFunc) emit_deep_notify_in_idle, data, NULL);
}
gboolean

View file

@ -166,6 +166,19 @@ ges_get_compositor_factory (void)
return compositor_factory;
}
void
ges_idle_add (GSourceFunc func, gpointer udata, GDestroyNotify notify)
{
GMainContext *context = g_main_context_get_thread_default ();
GSource *source = g_idle_source_new ();
if (!context)
context = g_main_context_default ();
g_source_set_callback (source, func, udata, notify);
g_source_attach (source, context);
}
gboolean
ges_nle_composition_add_object (GstElement * comp, GstElement * object)
{