gstglcontext: micro optimization to gst_gl_context_thread_add
authorAlessandro Decina <alessandro.d@gmail.com>
Wed, 10 Feb 2016 02:08:43 +0000 (13:08 +1100)
committerTim-Philipp Müller <tim@centricular.com>
Sat, 9 Dec 2017 19:32:16 +0000 (19:32 +0000)
Invoke the callback right away when called on the context thread. Removes
overhead when nesting libgstgl calls (for example when working with the sync
meta).

gst-libs/gst/gl/gstglcontext.c

index f103146b8f5d5cee92f088d31bfb510e12302b27..48a5387e8ae994a7ef2108f801dc1f73522a5d2a 100644 (file)
@@ -1489,8 +1489,10 @@ gst_gl_context_thread_add (GstGLContext * context,
   g_return_if_fail (GST_IS_GL_CONTEXT (context));
   g_return_if_fail (func != NULL);
 
-  if (GST_IS_GL_WRAPPED_CONTEXT (context)) {
+  if (GST_IS_GL_WRAPPED_CONTEXT (context))
     g_return_if_fail (context->priv->active_thread == g_thread_self ());
+
+  if (context->priv->active_thread == g_thread_self ()) {
     func (context, data);
     return;
   }