I am trying to develop a custom deepstream plugin, it can keep several video buffers inside it to do some async network communications. It works like gstreamer queue with min-threshold-buffers property set. I think Gst-nvinferserver also have similiar mechanism.
I have tested it on a gstreamer machine without deepstream SDK, it works well. But the similiar pipeline blocks when I turn to the deepstream platform.
Running this command below can observe the problem, it happens only if I put the queue after nvv4l2decoder plugin.
You may misunderstand Gst-nvinferserver, it does not bufer any extra GstBuffer inside it. It does not work in the way you think.
nvv4l2decoder is HW based video decoder, it has only a bufferpool of size 4. When you set queue min-threshold-buffers=10, the HW decoder does not have enough buffers to fill the queue. So the pipeline is blocked. You can limit the queue size to let the pipeline work.
Another way is to increase decoder buffers, but this will increase the system memory consumption too. You need to judge according to your requirement and the whole situation of your system.
gst-launch-1.0 filesrc location= gst-launch-1.0 filesrc location=/opt/nvidia/deepstream/deepstream-5.0/samples/streams/sample_720p.mp4 ! qtdemux name=demux demux.video_0 ! queue ! h264parse ! nvv4l2decoder num-extra-surfaces=7 ! queue min-threshold-buffers=10 ! nvegltransform ! nveglglessink
Thank you Ms. Chen, your answer saved my day. I tested the pipeline according to your suggestion and it works fine.
Actually we do have some Triton servers, and planning to use the plugin Gst-nvinferserver instead of homemade plugin later, I wish I can get more information about its mechanism.
The Gst-nvinferserver plugin passes the input batched buffers to the low-level library and waits for the results to be available. Meanwhile, it keeps queuing input buffers to the low-level library as they are received.
…How will it work? It seems nvinferserver still needs to keep (a reference of) each buffer until getting the result response from the server. In other words, it keeps a internal queue to store the to-be-remote-inferred buffers.
Or do it only works in serial, which means, it will accept a new buffer only if it pushes out one old buffer.
The buffer mentioned in the description is not GstBuffer but frame buffer. " the input batched buffers" is only one GstBuffer. gst-nvinferserver handles the input batch by batch but not frame by frame. This is Nvidia defined data structure, and this is the reason why nvstreammux is needed for DeepStream. Gst-nvstreammux — DeepStream DeepStream Version: 5.0 documentation (nvidia.com)