glbasefilter: track gl_start/stop correctly

Don't start multiple times without calling gl_stop.
This commit is contained in:
Matthew Waters 2015-05-19 11:09:54 +10:00 committed by Tim-Philipp Müller
parent 0e2fe3c2e9
commit 5a275c77eb

View file

@ -37,6 +37,7 @@ struct _GstGLBaseFilterPrivate
GstGLContext *other_context; GstGLContext *other_context;
gboolean gl_result; gboolean gl_result;
gboolean gl_started;
}; };
/* Properties */ /* Properties */
@ -302,6 +303,8 @@ gst_gl_base_filter_gl_start (GstGLContext * context, gpointer data)
} else { } else {
filter->priv->gl_result = TRUE; filter->priv->gl_result = TRUE;
} }
filter->priv->gl_started |= filter->priv->gl_result;
} }
static void static void
@ -310,10 +313,14 @@ gst_gl_base_filter_gl_stop (GstGLContext * context, gpointer data)
GstGLBaseFilter *filter = GST_GL_BASE_FILTER (data); GstGLBaseFilter *filter = GST_GL_BASE_FILTER (data);
GstGLBaseFilterClass *filter_class = GST_GL_BASE_FILTER_GET_CLASS (filter); GstGLBaseFilterClass *filter_class = GST_GL_BASE_FILTER_GET_CLASS (filter);
if (filter->priv->gl_started) {
if (filter_class->gl_stop) if (filter_class->gl_stop)
filter_class->gl_stop (filter); filter_class->gl_stop (filter);
} }
filter->priv->gl_started = FALSE;
}
static gboolean static gboolean
gst_gl_base_filter_decide_allocation (GstBaseTransform * trans, gst_gl_base_filter_decide_allocation (GstBaseTransform * trans,
GstQuery * query) GstQuery * query)
@ -348,6 +355,10 @@ gst_gl_base_filter_decide_allocation (GstBaseTransform * trans,
GST_OBJECT_UNLOCK (filter->display); GST_OBJECT_UNLOCK (filter->display);
} }
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, gst_gl_context_thread_add (filter->context, gst_gl_base_filter_gl_start,
filter); filter);
if (!filter->priv->gl_result) if (!filter->priv->gl_result)