Draw different graphics with nvdsosd on two parallel streams

I would like to draw two different visualizations for the same source video stream with nvdsosd so I was thinking to use tee to fork my stream. My pipeline currently looks like this:

       GstFileSrc
           v
      GstH264Parse
           v
      nvv4l2decoder
           v
      GstNvStreamMux
           v
       GstNvInfer
           v
      GstNvTracker
           v
    Gstnvvideoconvert
           v
    +----GstTee-----+
    v               v
 GstQueue        GstQueue
    v               v
GstNvDsOsd      GstNvDsOsd 
    v               v
GstNvEglTran.  GstNvEglTran.
    v               v
GstEglGlesSink GstEglGlesSink

I added two different probe functions to the sink pad of the two GstNvDsOsd instances and I try to add different NvOSD rectangles and lines to the display_meta of the batches. Now the problem is that it seems nvds_acquire_display_meta_from_pool sometimes returns me the same display_meta in both branches of the pipeline, and if I “draw” something on it on one branch (i.e. set rectangle or line params), the same graphics will sometime appear or flicker also on the video of the other branch. Is there any way to get a display_meta dedicated to a single branch after splitting the pipeline with tee?

• Hardware Platform (Jetson / GPU): Jetson
• DeepStream Version: 5.0 DP

Hi
Sorry for a late reply.
May I know your Jetson connect with 2 monitors or just one? and how you check “the same graphics will sometime appear or flicker also on the video of the other branch”?

Hello, thanks for the reply. I use the Jetson only with one monitor, the windows of the two glessink positioned next to each other. Let’s say on one branch I set the first RectParams of the display buffer to a black rectangle covering the whole video. On the other stream I “draw” a red rectangle. So I expect to see nothing but a black video continuously on the first stream and a red screen on the second one. In this case I can clearly see that sometimes the red video stream flashes also on the “black” screen for a frame. I suspect there is some concurrency issue behind this, nvds_acquire_display_meta_from_pool sometimes returning the same display buffer for both streams.

You need to modify the pipeline - Gstnvvideoconvert should not be used before tee, use it just before OSD component.

Thank you, this indeed solved the issue. It solved also some casual PONGO warnings about invalid utf-8 string length - I guess this later one was related to some memory management issue accessing the same display buffer.