How to change the frequency of payload generation interval in deepstream 6.2?

NVIDIA-SMI 525.105.17
Driver Version: 525.105.17
CUDA Version: 12.0
deepstream-6.2

±----------------------------------------------------------------------------+
| NVIDIA-SMI 525.125.06 Driver Version: 525.125.06 CUDA Version: 12.0 |
|-------------------------------±---------------------±---------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA GeForce … Off | 00000000:01:00.0 On | N/A |
| 0% 48C P8 35W / 370W | 3825MiB / 12288MiB | 4% Default |
| | | N/A |
±------------------------------±---------------------±---------------------+
| 1 NVIDIA GeForce … Off | 00000000:02:00.0 Off | N/A |
| 0% 46C P8 20W / 370W | 8MiB / 12288MiB | 0% Default |
| | | N/A |

| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |

As the default setting, the payload is generated and sent every 30 frames. However I want to reduce the frequency such as every 200 frames or more.

How to implement this ?

What do you mean payload generation interval?

Which demo did you run?

I m working with deepstream test5

as the default setting, the payload is generated and sent every 30 frames.

i want to increase this frame number for which payload is sent frame.

bascially i want to increase this frame number -30

how can i achieve this ?

You can refer to the link below to set the frame-interval for Gst-nvmsgconv plugin in the config file: https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_plugin_gst-nvmsgconv.html#id2.

do you mean i need to add frame-interval key in deepstream config file?

image

Yes. You can try that.

I added frame-interval in config file.
I tried keeping frame interval =200 , 967 etc
But there in no drop in frequency of payload generation.

[sink6]
enable=1
#Type - 1=FakeSink 2=EglSink 3=File 4=UDPSink 5=nvoverlaysink 6=MsgConvBroker
type=6
msg-conv-config=dstest5_msgconv_sample_config.txt
#(0): PAYLOAD_DEEPSTREAM - Deepstream schema payload
#(1): PAYLOAD_DEEPSTREAM_MINIMAL - Deepstream schema payload minimal
#(256): PAYLOAD_RESERVED - Reserved type
#(257): PAYLOAD_CUSTOM - Custom schema payload
msg-conv-payload-type=1
msg2p-newapi=1
frame-interval=9670

msg-broker-proto-lib=/opt/nvidia/deepstream/deepstream-6.2/lib/libnvds_kafka_proto.so
#msg-broker-proto-lib=/opt/nvidia/deepstream/deepstream-6.2/lib/libnvds_msgconv.so
#Provide your msg-broker-conn-str here
msg-broker-conn-str=192.168.0.118;9092
topic=quickstart-events
#Optional:
#msg-broker-config=…/…/deepstream-test4/cfg_kafka.txt

The parameter for sink filed is msg-conv-msg2p-new-api and msg-conv-frame-interval.

i can control the frequency of payloads generated using this parameter
msg-conv-msg2p-new-api and msg-conv-frame-interval .

But i’m getting 10 times repetiton of same payloads message with same message id.

why this is happening repetition of message with same message id ?

Do you mean that all the information is the same? You can also debug that by yourself, the open source path is : opt\nvidia\deepstream\deepstream\sources\libs\nvmsgconv.

its like 1o message in sequence comes with same messsage id , and after 10 message , message id will changed , and then this changed message id will also get 10 times repeat

basically there is a pattern of repetition of same message id 10 times

Could you debug that on your end? The open source path is : opt\nvidia\deepstream\deepstream\sources\libs\nvmsgconv .
Or you can provide the detailed steps for reproducing the problems.

i did debug this code and found a bug , that below mention function is returning duplicate payloads
generate_dsmeta_message_minimal(ctx->privData, frame_meta);

i m able to resolve the problem , by adding a custom code logic in this function to avoid duplicates

OK. Glad to hear that. Could you attach the patch for your senario for others to reference? Thanks

else if (ctx->payloadType == NVDS_PAYLOAD_CUSTOM) {

gchar *message = generate_dsmeta_message_minimal(ctx->privData, frame_meta);

if (message) {
  // Parse the JSON message to extract the 'id' field
  JsonParser *parser = json_parser_new();
  GError *error = NULL;
  if (!json_parser_load_from_data(parser, message, -1, &error)) {
    g_error("Error parsing JSON: %s", error->message);
    g_error_free(error);
  } else {
    JsonObject *root = json_node_get_object(json_parser_get_root(parser));
    const gchar *id = json_object_get_string_member(root, "id");

    // Check if the id is different from the previous id
    if (lastCustomId == NULL || g_strcmp0(id, lastCustomId) != 0) {
      g_free(lastCustomMessage); // Free the previous message if exists

      // Store the new id and message to avoid duplicates
      lastCustomId = g_strdup(id);
      lastCustomMessage = g_strdup(message);

      len = strlen(message);
      // Remove '\0' character at the end of string and just copy the content.
      payload->payload = g_memdup(message, len);
      payload->payloadSize = len;
    }
  }

  g_object_unref(parser);
  g_free(message);
}

attaching the patch of code use to resolve issue

1 Like

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