mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-02 22:46:35 +00:00
[751/906] gldisplay: Don't hold lock while sending a message to the GL thread
https://bugzilla.gnome.org/show_bug.cgi?id=704247
This commit is contained in:
parent
15438d5b7f
commit
ef68e5ade2
1 changed files with 21 additions and 15 deletions
|
@ -41,12 +41,10 @@ G_DEFINE_TYPE_WITH_CODE (GstGLDisplay, gst_gl_display, G_TYPE_OBJECT,
|
||||||
(G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GL_DISPLAY, GstGLDisplayPrivate))
|
(G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GL_DISPLAY, GstGLDisplayPrivate))
|
||||||
|
|
||||||
static void gst_gl_display_finalize (GObject * object);
|
static void gst_gl_display_finalize (GObject * object);
|
||||||
static void _gst_gl_display_thread_run_generic (GstGLDisplay * display);
|
|
||||||
|
|
||||||
struct _GstGLDisplayPrivate
|
struct _GstGLDisplayPrivate
|
||||||
{
|
{
|
||||||
GstGLDisplayThreadFunc func;
|
gint dummy;
|
||||||
gpointer data;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*------------------------------------------------------------
|
/*------------------------------------------------------------
|
||||||
|
@ -91,13 +89,21 @@ gst_gl_display_finalize (GObject * object)
|
||||||
G_OBJECT_CLASS (gst_gl_display_parent_class)->finalize (object);
|
G_OBJECT_CLASS (gst_gl_display_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
typedef struct
|
||||||
_gst_gl_display_thread_run_generic (GstGLDisplay * display)
|
|
||||||
{
|
{
|
||||||
GST_TRACE ("running function:%p data:%p",
|
GstGLDisplay *display;
|
||||||
display->priv->func, display->priv->data);
|
GstGLDisplayThreadFunc func;
|
||||||
|
gpointer data;
|
||||||
|
} RunGenericData;
|
||||||
|
|
||||||
display->priv->func (display, display->priv->data);
|
static void
|
||||||
|
_gst_gl_display_thread_run_generic (RunGenericData * data)
|
||||||
|
{
|
||||||
|
GST_TRACE ("running function:%p data:%p", data->func, data->data);
|
||||||
|
|
||||||
|
data->func (data->display, data->data);
|
||||||
|
g_object_unref (data->display);
|
||||||
|
g_slice_free (RunGenericData, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
GstGLDisplay *
|
GstGLDisplay *
|
||||||
|
@ -110,19 +116,19 @@ void
|
||||||
gst_gl_display_thread_add (GstGLDisplay * display,
|
gst_gl_display_thread_add (GstGLDisplay * display,
|
||||||
GstGLDisplayThreadFunc func, gpointer data)
|
GstGLDisplayThreadFunc func, gpointer data)
|
||||||
{
|
{
|
||||||
|
RunGenericData *rdata;
|
||||||
|
|
||||||
g_return_if_fail (GST_IS_GL_DISPLAY (display));
|
g_return_if_fail (GST_IS_GL_DISPLAY (display));
|
||||||
g_return_if_fail (GST_GL_IS_WINDOW (display->window));
|
g_return_if_fail (GST_GL_IS_WINDOW (display->window));
|
||||||
g_return_if_fail (func != NULL);
|
g_return_if_fail (func != NULL);
|
||||||
|
|
||||||
gst_gl_display_lock (display);
|
rdata = g_slice_new (RunGenericData);
|
||||||
|
rdata->display = g_object_ref (display);
|
||||||
display->priv->data = data;
|
rdata->data = data;
|
||||||
display->priv->func = func;
|
rdata->func = func;
|
||||||
|
|
||||||
gst_gl_window_send_message (display->window,
|
gst_gl_window_send_message (display->window,
|
||||||
GST_GL_WINDOW_CB (_gst_gl_display_thread_run_generic), display);
|
GST_GL_WINDOW_CB (_gst_gl_display_thread_run_generic), rdata);
|
||||||
|
|
||||||
gst_gl_display_unlock (display);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GstGLAPI
|
GstGLAPI
|
||||||
|
|
Loading…
Reference in a new issue