From 57f389d9ce2224a01511ce09f8c0957b25d4382a Mon Sep 17 00:00:00 2001 From: Julien Isorce Date: Fri, 19 Jun 2015 11:57:06 +0100 Subject: [PATCH] gl: use gst_gl_display_create_context in more elements. glbasefilter, glbasemixer and gltestsrc. https://bugzilla.gnome.org/show_bug.cgi?id=750310 --- ext/gl/gstglbasemixer.c | 9 +++++---- ext/gl/gstgltestsrc.c | 8 +++++--- gst-libs/gst/gl/gstglbasefilter.c | 16 ++-------------- 3 files changed, 12 insertions(+), 21 deletions(-) diff --git a/ext/gl/gstglbasemixer.c b/ext/gl/gstglbasemixer.c index d462c16..f8c8d19 100644 --- a/ext/gl/gstglbasemixer.c +++ b/ext/gl/gstglbasemixer.c @@ -469,15 +469,16 @@ gst_gl_base_mixer_decide_allocation (GstGLBaseMixer * mix, GstQuery * query) if (!mix->context) { GST_OBJECT_LOCK (mix->display); do { - if (mix->context) + if (mix->context) { gst_object_unref (mix->context); + mix->context = NULL; + } /* just get a GL context. we don't care */ mix->context = gst_gl_display_get_gl_context_for_thread (mix->display, NULL); if (!mix->context) { - mix->context = gst_gl_context_new (mix->display); - if (!gst_gl_context_create (mix->context, mix->priv->other_context, - &error)) { + if (!gst_gl_display_create_context (mix->display, + mix->priv->other_context, &mix->context, &error)) { GST_OBJECT_UNLOCK (mix->display); goto context_error; } diff --git a/ext/gl/gstgltestsrc.c b/ext/gl/gstgltestsrc.c index 4dca6cb..877b09a 100644 --- a/ext/gl/gstgltestsrc.c +++ b/ext/gl/gstgltestsrc.c @@ -779,14 +779,16 @@ gst_gl_test_src_decide_allocation (GstBaseSrc * basesrc, GstQuery * query) if (!src->context) { GST_OBJECT_LOCK (src->display); do { - if (src->context) + if (src->context) { gst_object_unref (src->context); + src->context = NULL; + } /* just get a GL context. we don't care */ src->context = gst_gl_display_get_gl_context_for_thread (src->display, NULL); if (!src->context) { - src->context = gst_gl_context_new (src->display); - if (!gst_gl_context_create (src->context, src->other_context, &error)) { + if (!gst_gl_display_create_context (src->display, src->other_context, + &src->context, &error)) { GST_OBJECT_UNLOCK (src->display); goto context_error; } diff --git a/gst-libs/gst/gl/gstglbasefilter.c b/gst-libs/gst/gl/gstglbasefilter.c index ff6c5e4..c89d836 100644 --- a/gst-libs/gst/gl/gstglbasefilter.c +++ b/gst-libs/gst/gl/gstglbasefilter.c @@ -339,14 +339,8 @@ gst_gl_base_filter_decide_allocation (GstBaseTransform * trans, filter->context = gst_gl_display_get_gl_context_for_thread (filter->display, NULL); if (!filter->context) { - filter->context = gst_gl_context_new (filter->display); - if (!filter->context) { - GST_OBJECT_UNLOCK (filter->display); - goto context_null_error; - } - - if (!gst_gl_context_create (filter->context, - filter->priv->other_context, &error)) { + if (!gst_gl_display_create_context (filter->display, + filter->priv->other_context, &filter->context, &error)) { GST_OBJECT_UNLOCK (filter->display); goto context_error; } @@ -372,12 +366,6 @@ context_error: (NULL)); return FALSE; } -context_null_error: - { - GST_ELEMENT_ERROR (trans, RESOURCE, FAILED, - ("Failed to create context."), (NULL)); - return FALSE; - } error: { GST_ELEMENT_ERROR (trans, LIBRARY, INIT, -- 2.7.4