mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-22 22:16:22 +00:00
[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:
parent
7f3ad8f445
commit
c775bf584b
3 changed files with 19 additions and 6 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -76,6 +76,8 @@ struct _GstGLWindow {
|
|||
|
||||
guintptr external_gl_context;
|
||||
|
||||
gboolean is_drawing;
|
||||
|
||||
GstGLWindowCB draw;
|
||||
gpointer draw_data;
|
||||
GDestroyNotify draw_notify;
|
||||
|
|
|
@ -984,6 +984,7 @@ gst_glimage_sink_on_draw (const GstGLImageSink * gl_sink)
|
|||
*/
|
||||
|
||||
const GstGLFuncs *gl = NULL;
|
||||
GstGLWindow *window = NULL;
|
||||
|
||||
g_return_if_fail (GST_IS_GLIMAGE_SINK (gl_sink));
|
||||
|
||||
|
@ -997,6 +998,9 @@ gst_glimage_sink_on_draw (const GstGLImageSink * gl_sink)
|
|||
return;
|
||||
}
|
||||
|
||||
window = gst_gl_context_get_window (gl_sink->context);
|
||||
window->is_drawing = TRUE;
|
||||
|
||||
/* opengl scene */
|
||||
GST_TRACE ("redrawing texture:%u", gl_sink->redisplay_texture);
|
||||
|
||||
|
@ -1019,15 +1023,10 @@ gst_glimage_sink_on_draw (const GstGLImageSink * gl_sink)
|
|||
GST_VIDEO_INFO_HEIGHT (&gl_sink->info),
|
||||
gl_sink->client_data);
|
||||
|
||||
if (doRedisplay) {
|
||||
GstGLWindow *window = gst_gl_context_get_window (gl_sink->context);
|
||||
|
||||
if (doRedisplay)
|
||||
gst_gl_window_draw_unlocked (window,
|
||||
GST_VIDEO_INFO_WIDTH (&gl_sink->info),
|
||||
GST_VIDEO_INFO_HEIGHT (&gl_sink->info));
|
||||
|
||||
gst_object_unref (window);
|
||||
}
|
||||
}
|
||||
/* default opengl scene */
|
||||
else {
|
||||
|
@ -1103,6 +1102,9 @@ gst_glimage_sink_on_draw (const GstGLImageSink * gl_sink)
|
|||
#endif
|
||||
} /* end default opengl scene */
|
||||
|
||||
window->is_drawing = FALSE;
|
||||
gst_object_unref (window);
|
||||
|
||||
GST_GLIMAGE_SINK_UNLOCK (gl_sink);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue