Error: gst-stream-error-quark: Internal data stream error

• Hardware Platform (Jetson / GPU) Jetson Orin Nano
• DeepStream Version 7.1
• JetPack Version (valid for Jetson only) 6.1
**• How to reproduce the issue ? I am working on Runtime addition and deletion of sources, i will be running multiple features within 1 nvurisrcbin so when i am adding source its running fine, when i am removing, it is removed properly, and when i am re-adding any new source bin its is giving this error
1st: add_source_bin(camera_id=22, features=[“xyz”])
2nd: remove_source(camera_id=22)
3rd: add_source_bin(camera_id=22, features=[“PEOPLE_COUNT”])

Results in error:

Error: Internal data stream error**

0:06:25.173320410 138316 0xfffdf10f64b0 WARN nvinfer gstnvinfer.cpp:2423:gst_nvinfer_output_loop: error: Internal data stream error. 0:06:25.173388059 138316 0xfffdf10f64b0 WARN nvinfer gstnvinfer.cpp:2423:gst_nvinfer_output_loop: error: streaming stopped, reason error (-5) Error: gst-stream-error-quark: Internal data stream error. (1): /dvs/git/dirty/git-master_linux/deepstream/sdk/src/gst-plugins/gst-nvinfer/gstnvinfer.cpp(2423): gst_nvinfer_output_loop (): /GstPipeline:deepstream-pipeline/GstNvInfer:nvinfer: streaming stopped, reason error (-5)

Source Management architecture:
├── Source Management
│ ├── add_source_bin()
│ │ ├── create_uridecode_bin()
│ │ │ └── nvurisrcbin → decodebin → nvv4l2decoder
│ │ │
│ │ ├── Caps Negotiation Process
│ │ │ ├── Initial direct link attempt
│ │ │ │ └── pad.link(sink_pad)
│ │ │ │
│ │ │ ├── If link fails, insert nvvideoconvert
│ │ │ │ ├── Create converter
│ │ │ │ │ └── nvvideoconvert element
│ │ │ │ │
│ │ │ │ ├── Link sequence
│ │ │ │ │ ├── pad → converter
│ │ │ │ │ └── converter → tee
│ │ │
│ │ └── _create_branch_from_tee()
│ │ └── tee → queue → streammux
│ │
│ Feature Removal Flow:
├── |— remove_feature(camera_id, feature_type)
│ | ├── Check if last feature
│ | │ └── If yes → remove_source()
│ | │ └── If no → continue with feature removal
│ | │
│ | ├── Pause source bin
│ | ├── Disconnect Pipeline Elements
│ | │ ├── Queue removal
│ | │ ├── Pad unlinking
│ | │ └── Dynamic pad release
│ | │
│ | └── Cleanup metadata
|
| Source Removal Flow:
| ├── remove_source(camera_id)
| │ ├── Remove source bin
| │ ├── Remove all feature queues
| │ ├── Remove tee element
| │ └── Clean metadata

Seems you are trying to implement dynamic source add/remove functions, right?

Please refer to /opt/nvidia/deepstream/deepstream/sources/apps/sample_apps/deepstream-test5 sample.

Yes, i am trying for dynamic add/remove function in python

  1. can you please guide me in detail which function should i refer for dynamic source add/delete in deepstream_test5
  2. I am facing the issue related to nvinfer while readding the source i have some questions
    1. Do i need to manage state while nvinfer is empty meaning no data flow
    2. I am enforcing nvmm RGBA caps in post processing branch of nvinfer and nvurisrcbin

The dynamic source add/remove has been implemented inside nvmultiurisrcbin. The /opt/nvidia/deepstream/deepstream/sources/apps/sample_apps/deepstream-test5 is the sample for how to use nvmultiurisrcbin in pipeline.

You can refer to Nvmultiurisrcbin plugin, the sink screen doesn't update but it seems that the internal screen of the app is updating and finally the app crashes - #10 by Fiona.Chen

Can you explain what this means?

in cb_newpad we use to get the caps like this

#Check for caps
caps=pad.get_current_caps()
gststruct=caps.get_structure(0)
gstname=gststruct.get_name()

# Need to check if the pad created by the decodebin is for video and not
# audio.
print("gstname=",gstname)
if(gstname.find("video")!=-1):

but in my case i was unable to get the caps so i added
template_caps = pad.get_pad_template().get_caps()
print(f"DEBUG: Template caps: {template_caps.to_string()}")

    decoder_caps = None
    # Try to get current caps
    for i in range(10):
        current_caps = pad.get_current_caps()
        if current_caps:
            decoder_caps = current_caps
            break
            
        # If no current caps, try setting our desired caps - FORCE RGBA
        desired_caps = Gst.Caps.from_string(
            "video/x-raw(memory:NVMM), format=(string)RGBA"
        )
        
        if pad.set_caps(desired_caps):
            print("DEBUG: Successfully set RGBA caps")
            decoder_caps = desired_caps
            break
            
        print(f"DEBUG: Waiting for decoder caps, attempt {i+1}/10")
        time.sleep(0.2)
    
    if not decoder_caps:
        print("WARNING: No decoder caps available, using fixed caps")

and in post processing branch after nvinfer i add the capsfilter as below

        capsfilter = Gst.ElementFactory.make("capsfilter", f"caps_{name_suffix}")
        # Replace the existing caps line with:
        caps = Gst.Caps.from_string(
            "video/x-raw(memory:NVMM), format=(string)RGBA"
        )
        capsfilter.set_property("caps", caps)

The caps should be negotiated but not been set in this way. Caps negotiation

Can you try the Nvmultiurisrcbin plugin, the sink screen doesn't update but it seems that the internal screen of the app is updating and finally the app crashes - #10 by Fiona.Chen?

Earlier i tried with nvmultiurisrcbin but there was not that much control i am solving an problem where some feature are running on core python and associate libraries like mediapipe, etc..

  1. Is this problem related to caps negotiation???
  2. as reason error is -5 it means some fatal error but exactly i am not getting the issue

her is my current architecture:
nvurisrcbin(1..N) - tee(1 per bin) - queue(per tee pad) - streammux(for 3 unique features) - infer(for 3 unique feature) - nvvideoconvert(per infer) - capsfilter(per infer) - fakesink(per infer)

You may need to debug to find out the root cause.

Please debug to find out the root cause. Currently we can’t tell anything just from your description.