From 6dcf77b64a943aa1ed3348ea8ba02b7311ab91ed Mon Sep 17 00:00:00 2001 From: MyungJoo Ham Date: Mon, 5 Nov 2018 17:00:48 +0900 Subject: [PATCH] [Filter] Handle othercap only when it's valid. Assume othercap is "ANY" if cap-size is ZERO. Fixes #549 Signed-off-by: MyungJoo Ham --- gst/tensor_filter/tensor_filter.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/gst/tensor_filter/tensor_filter.c b/gst/tensor_filter/tensor_filter.c index 5be6ec2..5d84de7 100644 --- a/gst/tensor_filter/tensor_filter.c +++ b/gst/tensor_filter/tensor_filter.c @@ -1032,9 +1032,15 @@ gst_tensor_filter_transform_caps (GstBaseTransform * trans, } } - if (filter) { + if (filter && gst_caps_get_size (filter) > 0) { GstCaps *intersection; + /** + * @todo We do not have a testcase hitting here. Thus, we do not ensure the validity here. + * However, according to gstreamer doxygen entry, if filter is given, that's not to be ignored. + * For now, we assume that if caps-size is 0, filter is "ANY". + */ + intersection = gst_caps_intersect_full (filter, result, GST_CAPS_INTERSECT_FIRST); @@ -1065,9 +1071,9 @@ gst_tensor_filter_fixate_caps (GstBaseTransform * trans, /** * To get the out-caps, GstTensorFilter has to parse tensor info from NN model. */ - gst_caps_unref (othercaps); - result = gst_tensor_filter_transform_caps (trans, direction, caps, NULL); + result = gst_tensor_filter_transform_caps (trans, direction, caps, othercaps); + gst_caps_unref (othercaps); result = gst_caps_make_writable (result); result = gst_caps_fixate (result); -- 2.7.4