gstglwindow_cocoa: fix slow render rate

In gst_gl_window_cocoa_draw we used to just call setNeedsDisplay:YES. That was
creating an implicit CA transaction which was getting committed at the next
runloop iteration. Since we don't know how often the main runloop is running,
and when we run it implicitly (from gst_gl_window_cocoa_nsapp_iteration) we only
do so every 200ms, use an explicit CA transaction instead and commit it
immediately. CA transactions nest and debounce automatically so this will never
result in extra work.
This commit is contained in:
Alessandro Decina 2015-02-03 11:07:58 +11:00
parent ddcc580505
commit 7d46357627
2 changed files with 7 additions and 5 deletions

2
common

@ -1 +1 @@
Subproject commit bc76a8b6a2db1cc0605158e672b2d420b4e130d0 Subproject commit f2c6b95d0d98e97c37ffe27509709fdd41cd503c

View file

@ -24,6 +24,7 @@
#endif #endif
#include <Cocoa/Cocoa.h> #include <Cocoa/Cocoa.h>
#include <QuartzCore/QuartzCore.h>
#include "gstgl_cocoa_private.h" #include "gstgl_cocoa_private.h"
@ -280,11 +281,12 @@ gst_gl_window_cocoa_draw (GstGLWindow * window)
GstGLNSView *view = (GstGLNSView *)[window_cocoa->priv->internal_win_id contentView]; GstGLNSView *view = (GstGLNSView *)[window_cocoa->priv->internal_win_id contentView];
/* this redraws the GstGLCAOpenGLLayer which calls /* this redraws the GstGLCAOpenGLLayer which calls
* gst_gl_window_cocoa_draw_thread() * gst_gl_window_cocoa_draw_thread(). Use an explicit CATransaction since we
* don't know how often the main runloop is running.
*/ */
dispatch_sync (dispatch_get_main_queue(), ^{ [CATransaction begin];
[view setNeedsDisplay:YES]; [view setNeedsDisplay:YES];
}); [CATransaction commit];
} }
static void static void