How to add new key for dsexample config?

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) Jetson Nano
• DeepStream Version 5.0.0
• JetPack Version (valid for Jetson only) 4.4.1
• TensorRT Version 7.1.3
• NVIDIA GPU Driver Version (valid for GPU only) -
• Issue Type( questions, new requirements, bugs) Questions
• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing) -
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description) -

Hi, my objective is to add a new key to dsexample config in deepstream-app reference app.

[ds-example]
enable=1
processing-width=720
processing-height=480
full-frame=1
#batch-size for batch supported optimized plugin
batch-size=1
unique-id=15
gpu-id=0
**my-own-key=my-own-string**

At first, I tried adding new property in struct _GstDsExample in gst-plugins/gst-dsexample/gstdsexample.h, as well as its corresponding PROP_xxx enum, g_object_class_install_property, gst_dsexample_set_property, gst_dsexample_get_property in gst-plugins/gst-dsexample/gstdsexample.cpp

However, it did not work.

I soon realised that I also need to modify files deepstream_config_file_parser.c and deepstream_dsexample.c in apps/apps-common/src, file deepstream_dsexample.h in apps/apps-common/includes

After all that, I managed to make some progress in gst_dsexample_set_property, the following works

    case PROP_xxx:
      dsexample->xxx = g_value_get_string (value);
      std::cout << dsexample->xxx << std::endl;
      break;

However, in gst_dsexample_start the property is gone.

static gboolean
gst_dsexample_start (GstBaseTransform * btrans)
{
  GstDsExample *dsexample = GST_DSEXAMPLE (btrans);  // suspect casting was wrong?
  std::cout << dsexample->xxx << std::endl;  // hits the following error
  ...

Error log:

** ERROR: <main:655>: Failed to set pipeline to PAUSED
Quitting
ERROR from common_msg_conv: Could not initialize supporting library.
Debug info: /dvs/git/dirty/git-master_linux/deepstream/sdk/src/gst-plugins/gst-nvmsgconv/gstnvmsgconv.c(381): gst_nvmsgconv_start (): /GstPipeline:pipeline/GstNvMsgConv:common_msg_conv:
unable to open converter library
App run failed

It seems overly complicated just to add a new key in config. Can you please share a complete pointer on how to do so?

Many thanks!

@amycao @Fiona.Chen

The error log has nothing to do with the property you added. Can you just try your case without broker?

Hi. I did not knowingly turn on the broker. In fact, if I comment out

[ds-example]
enable=1
processing-width=720
processing-height=480
full-frame=1
#batch-size for batch supported optimized plugin
batch-size=1
unique-id=15
gpu-id=0
**#my-own-key=my-own-string**

the newly added key in config, the error goes away and deepstream-app runs successfully.

Just a pure guess, could it be memory of dsexample leak into msgconv somehow?

If you could provide a simple guide on where to change in order to add a new key , I’ll be happy to follow your steps exactly.

Regarding msgconv or msgbroker, I did not use type 6 sink. I only used fakesink and filesink, both hit the same error.

[sink0]
enable=1
#Type - 1=FakeSink 2=EglSink 3=File
type=1
sync=1
source-id=0
gpu-id=0

[sink1]
enable=0
type=3
container=1
codec=1
sync=1
qos=0
bitrate=2000000
output-file=output.mp4
source-id=0

I think a simple guide to add key in dsexample config will be sufficient, I’m sure it will benefit the community as well.

Many thanks. @Fiona.Chen

Perhaps you enabled the [message-converter] group in your config file and the config is wrong.

It will benefit to learn the basic knowledge and coding skills of gstreamer and glib before you start with deepstream. It is just the common usage of gstreamer element property and the glib key value file parser interfaces. Key-value file parser: GLib Reference Manual, nothing special to be written as a guide.

Yes, I have double checked my config file, there is also no [message-converter] group.

################################################################################
# Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
################################################################################

[application]
enable-perf-measurement=1
perf-measurement-interval-sec=1
gie-kitti-output-dir=#

[tiled-display]
enable=1
rows=2
columns=2
width=1280
height=720
gpu-id=0
nvbuf-memory-type=0

[source0]
enable=1
#Type - 1=CameraV4L2 2=URI 3=MultiURI
type=2
# num-sources=1
uri=file://test2.mp4
num-sources=1
gpu-id=0
cudadec-memtype=0

[source1]
enable=1
type=2
uri=file://testvid.mp4
num-sources=1
gpu-id=0
cudadec-memtype=0

[source2]
enable=1
type=2
uri=file://test.mp4
num-sources=1
gpu-id=0
cudadec-memtype=0

[source3]
enable=1
type=2
uri=file://testing.mp4
num-sources=1
gpu-id=0
cudadec-memtype=0

[streammux]
gpu-id=0
live-source=0
batch-size=4
batched-push-timeout=300000
## Set muxer output width and height
width=1920
height=1080
nvbuf-memory-type=0

[sink0]
enable=1
#Type - 1=FakeSink 2=EglSink 3=File
type=1
sync=1
source-id=0
gpu-id=0

[sink1]
enable=0
type=3
container=1
codec=1
sync=1
qos=0
bitrate=2000000
output-file=output.mp4
source-id=0

[osd]
enable=1
gpu-id=0
border-width=3
text-size=15
text-color=1;1;1;1;
text-bg-color=0.3;0.3;0.3;1
font=Serif
show-clock=0
clock-x-offset=800
clock-y-offset=820
clock-text-size=12
clock-color=1;0;0;0
nvbuf-memory-type=0
display-bbox=0
display-mask=1

[primary-gie]
enable=1
gpu-id=0
batch-size=1
gie-unique-id=1
interval=0
#labelfile-path=ssd_coco_labels.txt
model-engine-file=dmcount_fp16.engine
config-file=infer_primary_config.txt
nvbuf-memory-type=0

[ds-example]
enable=1
processing-width=720
processing-height=480
full-frame=1
#batch-size for batch supported optimized plugin
batch-size=1
unique-id=15
gpu-id=0
xxx=abc123

Please let me know how can I proceed? @Fiona.Chen

Please find out the reason of why the nvmsgconv is invoked. Until now, no clue show the property setting has any problem.

Root cause of nvmsgconv was invoked was memory smashing. The Makefile in deepstream-app does not detect changes in dsexample library and thus does not build properly, causing memory leak from dsexample into nvmsgconv.
This has been solved. Thank you for your help.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.