Deepstream does not work properly after encountering an error

• Hardware Platform :GPU
• DeepStream Version :5.1
• TensorRT Version:7.2
• language: python3.6
• camera IP: Hikvision

Hi.everyone
I am using deepstream to inference multi-rtsp-source in python.
When i input error password of rtsp and dynamic changge source ,got error(message.type) in the bus_call (callback function)

bus_call callback function

 def bus_call(bus, message, loop,queue):
    t = message.type
    if t == Gst.MessageType.EOS:
        sys.stdout.write("End-of-stream\n")
        loop.quit()
    elif t==Gst.MessageType.WARNING:
        err, debug = message.parse_warning()
        sys.stderr.write("Warning: %s: %s\n" % (err, debug))
    elif t == Gst.MessageType.ERROR:
        err, debug = message.parse_error()
        sys.stderr.write("Error: %s: %s\n" % (err, debug))
        print(message.src.name)
        print("\n","*"*20)
        print("info",message,type(message))
        print("error",err,type(err))
        print("debug",debug,type(debug))
        print("*"*20,"\n")
        queue.put(debug) # message queue
        if "Option not supported (551)" in debug :
            pass # dynamic change rtsp source
        elif "Unauthorized (401)" in debug:
            pass # error of rtsp
        else:
            print("[ WARNING ] Exiting app \n")   
            loop.quit()
        
    return True

problem 1. input error of rtsp

log

info <Gst.Message object at 0x7f100c114f48 (GstMessage at 0x7f0e7400a4a0)> <class ‘gi.repository.Gst.Message’>
error gst-resource-error-quark: Unauthorized (15) <class ‘GLib.GError’>
debug gstrtspsrc.c(6116): gst_rtspsrc_send (): /GstPipeline:pipeline0/GstURIDecodeBin:source-bin-00/GstRTSPSrc:source:
Unauthorized (401) <class ‘str’>

to resolve this problem

def add(uri,id): #uri is rtsp , id is source_$(id)
        source_bin = create_uridecode_bin(id,uri) # 
        source_bin_list[id]=source_bin
        pipeline.add(source_bin)
        state = source_bin_list[id].set_state(Gst.State.PLAYING)
        print(" [INFO] ",state)
        time.sleep(0.2)  # wait queue_mes of call_bus for 0.2 s
        if queue_mes.full() == True: # get error info from queue_mes
            error_msg = queue_mes.get().split("\n")[1]
            if error_msg == "Unauthorized (401)":
                source_bin_list[id].set_state(Gst.State.NULL) # set the state of source_bin from PLAYING to NULL
                pipeline.remove(source_bin_list[id]) # The sourece_bin encountered an error at runtime and dose not call the callback function (decodebin_child_added,cb_newpad),so remove the source_bin from pipeline directly
                source_bin_list[id] = None
                print("401 remove")

when i the add error of rtsp,then pipeline cannot add other source

problem 2. dynamic change source

when i delete rtsp source , gstreamer get an error , from other topic get resolution, annotation loop.quit()
but then pipeline cannot add other source

conclusion

The pipeline can not add the any rtsp source if pipeline encountered an error at running

Sorry for the late response, we will do the investigation and update soon.

OK , Thanks for your response

Have you tried deepstream_python_apps/apps/runtime_source_add_delete at master · NVIDIA-AI-IOT/deepstream_python_apps (github.com)?

I solved the problem, thank you