vaapidecode: upload meta only if feature and allocation

When vaapidecode finishes the decoding of a frame and pushes it,
if, in the decide_allocation() method, it is determined if the
next element supports the GL texture upload meta feature, the
decoder adds the buffer's meta.

Nonetheless, in the same spirit of the commit 71d3ce4d, the
determination if the next element supports the GL texture upload
meta needs to check both the preferred caps feature *and* if the
allocation query request the API type.

This patch, first removes the unused variable need_pool, and
determines the attribute has_texture_upload_meta using the
preferred caps feature *and* the allocation query.

Also, the feature passed to GstVaapPluginBase is not longer
determined by has_texture_upload_meta, but by the computed
preferred one.

https://bugzilla.gnome.org/show_bug.cgi?id=744618

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
This commit is contained in:
Víctor Manuel Jáquez Leal 2015-02-26 12:26:54 +02:00 committed by Sreerenj Balachandran
parent 9799875df4
commit e4f8d14979

View file

@ -583,25 +583,23 @@ gst_vaapidecode_decide_allocation(GstVideoDecoder *vdec, GstQuery *query)
{ {
GstVaapiDecode * const decode = GST_VAAPIDECODE(vdec); GstVaapiDecode * const decode = GST_VAAPIDECODE(vdec);
GstCaps *caps = NULL; GstCaps *caps = NULL;
gboolean need_pool;
GstVideoCodecState *state; GstVideoCodecState *state;
GstVaapiCapsFeature feature; GstVaapiCapsFeature feature;
GstVideoFormat out_format; GstVideoFormat out_format;
gst_query_parse_allocation(query, &caps, &need_pool); gst_query_parse_allocation(query, &caps, NULL);
feature =
gst_vaapi_find_preferred_caps_feature(GST_VIDEO_DECODER_SRC_PAD(vdec),
GST_VIDEO_FORMAT_ENCODED, &out_format);
decode->has_texture_upload_meta = FALSE; decode->has_texture_upload_meta = FALSE;
#if GST_CHECK_VERSION(1,1,0) && (USE_GLX || USE_EGL) #if GST_CHECK_VERSION(1,1,0) && (USE_GLX || USE_EGL)
decode->has_texture_upload_meta = decode->has_texture_upload_meta =
gst_vaapi_find_preferred_caps_feature(GST_VIDEO_DECODER_SRC_PAD(vdec), (feature == GST_VAAPI_CAPS_FEATURE_GL_TEXTURE_UPLOAD_META) &&
GST_VIDEO_FORMAT_ENCODED, &out_format) == gst_query_find_allocation_meta (query,
GST_VAAPI_CAPS_FEATURE_GL_TEXTURE_UPLOAD_META; GST_VIDEO_GL_TEXTURE_UPLOAD_META_API_TYPE, NULL);
#endif #endif
feature = decode->has_texture_upload_meta ?
GST_VAAPI_CAPS_FEATURE_GL_TEXTURE_UPLOAD_META :
GST_VAAPI_CAPS_FEATURE_VAAPI_SURFACE;
/* Update src caps if feature is not handled downstream */ /* Update src caps if feature is not handled downstream */
state = gst_video_decoder_get_output_state(vdec); state = gst_video_decoder_get_output_state(vdec);
if (!gst_caps_is_always_compatible(caps, state->caps)) { if (!gst_caps_is_always_compatible(caps, state->caps)) {