From fac74a88306885d5b4336f941513e1a448fe54e8 Mon Sep 17 00:00:00 2001 From: hyunil park Date: Fri, 20 Oct 2023 10:12:54 +0900 Subject: [PATCH] [edge] Deprecate port and host property of edgesrc and update description for port property - 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 --- gst/edge/edge_sink.c | 4 ++- gst/edge/edge_src.c | 38 +++++++++-------------------- gst/edge/edge_src.h | 2 -- tests/nnstreamer_edge/edge/unittest_edge.cc | 11 +-------- 4 files changed, 15 insertions(+), 40 deletions(-) diff --git a/gst/edge/edge_sink.c b/gst/edge/edge_sink.c index e66d4a6..7bf77c2 100644 --- a/gst/edge/edge_sink.c +++ b/gst/edge/edge_sink.c @@ -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", diff --git a/gst/edge/edge_src.c b/gst/edge/edge_src.c index 64d5d0d..2ed2b4b 100644 --- a/gst/edge/edge_src.c +++ b/gst/edge/edge_src.c @@ -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) { diff --git a/gst/edge/edge_src.h b/gst/edge/edge_src.h index 397d886..8ccfce4 100644 --- a/gst/edge/edge_src.h +++ b/gst/edge/edge_src.h @@ -42,8 +42,6 @@ struct _GstEdgeSrc { GstBaseSrc element; - gchar *host; - guint16 port; gchar *dest_host; guint16 dest_port; gchar *topic; diff --git a/tests/nnstreamer_edge/edge/unittest_edge.cc b/tests/nnstreamer_edge/edge/unittest_edge.cc index c629a1b..5bc73c0 100644 --- a/tests/nnstreamer_edge/edge/unittest_edge.cc +++ b/tests/nnstreamer_edge/edge/unittest_edge.cc @@ -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); -- 2.7.4