summaryrefslogtreecommitdiff
path: root/gst-libs
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2015-08-17 18:35:58 +0200
committerMatthew Waters <matthew@centricular.com>2015-08-20 23:25:35 +1000
commit40d2693d074038fd2a7648f371bd7c9d39ce1b5b (patch)
tree93fb9e44069cb9982601ce35de30d0b4722fa47f /gst-libs
parent0cc2156572755626a170ad99345647faf4d43a84 (diff)
downloadgstreamer-plugins-bad-40d2693d074038fd2a7648f371bd7c9d39ce1b5b.tar.gz
glbasefilter: only call gl_{stop,start} if the context changed
Removes the redundant GL object creation/deletion on every decide_allocation call which is being called for every caps change. Thus reduces the required GL state changes on reconfigure events which are being sent by glimagesink/xvimagesink
Diffstat (limited to 'gst-libs')
-rw-r--r--gst-libs/gst/gl/gstglbasefilter.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/gst-libs/gst/gl/gstglbasefilter.c b/gst-libs/gst/gl/gstglbasefilter.c
index c89d83638..68cc114c7 100644
--- a/gst-libs/gst/gl/gstglbasefilter.c
+++ b/gst-libs/gst/gl/gstglbasefilter.c
@@ -327,6 +327,10 @@ gst_gl_base_filter_decide_allocation (GstBaseTransform * trans,
{
GstGLBaseFilter *filter = GST_GL_BASE_FILTER (trans);
GError *error = NULL;
+ gboolean new_context = FALSE;
+
+ if (!filter->context)
+ new_context = TRUE;
_find_local_gl_context (filter);
@@ -349,14 +353,17 @@ gst_gl_base_filter_decide_allocation (GstBaseTransform * trans,
GST_OBJECT_UNLOCK (filter->display);
}
- if (filter->priv->gl_started)
- gst_gl_context_thread_add (filter->context, gst_gl_base_filter_gl_stop,
+ if (new_context) {
+ if (filter->priv->gl_started)
+ gst_gl_context_thread_add (filter->context, gst_gl_base_filter_gl_stop,
+ filter);
+
+ gst_gl_context_thread_add (filter->context, gst_gl_base_filter_gl_start,
filter);
- gst_gl_context_thread_add (filter->context, gst_gl_base_filter_gl_start,
- filter);
- if (!filter->priv->gl_result)
- goto error;
+ if (!filter->priv->gl_result)
+ goto error;
+ }
return TRUE;