Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debian/custom/action #18

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu_clean_llvm_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
if: env.rebuild == '1'
- run: meson test -C build/ -v
if: env.rebuild == '1'
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v3
if: failure()
with:
name: Meson_LLVM_Testlog
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu_clean_meson_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
gdb ${ERROREXEC} -c coredump -batch -ex bt
echo "::endgroup::"
fi
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v3
if: failure()
with:
name: Meson_Testlog
Expand Down
1 change: 0 additions & 1 deletion Documentation/coding-convention.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ Please try to stick with the same indentation rules (2 spaces) and refer to .cla
- [TAOS-CI, CI Service for On-Device AI Systems](https://github.com/nnstreamer/TAOS-CI)
- [Machine Learning APIs](https://github.com/nnstreamer/api)
- [NNStreamer-Edge, among-device AI support](https://github.com/nnstreamer/nnstreamer-edge)
- [AITT, an AI service oriented wrapper for MQTT](https://github.com/nnstreamer/aitt)
- [NNStreamer ROS (Robot OS) Support](https://github.com/nnstreamer/nnstreamer-ros)
- [NNStreamer Android Build Resource](https://github.com/nnstreamer/nnstreamer-android-resource): additional files required by Android builds.
- [NNStreamer Yocto/OpenEmbedded Layer](https://github.com/nnstreamer/meta-neural-network): refer to [Openembedded layer page](https://layers.openembedded.org/layerindex/branch/master/layer/meta-neural-network/)
Expand Down
1 change: 0 additions & 1 deletion Documentation/features-per-distro.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ This document reflects the status of 2022-07-14 (2.1.1 devel)
- SNPE
- grpc
- MQTT
- AITT (Since Tizen 7.0 M2)
- flexbuf (converter/decoder)
- flatbuf (converter/decoder)
- protobuf (converter/decoder)
Expand Down
3 changes: 1 addition & 2 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export NNSTREAMER_DECODERS=${NNSTREAMER_BUILD_ROOT_PATH}/ext/nnstreamer/tensor_d
export NNSTREAMER_CONVERTERS=${NNSTREAMER_BUILD_ROOT_PATH}/ext/nnstreamer/tensor_converter
export NNSTREAMER_TRAINERS=${NNSTREAMER_BUILD_ROOT_PATH}/ext/nnstreamer/tensor_trainer
export PYTHONIOENCODING=utf-8

ifeq ($(DEB_BUILD_ARCH_CPU), arm)
FLOAT16 := -Denable-float16=true
endif
Expand Down Expand Up @@ -63,7 +62,7 @@ override_dh_auto_build:

override_dh_auto_test:
./packaging/run_unittests_binaries.sh ./tests
./packaging/run_unittests_binaries.sh ./tests/nnstreamer_edge
LD_LIBRARY_PATH=${NNSTREAMER_BUILD_ROOT_PATH}/tests/nnstreamer_edge ./packaging/run_unittests_binaries.sh ./tests/nnstreamer_edge
./packaging/run_unittests_binaries.sh ./tests/nnstreamer_datarepo
ifeq ($(shell dpkg-vendor --derives-from Ubuntu && echo yes), yes)
ifeq ($(DEB_HOST_ARCH), amd64)
Expand Down
2 changes: 1 addition & 1 deletion gst/datarepo/gstdatareposrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ gst_data_repo_src_parse_caps (GstDataRepoSrc * src, GstCaps * caps)
channel = GST_AUDIO_INFO_CHANNELS (&audio_info);
depth = GST_AUDIO_INFO_DEPTH (&audio_info);

src->sample_size = channel * (depth / 8) * rate;
src->sample_size = (gsize) channel * (depth / 8) * rate;

GST_DEBUG_OBJECT (src,
"format(%s), depth(%d), rate(%d), channel(%d): %zd bps",
Expand Down
4 changes: 2 additions & 2 deletions gst/edge/edge_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ gst_edge_get_connect_type (void)
"Directly sending stream frames via TCP connections."},
{NNS_EDGE_CONNECT_TYPE_HYBRID, "HYBRID",
"Connect with MQTT brokers and directly sending stream frames via TCP connections."},
{NNS_EDGE_CONNECT_TYPE_AITT, "AITT",
"Sending stream frames via AITT connections."},
{NNS_EDGE_CONNECT_TYPE_MQTT, "MQTT",
"Sending stream frames via MQTT connections."},
{NNS_EDGE_CONNECT_TYPE_CUSTOM, "CUSTOM",
"Sending stream frames via CUSTOM connections."},
{0, NULL, NULL},
};
protocol = g_enum_register_static ("edge_protocol", protocols);
Expand Down
53 changes: 48 additions & 5 deletions gst/edge/edge_sink.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ enum
PROP_TOPIC,
PROP_WAIT_CONNECTION,
PROP_CONNECTION_TIMEOUT,
PROP_CUSTOM_LIB,

PROP_LAST
};
Expand All @@ -60,6 +61,7 @@ static void gst_edgesink_get_property (GObject * object,
static void gst_edgesink_finalize (GObject * object);

static gboolean gst_edgesink_start (GstBaseSink * basesink);
static gboolean gst_edgesink_stop (GstBaseSink * basesink);
static GstFlowReturn gst_edgesink_render (GstBaseSink * basesink,
GstBuffer * buffer);
static gboolean gst_edgesink_set_caps (GstBaseSink * basesink, GstCaps * caps);
Expand Down Expand Up @@ -96,8 +98,7 @@ gst_edgesink_class_init (GstEdgeSinkClass * klass)
g_object_class_install_property (gobject_class, PROP_PORT,
g_param_spec_uint ("port", "Port",
"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.",
"If the port is set to 0 then the available port is allocated. ",
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",
Expand Down Expand Up @@ -129,6 +130,10 @@ gst_edgesink_class_init (GstEdgeSinkClass * klass)
"The timeout (in milliseconds) for waiting a connection to receiver. "
"0 timeout (default) means infinite wait.", 0, G_MAXUINT64, 0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_CUSTOM_LIB,
g_param_spec_string ("custom-lib", "Custom connection lib path",
"User defined custom connection lib path.",
"", G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&sinktemplate));
Expand All @@ -138,6 +143,7 @@ gst_edgesink_class_init (GstEdgeSinkClass * klass)
"Publish incoming streams", "Samsung Electronics Co., Ltd.");

gstbasesink_class->start = gst_edgesink_start;
gstbasesink_class->stop = gst_edgesink_stop;
gstbasesink_class->render = gst_edgesink_render;
gstbasesink_class->set_caps = gst_edgesink_set_caps;

Expand All @@ -159,6 +165,7 @@ gst_edgesink_init (GstEdgeSink * self)
self->connect_type = DEFAULT_CONNECT_TYPE;
self->wait_connection = FALSE;
self->connection_timeout = 0;
self->custom_lib = NULL;
}

/**
Expand Down Expand Up @@ -205,6 +212,10 @@ gst_edgesink_set_property (GObject * object, guint prop_id,
case PROP_CONNECTION_TIMEOUT:
self->connection_timeout = g_value_get_uint64 (value);
break;
case PROP_CUSTOM_LIB:
g_free (self->custom_lib);
self->custom_lib = g_value_dup_string (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
Expand Down Expand Up @@ -245,6 +256,9 @@ gst_edgesink_get_property (GObject * object, guint prop_id, GValue * value,
case PROP_CONNECTION_TIMEOUT:
g_value_set_uint64 (value, self->connection_timeout);
break;
case PROP_CUSTOM_LIB:
g_value_set_string (value, self->custom_lib);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
Expand All @@ -268,6 +282,9 @@ gst_edgesink_finalize (GObject * object)
g_free (self->topic);
self->topic = NULL;

g_free (self->custom_lib);
self->custom_lib = NULL;

if (self->edge_h) {
nns_edge_release_handle (self->edge_h);
self->edge_h = NULL;
Expand All @@ -287,9 +304,17 @@ gst_edgesink_start (GstBaseSink * basesink)
int ret;
char *port = NULL;

ret =
nns_edge_create_handle (NULL, self->connect_type,
NNS_EDGE_NODE_TYPE_PUB, &self->edge_h);
if (NNS_EDGE_CONNECT_TYPE_CUSTOM != self->connect_type) {
ret = nns_edge_create_handle (NULL, self->connect_type,
NNS_EDGE_NODE_TYPE_PUB, &self->edge_h);
} else {
if (!self->custom_lib) {
nns_loge ("Failed to start edgesink. Custom library is not set.");
return FALSE;
}
ret = nns_edge_custom_create_handle (NULL, self->custom_lib,
NNS_EDGE_NODE_TYPE_PUB, &self->edge_h);
}

if (NNS_EDGE_ERROR_NONE != ret) {
nns_loge ("Failed to get nnstreamer edge handle.");
Expand Down Expand Up @@ -351,6 +376,24 @@ gst_edgesink_start (GstBaseSink * basesink)
return TRUE;
}

/**
* @brief Stop processing of edgesink
*/
static gboolean
gst_edgesink_stop (GstBaseSink * basesink)
{
GstEdgeSink *self = GST_EDGESINK (basesink);
int ret;

ret = nns_edge_stop (self->edge_h);
if (NNS_EDGE_ERROR_NONE != ret) {
nns_loge ("Failed to stop edge. error code(%d)", ret);
return FALSE;
}

return TRUE;
}

/**
* @brief render buffer, send buffer
*/
Expand Down
2 changes: 2 additions & 0 deletions gst/edge/edge_sink.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ struct _GstEdgeSink
nns_edge_h edge_h;
gboolean wait_connection;
guint64 connection_timeout;

gchar *custom_lib;
};

/**
Expand Down
51 changes: 49 additions & 2 deletions gst/edge/edge_src.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ enum
PROP_DEST_PORT,
PROP_CONNECT_TYPE,
PROP_TOPIC,
PROP_CUSTOM_LIB,

PROP_LAST
};
Expand All @@ -51,6 +52,7 @@ static void gst_edgesrc_get_property (GObject * object, guint prop_id,
static void gst_edgesrc_class_finalize (GObject * object);

static gboolean gst_edgesrc_start (GstBaseSrc * basesrc);
static gboolean gst_edgesrc_stop (GstBaseSrc * basesrc);
static GstFlowReturn gst_edgesrc_create (GstBaseSrc * basesrc, guint64 offset,
guint size, GstBuffer ** out_buf);

Expand Down Expand Up @@ -109,6 +111,10 @@ gst_edgesrc_class_init (GstEdgeSrcClass * klass)
"The main topic of the host and option if necessary. "
"(topic)/(optional topic for main topic).", "",
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_CUSTOM_LIB,
g_param_spec_string ("custom-lib", "Custom connection lib path",
"User defined custom connection lib path.",
"", G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&srctemplate));
Expand All @@ -118,6 +124,7 @@ gst_edgesrc_class_init (GstEdgeSrcClass * klass)
"Subscribe and push incoming streams", "Samsung Electronics Co., Ltd.");

gstbasesrc_class->start = gst_edgesrc_start;
gstbasesrc_class->stop = gst_edgesrc_stop;
gstbasesrc_class->create = gst_edgesrc_create;
gstelement_class->change_state = gst_edgesrc_change_state;

Expand All @@ -142,6 +149,7 @@ gst_edgesrc_init (GstEdgeSrc * self)
self->msg_queue = g_async_queue_new ();
self->connect_type = DEFAULT_CONNECT_TYPE;
self->playing = FALSE;
self->custom_lib = NULL;
}

/**
Expand Down Expand Up @@ -177,6 +185,10 @@ gst_edgesrc_set_property (GObject * object, guint prop_id, const GValue * value,
g_free (self->topic);
self->topic = g_value_dup_string (value);
break;
case PROP_CUSTOM_LIB:
g_free (self->custom_lib);
self->custom_lib = g_value_dup_string (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
Expand Down Expand Up @@ -211,6 +223,9 @@ gst_edgesrc_get_property (GObject * object, guint prop_id, GValue * value,
case PROP_TOPIC:
g_value_set_string (value, self->topic);
break;
case PROP_CUSTOM_LIB:
g_value_set_string (value, self->custom_lib);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
Expand All @@ -233,6 +248,9 @@ gst_edgesrc_class_finalize (GObject * object)
g_free (self->topic);
self->topic = NULL;

g_free (self->custom_lib);
self->custom_lib = NULL;

if (self->msg_queue) {
while ((data_h = g_async_queue_try_pop (self->msg_queue))) {
nns_edge_data_destroy (data_h);
Expand Down Expand Up @@ -290,6 +308,7 @@ _nns_edge_event_cb (nns_edge_event_h event_h, void *user_data)
int ret = NNS_EDGE_ERROR_NONE;

GstEdgeSrc *self = GST_EDGESRC (user_data);

if (0 != nns_edge_event_get_type (event_h, &event_type)) {
nns_loge ("Failed to get event type!");
return NNS_EDGE_ERROR_UNKNOWN;
Expand Down Expand Up @@ -327,9 +346,17 @@ gst_edgesrc_start (GstBaseSrc * basesrc)
int ret;
char *port = NULL;

ret =
nns_edge_create_handle (NULL, self->connect_type,
if (NNS_EDGE_CONNECT_TYPE_CUSTOM != self->connect_type) {
ret = nns_edge_create_handle (NULL, self->connect_type,
NNS_EDGE_NODE_TYPE_SUB, &self->edge_h);
} else {
if (!self->custom_lib) {
nns_loge ("Failed to create custom handle. custom-lib path is not set.");
return FALSE;
}
ret = nns_edge_custom_create_handle (NULL, self->custom_lib,
NNS_EDGE_NODE_TYPE_SUB, &self->edge_h);
}

if (NNS_EDGE_ERROR_NONE != ret) {
nns_loge ("Failed to get nnstreamer edge handle.");
Expand Down Expand Up @@ -369,6 +396,26 @@ gst_edgesrc_start (GstBaseSrc * basesrc)
return TRUE;
}

/**
* @brief Stop edgesrc, called when state changed ready to null
*/
static gboolean
gst_edgesrc_stop (GstBaseSrc * basesrc)
{
GstEdgeSrc *self = GST_EDGESRC (basesrc);
int ret;

self->playing = FALSE;
ret = nns_edge_stop (self->edge_h);

if (NNS_EDGE_ERROR_NONE != ret) {
nns_loge ("Failed to stop edgesrc. error code(%d)", ret);
return FALSE;
}

return TRUE;
}

/**
* @brief Create a buffer containing the subscribed data
*/
Expand Down
2 changes: 2 additions & 0 deletions gst/edge/edge_src.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ struct _GstEdgeSrc
GAsyncQueue *msg_queue;

gboolean playing;

gchar* custom_lib;
};

/**
Expand Down
4 changes: 2 additions & 2 deletions gst/nnstreamer/elements/gsttensor_transform.c
Original file line number Diff line number Diff line change
Expand Up @@ -1767,9 +1767,9 @@ gst_tensor_transform_padding (GstTensorTransform * filter,
guint i, j, k, left, top, front, loop_limit = 1;
element_size = gst_tensor_get_element_size (in_info->type);

in_loop_size = in_info->dimension[2] * in_info->dimension[1]
in_loop_size = (gsize) in_info->dimension[2] * in_info->dimension[1]
* in_info->dimension[0] * element_size;
out_loop_size = out_info->dimension[2] * out_info->dimension[1]
out_loop_size =(gsize) out_info->dimension[2] * out_info->dimension[1]
* out_info->dimension[0] * element_size;
copy_block_size = in_info->dimension[0] * element_size;

Expand Down
4 changes: 4 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,10 @@ features = {
'onnxruntime-support': {
'target': 'libonnxruntime',
'project_args': { 'ENABLE_ONNXRUNTIME': 1 }
},
'llama2c-support': {
'target': 'llama2c',
'project_args': { 'ENABLE_LLAMA2C': 1 }
}
}

Expand Down
1 change: 1 addition & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ option('datarepo-support', type: 'feature', value: 'auto', description: 'Data re
option('ml-agent-support', type: 'feature', value: 'auto')
option('onnxruntime-support', type: 'feature', value: 'auto')
option('dali-support', type: 'feature', value: 'auto')
option('llama2c-support', type: 'feature', value: 'auto')

# booleans & other options
option('enable-test', type: 'boolean', value: true)
Expand Down
3 changes: 2 additions & 1 deletion packaging/nnstreamer.spec
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
%define trix_engine_support 0
%define onnxruntime_support 0
%define nnstreamer_edge_support 0
%define ml_agent_support 0
%endif

# Disable a few features for movable device
Expand Down Expand Up @@ -988,7 +989,7 @@ export ORC_DEBUG=2
bash %{test_script} ./tests/nnstreamer_datarepo
%endif
%if 0%{?nnstreamer_edge_support}
bash %{test_script} ./tests/nnstreamer_edge
LD_LIBRARY_PATH=./tests/nnstreamer_edge bash %{test_script} ./tests/nnstreamer_edge
%endif
%if 0%{mvncsdk2_support}
LD_LIBRARY_PATH=${NNSTREAMER_BUILD_ROOT_PATH}/tests/nnstreamer_filter_mvncsdk2:. bash %{test_script} ./tests/nnstreamer_filter_mvncsdk2/unittest_filter_mvncsdk2
Expand Down
Loading
Loading