source id

hi
I have multiple stream sources and I want to get the source id for further use.
Is it possible to get source id in the “static GstFlowReturn get_converted_mat” function?

You can get NvDsFrameMeta-> source_id in dsexample plugin

I get source_id as null

frame_meta->source_id

It’s better you can read the code and add log to debug:
https://devtalk.nvidia.com/default/topic/1061492/deepstream-sdk/deepstream-sdk-faq/ -> 6. How to get source_id

frame_meta = (NvDsFrameMeta *) (l_frame->data);
      guint source_id_info = frame_meta->source_id;

When I try to print source_id_info , it says “(null)”.

where do you defined l_frame->data ? if it possible share this part of your source code.

Hi,

I am also trying the same but instead of getting null I’m getting ‘0’, I’m using the sample-app\deepstream-app … any ideas what it could be ? Happy to paste code if needed.

Thanks

I’m adding my voice to this issue. This seems to be a recent bug. The source_id comes up at “0” for all streams regardless of what’s being processed. I’ve even tried manually setting all of the streams to have a non-zero ID. Example:

[source113]
enable=1
type=3
uri=rtsp://10.0.0.164/stream1
num-sources=1
drop-frame-interval=2
gpu-id=0
cudadec-memtype=0

[sink113]
enable=1
type=2
sync=1
source-id=113
gpu-id=0
nvbuf-memory-type=0

[source108]
enable=1
type=3
uri=rtsp://10.0.0.164/stream2
num-sources=1
drop-frame-interval=2
gpu-id=0
cudadec-memtype=0

[sink108]
enable=1
type=2
sync=1
source-id=108
gpu-id=0
nvbuf-memory-type=0

and regardless of the settings only “0” ever comes back for source_id.

Another thing to add, in the frame_meta object “frame_num” is also 0 all the time. In fact, just about everything is 0 except for “num_surfaces_per_frame”, which is just 1.

I’m currently in the middle of testing, but I believe this was all working just fine with Deepstream 4.0. I have a feeling that there was a change in Deepstream 4.0.2 (or possibly 4.0.1, I jumped over that release) that is now causing these objects to be incorrect.

A quick update on this issue. My issue was that the source/sink ID was not being added in order (ie. 0,1,2,etc) and instead I was adding each source ID based on the database camera ID (in my case IDs 113 and 108 were being used in the example). Without setting the source IDs in sequence the config parser doesn’t seem to match up the source IDs properly. I would need to look more deeply to see the specifics, but ultimately the issue was solved on my end by simply added each stream in sequence starting from 0.