Does Synchronous Send really work in gstnvmsgbroker?

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) Jetson Nano 2gb
• DeepStream Version 5.01
• JetPack Version (valid for Jetson only) 4.5
• TensorRT VersionN/A
• NVIDIA GPU Driver Version (valid for GPU only) N/A
• Issue Type( questions, new requirements, bugs) Question/Bug
• 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) Deepstream-test4 app (both C and Python version). See how to recreate below
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)

I’ve build a MQTT version of the Gst-nvmsgbroker and so far implemented the NvDsMsgApiErrorType nvds_msgapi_send() function. At the moment, I’ve left NvDsMsgApiErrorType nvds_msgapi_send_async() as a dummy that just logs an error message:

NvDsMsgApiErrorType nvds_msgapi_send_async(NvDsMsgApiHandle h_ptr, char* topic, const uint8_t* payload, size_t nbuf, nvds_msgapi_send_cb_t send_callback, void* user_ptr) {
    nvds_log(NVDS_MQTT_LOG_CAT, LOG_DEBUG, "nvds_msgapi_send_async not implemented yet!");
    return NVDS_MSGAPI_ERR;

When running the Deepstream-test4 app, it connects correctly to my MQTT broker but then fails when it sends a message.

./deepstream-test4-app -i ../../../../samples/streams/sample_720p.h264 -p /opt/nvidia/deepstream/deepstream-5.0/lib/ --conn-str="<IP-ADDRESS>;<PORT>" -s 0 --no-display

The Deepstream-test4 app clearly sets the 'sync'property to FALSE

g_object_set (G_OBJECT(msgbroker), "proto-lib", proto_lib,
                "conn-str", conn_str, "sync", FALSE, NULL);

(or in Python version)

msgbroker.set_property('sync', False)

Investigating the log, I see that the actual call is to the async function and not to the sync function.

$ cat /tmp/nvds/ds.log
Mar 25 20:32:00 nvidia-jetson python3: DSLOG:NVDS_MQTT_PROTO: MQTT connection successful
Mar 25 20:32:11 nvidia-jetson python3: DSLOG:NVDS_MQTT_PROTO: nvds_msgapi_send_async not implemented yet!
Mar 25 20:35:29 nvidia-jetson deepstream-test4-app: DSLOG:NVDS_MQTT_PROTO: MQTT connection successful
Mar 25 20:36:22 nvidia-jetson deepstream-test4-app: DSLOG:NVDS_MQTT_PROTO: nvds_msgapi_send_async not implemented yet!

I tried to understand what is going on in gst-plugins/gstnvmsgbroker.c, but as I understand it, there is no implementation of setting the property 'sync' at all?! GstNvMsgBrokerhas a property self->asyncSendwhich is tested for in static GstFlowReturn legacy_gst_nvmsgbroker_render() when choosing which call should be made. self->asyncSend is initialised as TRUE and there seems to be no implementation that supports setting it to FALSE?

So I guess the question is, is this a bug, or is there a possibility to properly get the Gst-nvmsgbroker to do Synchronous sending?

For all gstreamer sink plugins, most of them are derived from gstbasesink GstBaseSink (, “sync” and “async” are implemented in gstbasesink. GstBaseSink (

"self->asyncSend" has nothing to do with “sync” property.

The reason of this log is because you are using nvmsgbroker legacy path which use “legacy_gst_nvmsgbroker_xxxx” APIs. In legacy path, “self->asyncSend” is TRUE by default. So you need to implement “nvds_msgapi_send_async” and “nvds_msgapi_do_work” in your library. And I notice that your nvds_msgapi_send_async() implementation returns NVDS_MSGAPI_ERR, that will cause the legacy_gst_nvmsgbroker_render fail and your broker will fail too.

The whole gstnvmsgbroker is open source /opt/nvidia/deepstream/deepstream/sources/gst-plugins/gst-nvmsgbroker, all information above is available in the code.

Thanks for the clarification on syncand gstbasesink.

I have looked at the code for both the new renderer and legacy renderer, and it looks like the calls will always be to the broker Async function since the self->asyncSend is hardcoded to TRUE.

The question still remains, is it possible to get gst-nvmsgbroker to do Sync calls, and if so how do I do that?
Or is it not supported by DeepStream out of the box, so I should go ahead and change and recompile gst-nvmsgbroker?

Apparently with legacy path, you need to hardcode self->asyncSend to FALSE and rebuild the broker plugin.

1 Like