[edge] Deprecate port and host property of edgesrc and update description for port...
authorhyunil park <hyunil46.park@samsung.com>
Fri, 20 Oct 2023 01:12:54 +0000 (10:12 +0900)
committerjaeyun-jung <39614140+jaeyun-jung@users.noreply.github.com>
Mon, 23 Oct 2023 11:03:55 +0000 (20:03 +0900)
- Add a description of deprecated for port and host property of edgesrc.
  In the case of edgesrc, port and host settings are not required.
- Update description of port property of edgesink

Signed-off-by: hyunil park <hyunil46.park@samsung.com>
gst/edge/edge_sink.c
gst/edge/edge_src.c
gst/edge/edge_src.h
tests/nnstreamer_edge/edge/unittest_edge.cc

index e66d4a6..7bf77c2 100644 (file)
@@ -95,7 +95,9 @@ gst_edgesink_class_init (GstEdgeSinkClass * klass)
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   g_object_class_install_property (gobject_class, PROP_PORT,
       g_param_spec_uint ("port", "Port",
-          "A self port address to accept connection from edgesrc.",
+          "A self port address to accept connection from edgesrc. "
+          "If the port is set to 0 then the available port is allocated. "
+          "If the connect-type is AITT then the port setting is not required.",
           0, 65535, DEFAULT_PORT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   g_object_class_install_property (gobject_class, PROP_CONNECT_TYPE,
       g_param_spec_enum ("connect-type", "Connect Type",
index 64d5d0d..2ed2b4b 100644 (file)
@@ -82,20 +82,21 @@ gst_edgesrc_class_init (GstEdgeSrcClass * klass)
 
   g_object_class_install_property (gobject_class, PROP_HOST,
       g_param_spec_string ("host", "Host",
-          "A self host address", DEFAULT_HOST,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+          "A self host address (DEPRECATED, has no effect).", DEFAULT_HOST,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_DEPRECATED));
   g_object_class_install_property (gobject_class, PROP_PORT,
       g_param_spec_uint ("port", "Port",
-          "A self port number.",
-          0, 65535, DEFAULT_PORT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+          "A self port number (DEPRECATED, has no effect).",
+          0, 65535, DEFAULT_PORT,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_DEPRECATED));
   g_object_class_install_property (gobject_class, PROP_DEST_HOST,
       g_param_spec_string ("dest-host", "Destination Host",
           "A host address of edgesink to receive the packets from edgesink",
           DEFAULT_HOST, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   g_object_class_install_property (gobject_class, PROP_DEST_PORT,
       g_param_spec_uint ("dest-port", "Destination Port",
-          "A port of edgesink to receive the packets from edgesink",
-          0, 65535, DEFAULT_PORT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+          "A port of edgesink to receive the packets from edgesink", 0, 65535,
+          DEFAULT_PORT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   g_object_class_install_property (gobject_class, PROP_CONNECT_TYPE,
       g_param_spec_enum ("connect-type", "Connect Type",
           "The connections type between edgesink and edgesrc.",
@@ -132,8 +133,6 @@ gst_edgesrc_init (GstEdgeSrc * self)
   gst_base_src_set_format (basesrc, GST_FORMAT_TIME);
   gst_base_src_set_async (basesrc, FALSE);
 
-  self->host = g_strdup (DEFAULT_HOST);
-  self->port = DEFAULT_PORT;
   self->dest_host = g_strdup (DEFAULT_HOST);
   self->dest_port = DEFAULT_PORT;
   self->topic = NULL;
@@ -152,15 +151,10 @@ gst_edgesrc_set_property (GObject * object, guint prop_id, const GValue * value,
 
   switch (prop_id) {
     case PROP_HOST:
-      if (!g_value_get_string (value)) {
-        nns_logw ("host property cannot be NULL");
-        break;
-      }
-      g_free (self->host);
-      self->host = g_value_dup_string (value);
+      nns_logw ("host property is deprecated");
       break;
     case PROP_PORT:
-      self->port = g_value_get_uint (value);
+      nns_logw ("port property is deprecated");
       break;
     case PROP_DEST_HOST:
       gst_edgesrc_set_dest_host (self, g_value_get_string (value));
@@ -196,10 +190,10 @@ gst_edgesrc_get_property (GObject * object, guint prop_id, GValue * value,
 
   switch (prop_id) {
     case PROP_HOST:
-      g_value_set_string (value, self->host);
+      nns_logw ("host property is deprecated");
       break;
     case PROP_PORT:
-      g_value_set_uint (value, self->port);
+      nns_logw ("port property is deprecated");
       break;
     case PROP_DEST_HOST:
       g_value_set_string (value, gst_edgesrc_get_dest_host (self));
@@ -228,9 +222,6 @@ gst_edgesrc_class_finalize (GObject * object)
   GstEdgeSrc *self = GST_EDGESRC (object);
   nns_edge_data_h data_h;
 
-  g_free (self->host);
-  self->host = NULL;
-
   g_free (self->dest_host);
   self->dest_host = NULL;
 
@@ -320,13 +311,6 @@ gst_edgesrc_start (GstBaseSrc * basesrc)
     return FALSE;
   }
 
-  if (self->host)
-    nns_edge_set_info (self->edge_h, "HOST", self->host);
-  if (self->port > 0) {
-    port = g_strdup_printf ("%u", self->port);
-    nns_edge_set_info (self->edge_h, "PORT", port);
-    g_free (port);
-  }
   if (self->dest_host)
     nns_edge_set_info (self->edge_h, "DEST_HOST", self->dest_host);
   if (self->dest_port > 0) {
index 397d886..8ccfce4 100644 (file)
@@ -42,8 +42,6 @@ struct _GstEdgeSrc
 {
   GstBaseSrc element;
 
-  gchar *host;
-  guint16 port;
   gchar *dest_host;
   guint16 dest_port;
   gchar *topic;
index c629a1b..5bc73c0 100644 (file)
@@ -107,7 +107,7 @@ TEST (edgeSrc, properties0)
   gchar *str_val;
 
   /* Create a nnstreamer pipeline */
-  pipeline = g_strdup_printf ("gst-launch-1.0 edgesrc port=0 name=srcx ! "
+  pipeline = g_strdup_printf ("gst-launch-1.0 edgesrc name=srcx ! "
                               "other/tensors,num_tensors=1,dimensions=3:320:240:1,types=uint8,format=static,framerate=30/1 ! "
                               "tensor_sink");
   gstpipe = gst_parse_launch (pipeline, NULL);
@@ -117,15 +117,6 @@ TEST (edgeSrc, properties0)
   EXPECT_NE (edge_handle, nullptr);
 
   /* Set/Get properties of edgesrc */
-  g_object_set (edge_handle, "host", "127.0.0.2", NULL);
-  g_object_get (edge_handle, "host", &str_val, NULL);
-  EXPECT_STREQ ("127.0.0.2", str_val);
-  g_free (str_val);
-
-  g_object_set (edge_handle, "port", 5001U, NULL);
-  g_object_get (edge_handle, "port", &uint_val, NULL);
-  EXPECT_EQ (5001U, uint_val);
-
   g_object_set (edge_handle, "dest-host", "127.0.0.2", NULL);
   g_object_get (edge_handle, "dest-host", &str_val, NULL);
   EXPECT_STREQ ("127.0.0.2", str_val);