From 66d7d4712e16cf74ca3b38c35774589e66624d2f Mon Sep 17 00:00:00 2001 From: Julien Isorce Date: Wed, 6 Nov 2013 21:55:49 +0000 Subject: [PATCH] [831/906] glimagesink: avoid to overload the drawer if already drawing Especially if the application calls gst_video_overlay_expose a lot --- gst-libs/gst/gl/gstglwindow.c | 9 +++++++++ gst-libs/gst/gl/gstglwindow.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/gst-libs/gst/gl/gstglwindow.c b/gst-libs/gst/gl/gstglwindow.c index 8d64e78c5d..2e1775c788 100644 --- a/gst-libs/gst/gl/gstglwindow.c +++ b/gst-libs/gst/gl/gstglwindow.c @@ -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); } diff --git a/gst-libs/gst/gl/gstglwindow.h b/gst-libs/gst/gl/gstglwindow.h index ba2f1036e7..4a03fc8293 100644 --- a/gst-libs/gst/gl/gstglwindow.h +++ b/gst-libs/gst/gl/gstglwindow.h @@ -76,6 +76,8 @@ struct _GstGLWindow { guintptr external_gl_context; + gboolean is_drawing; + GstGLWindowCB draw; gpointer draw_data; GDestroyNotify draw_notify;