From: Víctor Manuel Jáquez Leal Date: Wed, 4 Nov 2015 20:38:42 +0000 (+0100) Subject: plugins: fix context query handling X-Git-Tag: 1.19.3~503^2~1607 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b2707c8eece0a57906b3225f3f8706d94d41831c;p=platform%2Fupstream%2Fgstreamer.git plugins: fix context query handling The current context query handling design is flawed: the function gst_vaapi_reply_to_query() returns FALSE either if the query is not a GST_CONTEXT_QUERY of if the query could not be handled correctly. But the pad query function should handle differently each case. This patch changes the gst_vaapi_reply_to_query() for gst_vaapi_handle_context_query() and changes it usage in all the vaapi plugins to match the correct context query handling. Signed-off-by: Víctor Manuel Jáquez Leal https://bugzilla.gnome.org/show_bug.cgi?id=757598 --- diff --git a/gst/vaapi/gstvaapidecode.c b/gst/vaapi/gstvaapidecode.c index 6be9eb1..7bec7b8 100644 --- a/gst/vaapi/gstvaapidecode.c +++ b/gst/vaapi/gstvaapidecode.c @@ -1057,11 +1057,6 @@ gst_vaapidecode_sink_query (GstVideoDecoder * vdec, GstQuery * query) GstVaapiDecode *const decode = GST_VAAPIDECODE (vdec); GstVaapiPluginBase *const plugin = GST_VAAPI_PLUGIN_BASE (decode); - if (gst_vaapi_reply_to_query (query, plugin->display)) { - GST_DEBUG_OBJECT (decode, "sharing display %p", plugin->display); - return TRUE; - } - switch (GST_QUERY_TYPE (query)) { case GST_QUERY_CAPS:{ GstCaps *caps, *filter = NULL; @@ -1080,6 +1075,10 @@ gst_vaapidecode_sink_query (GstVideoDecoder * vdec, GstQuery * query) gst_caps_unref (caps); break; } + case GST_QUERY_CONTEXT:{ + ret = gst_vaapi_handle_context_query (query, plugin->display); + break; + } default:{ #if GST_CHECK_VERSION(1,4,0) ret = GST_VIDEO_DECODER_CLASS (gst_vaapidecode_parent_class)->sink_query @@ -1105,11 +1104,6 @@ gst_vaapidecode_src_query (GstVideoDecoder * vdec, GstQuery * query) GstVaapiDecode *const decode = GST_VAAPIDECODE (vdec); GstVaapiPluginBase *const plugin = GST_VAAPI_PLUGIN_BASE (decode); - if (gst_vaapi_reply_to_query (query, plugin->display)) { - GST_DEBUG_OBJECT (decode, "sharing display %p", plugin->display); - return TRUE; - } - switch (GST_QUERY_TYPE (query)) { case GST_QUERY_CAPS:{ GstCaps *caps, *filter = NULL; @@ -1128,6 +1122,10 @@ gst_vaapidecode_src_query (GstVideoDecoder * vdec, GstQuery * query) gst_caps_unref (caps); break; } + case GST_QUERY_CONTEXT:{ + ret = gst_vaapi_handle_context_query (query, plugin->display); + break; + } default:{ #if GST_CHECK_VERSION(1,4,0) ret = GST_VIDEO_DECODER_CLASS (gst_vaapidecode_parent_class)->src_query diff --git a/gst/vaapi/gstvaapiencode.c b/gst/vaapi/gstvaapiencode.c index 88c5549..1415441 100644 --- a/gst/vaapi/gstvaapiencode.c +++ b/gst/vaapi/gstvaapiencode.c @@ -66,8 +66,8 @@ gst_vaapiencode_query (GstPad * pad, GstObject * parent, GstQuery * query) GST_INFO_OBJECT (plugin, "query type %s", GST_QUERY_TYPE_NAME (query)); - if (gst_vaapi_reply_to_query (query, plugin->display)) - success = TRUE; + if (GST_QUERY_TYPE (query) == GST_QUERY_CONTEXT) + success = gst_vaapi_handle_context_query (query, plugin->display); else if (GST_PAD_IS_SINK (pad)) success = plugin->sinkpad_query (plugin->sinkpad, parent, query); else diff --git a/gst/vaapi/gstvaapipluginutil.c b/gst/vaapi/gstvaapipluginutil.c index 00babbe..74f311b 100644 --- a/gst/vaapi/gstvaapipluginutil.c +++ b/gst/vaapi/gstvaapipluginutil.c @@ -255,13 +255,12 @@ gst_vaapi_ensure_display (GstElement * element, GstVaapiDisplayType type) } gboolean -gst_vaapi_reply_to_query (GstQuery * query, GstVaapiDisplay * display) +gst_vaapi_handle_context_query (GstQuery * query, GstVaapiDisplay * display) { const gchar *type = NULL; GstContext *context, *old_context; - if (GST_QUERY_TYPE (query) != GST_QUERY_CONTEXT) - return FALSE; + g_return_val_if_fail (query != NULL, FALSE); if (!display) return FALSE; diff --git a/gst/vaapi/gstvaapipluginutil.h b/gst/vaapi/gstvaapipluginutil.h index 4ca8225..d46f2db 100644 --- a/gst/vaapi/gstvaapipluginutil.h +++ b/gst/vaapi/gstvaapipluginutil.h @@ -35,7 +35,7 @@ gst_vaapi_ensure_display (GstElement * element, GstVaapiDisplayType type); G_GNUC_INTERNAL gboolean -gst_vaapi_reply_to_query (GstQuery * query, GstVaapiDisplay * display); +gst_vaapi_handle_context_query (GstQuery * query, GstVaapiDisplay * display); G_GNUC_INTERNAL gboolean diff --git a/gst/vaapi/gstvaapipostproc.c b/gst/vaapi/gstvaapipostproc.c index fc8c7cb..38fa9b5 100644 --- a/gst/vaapi/gstvaapipostproc.c +++ b/gst/vaapi/gstvaapipostproc.c @@ -1286,11 +1286,13 @@ gst_vaapipostproc_query (GstBaseTransform * trans, GstPadDirection direction, { GstVaapiPostproc *const postproc = GST_VAAPIPOSTPROC (trans); - if (gst_vaapi_reply_to_query (query, - GST_VAAPI_PLUGIN_BASE_DISPLAY (postproc))) { - GST_DEBUG_OBJECT (postproc, "sharing display %p", - GST_VAAPI_PLUGIN_BASE_DISPLAY (postproc)); - return TRUE; + if (GST_QUERY_TYPE (query) == GST_QUERY_CONTEXT) { + if (gst_vaapi_handle_context_query (query, + GST_VAAPI_PLUGIN_BASE_DISPLAY (postproc))) { + GST_DEBUG_OBJECT (postproc, "sharing display %p", + GST_VAAPI_PLUGIN_BASE_DISPLAY (postproc)); + return TRUE; + } } return diff --git a/gst/vaapi/gstvaapisink.c b/gst/vaapi/gstvaapisink.c index b148cac..7ff8401 100644 --- a/gst/vaapi/gstvaapisink.c +++ b/gst/vaapi/gstvaapisink.c @@ -1447,15 +1447,20 @@ static gboolean gst_vaapisink_query (GstBaseSink * base_sink, GstQuery * query) { GstVaapiSink *const sink = GST_VAAPISINK_CAST (base_sink); + GstVaapiPluginBase *const plugin = GST_VAAPI_PLUGIN_BASE (sink); + gboolean ret = FALSE; - GST_INFO_OBJECT (sink, "query type %s", GST_QUERY_TYPE_NAME (query)); - - if (gst_vaapi_reply_to_query (query, GST_VAAPI_PLUGIN_BASE_DISPLAY (sink))) { - GST_DEBUG ("sharing display %p", GST_VAAPI_PLUGIN_BASE_DISPLAY (sink)); - return TRUE; + switch (GST_QUERY_TYPE (query)) { + case GST_QUERY_CONTEXT: + ret = gst_vaapi_handle_context_query (query, plugin->display); + break; + default: + ret = GST_BASE_SINK_CLASS (gst_vaapisink_parent_class)->query (base_sink, + query); + break; } - return GST_BASE_SINK_CLASS (gst_vaapisink_parent_class)->query (base_sink, - query); + + return ret; } static void