[831/906] glimagesink: avoid to overload the drawer if already drawing

Especially if the application calls gst_video_overlay_expose a lot
This commit is contained in:
Julien Isorce 2013-11-06 21:55:49 +00:00 committed by Tim-Philipp Müller
parent 7b7e7bb8d0
commit 66d7d4712e
2 changed files with 11 additions and 0 deletions

View file

@ -107,6 +107,8 @@ gst_gl_window_init (GstGLWindow * window)
g_cond_init (&window->priv->cond_destroy_context);
window->priv->context_created = FALSE;
window->is_drawing = FALSE;
g_weak_ref_init (&window->context_ref, NULL);
}
@ -221,6 +223,13 @@ gst_gl_window_draw (GstGLWindow * window, guint width, guint height)
g_return_if_fail (window_class->draw != NULL);
GST_GL_WINDOW_LOCK (window);
/* avoid to overload the drawer */
if (window->is_drawing) {
GST_GL_WINDOW_UNLOCK (window);
return;
}
window_class->draw (window, width, height);
GST_GL_WINDOW_UNLOCK (window);
}

View file

@ -76,6 +76,8 @@ struct _GstGLWindow {
guintptr external_gl_context;
gboolean is_drawing;
GstGLWindowCB draw;
gpointer draw_data;
GDestroyNotify draw_notify;