Using rtspsrc instead of uridecodebin in Deepstream python app

I am trying to use rtspsrc to set properties like latency and drop-on-latency instead of uridecodebin. But getting below error, adding code below, let me know if I miss any

ERROR: udpsrc0 : Internal data stream error
def _create_source_bin_(self, uri):
        bin_name = "source-bin"
        
        nbin = Gst.Bin.new(bin_name)

        source = Gst.ElementFactory.make("rtspsrc", "rtsp-source")
        source.set_property("location", uri)
        #source.set_property("drop-on-latency", 1)
        #source.set_property("latency", 100)
      	 
        depay_pre_decode = Gst.ElementFactory.make("rtph264depay", "h264-depay")
        parse = Gst.ElementFactory.make("h264parse", "parse")
        decoder = Gst.ElementFactory.make("nvv4l2decoder", "nvv4l2-decoder")
        
        Gst.Bin.add(nbin, source)
        Gst.Bin.add(nbin, depay_pre_decode)
        Gst.Bin.add(nbin, parse)
        Gst.Bin.add(nbin, decoder)

        source.link(depay_pre_decode)
        depay_pre_decode.link(parse)
        parse.link(decoder)
       
        bin_ghost_pad=decoder.get_static_pad("src")
            
        bin_pad=nbin.add_pad(Gst.GhostPad.new("src",bin_ghost_pad))
           
        pipe.add(nbin)

• Hardware Platform (Jetson / GPU): Xavier AGX
• DeepStream Version: 6.3
• JetPack Version (valid for Jetson only): 5.1
• Issue Type( questions, new requirements, bugs): question

This comment is helpful in setting the same property with uridecodebin dynamically while child being added but would like to have a straight forward approach of using the rtspsrc

Could you add the GST_DEBUG=3 in front of your command line and attach the whole log?

rtspsrc can not link to rtph264depay directly. for rtspsrc. pads that are only being created in some cases, it’s called sometimes pads.

Please refer this reply, it is a full example

Thanks will try this. Hope adding caps filter in between like you did might fix the issue