plugin: don't lose previous context at query

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 <victorx.jaquez@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=757598
This commit is contained in:
Víctor Manuel Jáquez Leal 2015-11-04 20:37:05 +01:00
parent ed280f5b84
commit 28c366a003

View file

@ -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);