Gating Metadata Flow

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU)
GPU
• DeepStream Version
6.0.1
• TensorRT Version
8.0.1.6
• NVIDIA GPU Driver Version (valid for GPU only)
470.86
• Issue Type( questions, new requirements, bugs)
Question
• 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)

This may be as much a GStreamer question as a DeepStream question, but I’m wondering how people typically tackle what I’m assuming is a fairly common scenario:

Let’s say you have a tee that’s split the pipe towards their own respective sinks; however, let’s further assume that we want one branch to continue on as normal to its sink, and the other one (just after being split) to gate in a stateful way the flow of metadata to its own sink. Each sink is actually the same plugin, e.g. nvmsgconv.

The gating may let all, none, or parts of a batch through.

I obviously can’t just arbitrarily conduct operations on the metadata from one branch as the DeepStream metadata being passed through is all through pointers (i.e. one branch could affect the other). Is the best way to handle this to:

  1. Copy the metadata/batch, perform operations on the copy (like removing or replacing), and output that data into the output of a gating plugin? (I’m leaning towards this, but I’m not exactly sure how to do this as of yet and will likely need to do a good bit more digging to do it.)

  2. Insert additional metadata and create a customized version of nvmsgconv for the one sink?

  3. A different way…?

Thanks in advance.

I’ve decided to write a GStreamer plugin that doesn’t act as a passthrough or that uses “in_place”, i.e. I just have a “transform” method set.

In my transform method, if I simply point the “outbuf” at “inbuf”, the plugin works (but of course this is just a fancy passthrough).

If, however, I grab the batch meta from inbuf, and try to “copy” it to outbuf, I get a segfault, or a message saying the number of elements in the pool don’t match those in the queue, or an invalid chunk size, or whatever, but in either case, it crashes.

I first grab the batch meta:

batch_meta = gst_buffer_get_nvds_batch_meta (inbuf);

and then add it to the outbuf:

gst_buffer_add_nvds_meta(outbuf, batch_meta, NULL, batch_meta->base_meta.copy_func, batch_meta->base_meta.release_func);

Is my assumption that the “copy_func” and “release_func” can be used as-is (hoping that it does a deep copy)? Or do I have to write my own?

If it matters, this is being done after using streammux (the sink for this pipe won’t need de-muxxing).

And, short of reconfiguring the DS-6.0.1-devel Docker container to properly save core dumps, is there something obvious that I’m doing wrong?

Thanks as always.

If you use “tee”, the refcount of the gstbuffer will be 2, can you have a try gst_buffer_make_writable() to get one now gstbuffer header?

I’m not sure I understand…how will that help? If the plugin I’m making is a “normal” one (see GstBaseTransform) and has a “transform” (not “transform_ip”) method, it would seem to me that I’m getting an input buffer and a separate output buffer. And, based on the details I’ve mentioned above, I’m not modifying the input buffer at all; rather, I’m attempting to copy the input buffer to the (separate) output buffer.so I can modify the copy (i.e. the output buffer).

To be clear, the “copy” is meant to be a legitimate, wholesale copy and not just the same pointer(s).

So, is the “copy” works in your case?

I don’t understand what you’re asking.

I’m trying to make a copy of what’s in the input buffer and put that copy into the output buffer. I am currently unable to do that for the reasons listed above.

Is this still an issue to support? Any result can be shared? Thanks

Yes it is. And no, no results. I can’t make this work and anything I do feels like a shot in the dark. I can’t find any examples of what I’m trying to do (the one example for simple user metadata provided isn’t sufficient), and the API is a black box w minimal documentation. Even at the highest logging levels, I can’t find out much. Any help would be greatly appreciated. Thanks.

Can below help to copy meta data from src to dest buffer?

gst_buffer_copy_into (out_buf, src_buf, GST_BUFFER_COPY_META, 0, -1)

There is no update from you for a period, assuming this is not an issue any more.
Hence we are closing this topic. If need further support, please open a new one.
Thanks

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