[Demux] Bugfix for set_property function
authorSangjung Woo <sangjung.woo@samsung.com>
Wed, 15 Jul 2020 09:36:05 +0000 (18:36 +0900)
committerwooksong <wook16.song@samsung.com>
Thu, 16 Jul 2020 04:14:26 +0000 (13:14 +0900)
If `tensorpick` property of demux element is set twice by calling
g_object_set() function, the previous value should be removed and
new one should be written. However, the value is appended and it can
make a problem. This patch fixes this bug.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
gst/nnstreamer/tensor_demux/gsttensordemux.c

index ccf0c26..9fce6d3 100644 (file)
@@ -546,6 +546,12 @@ gst_tensor_demux_set_property (GObject * object, guint prop_id,
       const gchar *param = g_value_get_string (value);
       gchar **strv = g_strsplit_set (param, ",.;/", -1);
       gint num = g_strv_length (strv);
+
+      /* Before setting the new Tensor Pick data, the existing one should be removed. */
+      if (filter->tensorpick) {
+        g_list_free (filter->tensorpick);
+        filter->tensorpick = NULL;
+      }
       for (i = 0; i < num; i++) {
         val = g_ascii_strtoll (strv[i], NULL, 10);
         filter->tensorpick =