From 28c366a003c6483a0602775b3dd18add75c12592 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Wed, 4 Nov 2015 20:37:05 +0100 Subject: [PATCH] plugin: don't lose previous context at query MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When processing the GST_CONTEXT_QUERY we should not lose the previous context in the query, we should only add our display structure. This patch copies the old context, if it is there, and stamp our display on it. Otherwise, a new context is created. Signed-off-by: Víctor Manuel Jáquez Leal https://bugzilla.gnome.org/show_bug.cgi?id=757598 --- gst/vaapi/gstvaapipluginutil.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gst/vaapi/gstvaapipluginutil.c b/gst/vaapi/gstvaapipluginutil.c index 135d109..00babbe 100644 --- a/gst/vaapi/gstvaapipluginutil.c +++ b/gst/vaapi/gstvaapipluginutil.c @@ -258,7 +258,7 @@ gboolean gst_vaapi_reply_to_query (GstQuery * query, GstVaapiDisplay * display) { const gchar *type = NULL; - GstContext *context; + GstContext *context, *old_context; if (GST_QUERY_TYPE (query) != GST_QUERY_CONTEXT) return FALSE; @@ -272,7 +272,14 @@ gst_vaapi_reply_to_query (GstQuery * query, GstVaapiDisplay * display) if (g_strcmp0 (type, GST_VAAPI_DISPLAY_CONTEXT_TYPE_NAME)) return FALSE; - context = gst_vaapi_video_context_new_with_display (display, FALSE); + gst_query_parse_context (query, &old_context); + if (old_context) { + context = gst_context_copy (old_context); + gst_vaapi_video_context_set_display (context, display); + } else { + context = gst_vaapi_video_context_new_with_display (display, FALSE); + } + gst_query_set_context (query, context); gst_context_unref (context); -- 2.7.4