What's difference between pad_prob functions and custom gstreamer plugin

Hi,
Suppose I want to modify the meta data and doing somethings on buffer or metadata.
Q1- Is it possible to modify the metadata inside the prob functions?

Q2- As you know, we can access to buffer/metadata inside prob functions or custom plugin, and prob functions hold the buffer until return PadProb.OK like somethings, so we can’t to do complex processing inside the prob functions,The pipeline is locked. I want to know, this restriction also true for custom plugins?

Q1- Is it possible to modify the metadata inside the prob functions?

–> yes, you can refer to test1 sample function osd_sink_pad_buffer_probe
for how to access and update.

Q2- As you know, we can access to buffer/metadata inside prob functions or custom plugin, and prob functions hold the buffer until return PadProb.OK like somethings, so we can’t to do complex processing inside the prob functions,The pipeline is locked. I want to know, this restriction also true for custom plugins?

–> It is not advisable to have compute intensive functions to be implemented in the probe as it is a blocking call. Instead write a separate gstreamer plugin. Refer to sample dsexample plugin.

@amycao, Thanks,
I tested peoplenet with both deepstream-app -c … and deepstream-imagedata-multistream methods, I got 130 and 75 FPS with first and second methods ‌respectively, I want to know this difference performance due to python codes or prob_function in the second way? I uncomment the saving and converting buffer to numpy array parts in the second method.
Because in the python codes all of codes are in c/c++ , I don’t know, why is there such a difference in speed?

It’s not due to python, you can try to add queue after streammux between each two elements in the second sample you tested and try again, and you can refer to test3 sample.

@amycao, Thanks
The queue element cause the left/right side to be async(unblock), right? What’s the disadvantage of queue? when can to add queue element between each elements in pipeline, and this cause likely speed up the performance, but i want to know what’s the restriction of queue element?

Add queues to allow input and output processing to be done in separate threads rather than sequentially. you can refer to official GStreamer documentation to check how queues work.
I don’t think there’s any disadvantage as such to using queues, basically it’s useful for multithreading

1 Like