vaapidecode: make decoder work with playbin

When playbin/decodebin builds the pipeline, it puts decoders and sinks
into different bins and forwards the queries from bins to bins. So in
the initials steps the pipeline is built iteratively by playbin and
looks like this :

[filesrc]

[filesrc] -> [typefind]

[filesrc] -> [typefind] -> [demuxer]

[filesrc] -> [typefind] -> [demuxer] -> [decoder]

At this point the decoder is asked for its SRC caps and it will make a
choice based on what gst_pad_peer_query_caps() returns. The problem is
that the caps returns at that point includes caps features like ANY,
essentially because playbin can plug in additional elements like
videoscale, videoconv or deinterlace.

This patch adds a another call to
gst_vaapi_find_preferred_caps_feature() when the decoder decides its
allocation, to make sure we asks the downstream elements when the
entire pipeline has been built.

https://bugzilla.gnome.org/show_bug.cgi?id=731645
This commit is contained in:
Lionel Landwerlin 2014-06-13 21:45:04 +01:00 committed by Gwenole Beauchesne
parent 4d2de696a9
commit 334a0ca8bd

View file

@ -514,6 +514,7 @@ gst_vaapidecode_decide_allocation(GstVideoDecoder *vdec, GstQuery *query)
gboolean has_video_meta = FALSE; gboolean has_video_meta = FALSE;
GstVideoCodecState *state; GstVideoCodecState *state;
#if GST_CHECK_VERSION(1,1,0) && USE_GLX #if GST_CHECK_VERSION(1,1,0) && USE_GLX
gboolean has_texture_upload_meta = FALSE;
GstCapsFeatures *features, *features2; GstCapsFeatures *features, *features2;
#endif #endif
@ -534,10 +535,22 @@ gst_vaapidecode_decide_allocation(GstVideoDecoder *vdec, GstQuery *query)
features = gst_caps_get_features(state->caps, 0); features = gst_caps_get_features(state->caps, 0);
features2 = gst_caps_features_new(GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META, NULL); features2 = gst_caps_features_new(GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META, NULL);
has_texture_upload_meta =
gst_vaapi_find_preferred_caps_feature(GST_VIDEO_DECODER_SRC_PAD(vdec),
GST_VIDEO_FORMAT_ENCODED) ==
GST_VAAPI_CAPS_FEATURE_GL_TEXTURE_UPLOAD_META;
/* Update src caps if feature is not handled downstream */ /* Update src caps if feature is not handled downstream */
if (!decode->has_texture_upload_meta && if (!decode->has_texture_upload_meta &&
gst_caps_features_is_equal(features, features2)) gst_caps_features_is_equal(features, features2))
gst_vaapidecode_update_src_caps (decode, state); gst_vaapidecode_update_src_caps (decode, state);
else if (has_texture_upload_meta &&
!gst_caps_features_is_equal(features, features2)) {
gst_video_info_set_format(&state->info, GST_VIDEO_FORMAT_RGBA,
state->info.width,
state->info.height);
gst_vaapidecode_update_src_caps(decode, state);
}
gst_caps_features_free(features2); gst_caps_features_free(features2);
#endif #endif