[Filter] error in query caps
authorJaeyun <jy1210.jung@samsung.com>
Thu, 6 May 2021 04:35:27 +0000 (13:35 +0900)
committerSangjung Woo <again4you@gmail.com>
Fri, 7 May 2021 06:13:04 +0000 (15:13 +0900)
In transform-caps function, element should not query caps to peer.
The element should add all possible caps here.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
gst/nnstreamer/tensor_filter/tensor_filter.c

index 8cb3537..ab1dc4c 100644 (file)
@@ -846,25 +846,37 @@ done:
 }
 
 /**
- * @brief Get caps for given config.
+ * @brief Get possible caps for given config.
  * @param self "this" pointer
  * @param config tensor config info
- * @param is_output flag to check the config info is for src-pad.
+ * @param is_output flag to check the config info is for src pad.
  */
 static GstCaps *
 gst_tensor_filter_caps_from_config (GstTensorFilter * self,
-    GstTensorsConfig * config, gboolean is_output)
+    const GstTensorsConfig * config, const gboolean is_output)
 {
-  GstPad *pad;
+  GstCaps *caps;
 
   g_return_val_if_fail (config != NULL, NULL);
 
-  if (is_output)
-    pad = GST_BASE_TRANSFORM_SRC_PAD (&self->element);
-  else
-    pad = GST_BASE_TRANSFORM_SINK_PAD (&self->element);
+  caps = gst_caps_new_empty ();
 
-  return gst_tensors_get_caps (pad, config);
+  /* other/tensor if the number of tensor is 1 */
+  if (config->info.num_tensors == 1) {
+    GstTensorConfig c;
+
+    gst_tensor_config_init (&c);
+    c.info = config->info.info[0];
+    c.rate_n = config->rate_n;
+    c.rate_d = config->rate_d;
+
+    gst_caps_append (caps, gst_tensor_caps_from_config (&c));
+  }
+
+  /* other/tensors */
+  gst_caps_append (caps, gst_tensors_caps_from_config (config));
+
+  return gst_caps_simplify (caps);
 }
 
 /**