gl/cocoa: reduce custom main loop latency
authorJulien Isorce <j.isorce@samsung.com>
Sun, 22 Feb 2015 10:03:54 +0000 (10:03 +0000)
committerJulien Isorce <j.isorce@samsung.com>
Sun, 22 Feb 2015 10:37:39 +0000 (10:37 +0000)
This fix a very slow rendering rate regression that only
happens when using gst-launch, i.e. in the case where
the main thread does not run any NSApp loop.

Git bisect reported it has been introduced by the commit
e10d2417e2fe7aa4733c076984339b0d61caa169:
"move to CGL and CAOpenGLLayer for rendering".

Then the commit 7d463576271e5a4cc1070780ba1a69c971e8be1d:
"gstglwindow_cocoa: fix slow render rate" attempted to fix
the slow rendering rate problem when using gst-launch.

At least for me it does not work. I tried several
combinations, for example to flush CA transactions in the
custom app loop, as mentioned in the doc, but the only solution
that fixes the slow rendering is by reducing the loop latency.
From what I tested, no need to put less than 60ms, even if the
framerate has an interval much lower (16.6ms for 60 fps).

gst-libs/gst/gl/cocoa/gstglcontext_cocoa.m

index e7c5722..3e6b9d3 100644 (file)
@@ -304,7 +304,7 @@ gst_gl_context_cocoa_create_context (GstGLContext *context, GstGLAPI gl_api,
   pool = [[NSAutoreleasePool alloc] init];
 
 #ifndef GSTREAMER_GLIB_COCOA_NSAPPLICATION
-  priv->source_id = g_timeout_add (200, gst_gl_window_cocoa_nsapp_iteration, NULL);
+  priv->source_id = g_timeout_add (60, gst_gl_window_cocoa_nsapp_iteration, NULL);
 #endif
 
   priv->gl_context = nil;