From 0525f56ac538593171872510bdad32a30eed1e1f Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Mon, 24 Nov 2014 14:25:33 +0100 Subject: [PATCH] vaapipostproc: fix check for compatible src pad capsfilters. When an explicit output video format is selected, from an src pad capsfilter, make sure that the downstream element actually supports that format. In particular, fix crash with the following pipelines: ... ! vaapipostproc ! video/x-raw,format=XXX ! xvimagesink ; where XXX is a format not supported by xvimagesink. While doing so, also reduce the set of src pad filter caps to the actual set of allowed src pad caps. --- gst/vaapi/gstvaapipostproc.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/gst/vaapi/gstvaapipostproc.c b/gst/vaapi/gstvaapipostproc.c index fb014d16f5..8633b33ed0 100644 --- a/gst/vaapi/gstvaapipostproc.c +++ b/gst/vaapi/gstvaapipostproc.c @@ -1127,18 +1127,17 @@ gst_vaapipostproc_transform_caps_impl (GstBaseTransform * trans, if (postproc->format != DEFAULT_FORMAT) out_format = postproc->format; else { - GstCaps *peer_caps, *filter_caps; + GstCaps *peer_caps; GstVideoInfo peer_vi; - filter_caps = - gst_caps_from_string (GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL)); peer_caps = gst_pad_peer_query_caps (GST_BASE_TRANSFORM_SRC_PAD (trans), - filter_caps); + postproc->allowed_srcpad_caps); + if (gst_caps_is_empty (peer_caps)) + return peer_caps; if (!gst_caps_is_fixed (peer_caps)) peer_caps = gst_caps_fixate (peer_caps); gst_video_info_from_caps (&peer_vi, peer_caps); out_format = GST_VIDEO_INFO_FORMAT (&peer_vi); - gst_caps_unref (filter_caps); if (peer_caps) gst_caps_unref (peer_caps); }