'NoneType' object has no attribute 'get_structure'

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) RTX4080
• DeepStream Version nvcr.io/nvidia/deepstream:7.0-triton-multiarch
I am streaming from cctv with rtsp url.

This is decodebin setup.

    if file_loop:
        # use nvurisrcbin to enable file-loop
        uri_decode_bin=Gst.ElementFactory.make("nvurisrcbin", "uri-decode-bin")
        uri_decode_bin.set_property("file-loop", 1)
        uri_decode_bin.set_property("cudadec-memtype", 0)
        uri_decode_bin.set_property("rtsp-reconnect-interval", 5) 
        uri_decode_bin.set_property("rtsp-reconnect-attempts", -1)
    else:
        uri_decode_bin=Gst.ElementFactory.make("uridecodebin", "uri-decode-bin")
        
    if not uri_decode_bin:
        sys.stderr.write(" Unable to create uri decode bin \n")

Streaming with uridecodebin has no issue.
But when I change to nvurisrcbin for reconnect-attempts and reconnect-interval configurations, reconnection is happening. But I have error as

File "/workspace/opt/nvidia/deepstream/deepstream/sources/deepstream_python_apps/apps/deepstream-imagedata-multistream/deepstream_imagedata-multistream.py", line 500, in cb_newpad
Decodebin child added: parser
    gststruct = caps.get_structure(0)
AttributeError: 'NoneType' object has no attribute 'get_structure'
Decodebin child added: src_cap_filter_nvvidconv

The error is coming from the following function.

def cb_newpad(decodebin, decoder_src_pad, data):
    caps = decoder_src_pad.get_current_caps()
    gststruct = caps.get_structure(0)
    gstname = gststruct.get_name()
    source_bin = data
    features = caps.get_features(0)

    # Need to check if the pad created by the decodebin is for video and not
    # audio.
    if (gstname.find("video") != -1):
        # Link the decodebin pad only if decodebin has picked nvidia
        # decoder plugin nvdec_*. We do this by checking if the pad caps contain
        # NVMM memory features.
        if features.contains("memory:NVMM"):
            # Get the source bin ghost pad
            bin_ghost_pad = source_bin.get_static_pad("src")
            if not bin_ghost_pad.set_target(decoder_src_pad):
                sys.stderr.write("Failed to link decoder src pad to source bin ghost pad\n")
        else:
            sys.stderr.write(" Error: Decodebin did not pick nvidia decoder plugin.\n")

Do you mean that the source bin can’t get caps when reconnection is happening?

No since at the begining of the app, when nvurisrcbin is used. The whole error is

Traceback (most recent call last):
  File "/workspace/opt/nvidia/deepstream/deepstream/sources/deepstream_python_apps/apps/deepstream-imagedata-multistream/deepstream_imagedata-multistream.py", line 503, in cb_newpad
    gststruct = caps.get_structure(0)
AttributeError: 'NoneType' object has no attribute 'get_structure'
Decodebin child added: h265parse0 

Decodebin child added: capsfilter0 

Decodebin child added: nvv4l2decoder0 

Error: gst-stream-error-quark: Internal data stream error. (1): ../libs/gst/base/gstbasesrc.c(3127): gst_base_src_loop (): /GstPipeline:pipeline0/GstBin:source-bin-00/GstDsNvUriSrcBin:uri-decode-bin/GstRTSPSrc:src/GstUDPSrc:udpsrc0:
streaming stopped, reason not-linked (-1)
Camera id 0 is terminated
Exiting app

[NvMultiObjectTracker] De-initialized

I have two applications one is deepstream app streaming 35 cctvs. Another one is another python app streaming from nvr for 18 cctvs. When two apps are running concurrently, deepstream app has this error easily.

Error: gst-stream-error-quark: Internal data stream error. (1): ../libs/gst/base/gstbasesrc.c(3127): gst_base_src_loop (): /GstPipeline:pipeline0/GstBin:source-bin-00/GstDsNvUriSrcBin:uri-decode-bin/GstRTSPSrc:src/GstUDPSrc:udpsrc0:
streaming stopped, reason not-linked (-1)

So the app stops after the error. So I like to implement nvurisrcbin. Even the streaming has error, it will reconnect.
Using uridecodebin, streaming is fine. But when two apps are running concurrently, deepstream app easily has this issue.

Warning: gst-resource-error-quark: Could not read from resource. (9): ../gst/rtsp/gstrtspsrc.c(5832): gst_rtspsrc_loop_udp (): /GstPipeline:pipeline0/GstBin:source-bin-19/GstURIDecodeBin:uri-decode-bin/GstRTSPSrc:source:
Unhandled return value -7.
Error: gst-resource-error-quark: Could not read from resource. (9): ../gst/rtsp/gstrtspsrc.c(5900): gst_rtspsrc_loop_udp (): /GstPipeline:pipeline0/GstBin:source-bin-19/GstURIDecodeBin:uri-decode-bin/GstRTSPSrc:source:

Are these “35 cctvs” and “18 cctvs” all RTSP streams? What are the video format, FPS and resolution?

Yes all RTPSs. H265. 1920x1080.

This is UDP loss, right. My another python app also have issue in streaming. But I managed to stop connection and reconnect. So the app doesn’t fail.
Does deepstream suport streaming over tcp? To avoid udp loss

My one more question is how to configure in deepstream for multicast rtsp streaming from nvr? People recommend to use multicast streaming.
Thanks

Yes. As a RTSP client, the rtspsrc supports TCP protocol. rtspsrc

The rtspsrc is just a RTSP client. Please refer to rtspsrc

thank u