Removing streams

• Hardware Platform GPU
• DeepStream Version 6.0
• TensorRT Version 8.2.4.2-1+cuda11.4
• NVIDIA GPU Driver Version 470.103.01
• Issue Type questions
• How to reproduce the issue: source code

I have a pipeline with the next elements:

rtspsrc, rtph264depay, h264parse, nvv4l2decoder, nvvideoconvert, capsfilter, queue, nvstreammux, nvvideoconvert, nvinfer, nvtracker, nvdsosd, nvvideoconvert, fakesink

Pipeline use dynamic batching for nvstreammux and adding new streams works as expected. But removing streams is sometimes stuck.

The deepstream_rt_src_add_del.py was used as an example, but in the example, there is only one dynamic element and I have 7.

  1. I take all elements one by one and run stop element.set_state(Gst.State.NULL), what is the correct order? Start from rtspsrc to queue or vice versa?

  2. sinkpad.send_event(Gst.Event.new_flush_stop(False)) - is it should be sent only once for nvstreammux (after all elements have set staate NULL)
    or for all elements?

def remove_stream(gst_pipeline, pad_index: int):
    elements = [
        gst_pipeline.get_by_name(f"{name_prefix}_{pad_index}")
        for name_prefix in
        ["rtspsrc", "depay", "parse", "decoder", "convert_nvstreammux", "capsfilter", "queue_nvstreammux"]
    ]

    for index, element in enumerate(elements):
        state_return = element.set_state(Gst.State.NULL)
        if state_return == Gst.StateChangeReturn.FAILURE:
            raise ValueError('State change failed')

    nvstreammux = gst_pipeline.get_by_name("nvstreammux")
    sinkpad = nvstreammux.get_static_pad(f"sink_{pad_index}")
    sinkpad.send_event(Gst.Event.new_flush_stop(False))
    nvstreammux.release_request_pad(sinkpad)

When I receive next error at the bus_call for the whole pipeline I try to remove only this particular stream from the pipeline (and continue processing other streams in that pipeline).

Removing stream from pipeline, RTSP error gst-resource-error-quark: Could not read from resource. (9), Debug: gstrtspsrc.c(5560): gst_rtspsrc_loop_interleaved (): /GstPipeline:pipeline12/GstRTSPSrc:rtspsrc_12:

But when remove_stream stream is invoked there are next lines in the gst logs, right after rtspsrc_element.set_state(Gst.State.NULL)

1:32:20.462727003     1 0x7f4aece01000 WARN                 rtspsrc gstrtspsrc.c:6057:gst_rtspsrc_loop:<rtspsrc_12> error: Internal data stream error.
1:32:20.462788224     1 0x7f4aece01000 WARN                 rtspsrc gstrtspsrc.c:6057:gst_rtspsrc_loop:<rtspsrc_12> error: streaming stopped, reason error (-5)
1:32:20.463629600     1 0x7f4aece01000 WARN                 rtspsrc gstrtspsrc.c:6323:gst_rtsp_src_receive_response:<rtspsrc_12> error: Could not receive message. (Parse error)
1:32:20.463672970     1 0x7f4aece01000 WARN                 rtspsrc gstrtspsrc.c:6421:gst_rtspsrc_try_send:<rtspsrc_12> error: Could not receive message. (Parse error)
1:32:20.463691212     1 0x7f4aece01000 WARN                 rtspsrc gstrtspsrc.c:8669:gst_rtspsrc_pause:<rtspsrc_12> error: Could not send message. (Parse error)
1:32:20.464013823     1 0x7f4aece01000 WARN                 rtspsrc gstrtspsrc.c:5560:gst_rtspsrc_loop_interleaved:<rtspsrc_12> error: Could not receive message. (Parse error)
1:32:20.464132124     1 0x7f4aece01000 WARN                 rtspsrc gstrtspsrc.c:6057:gst_rtspsrc_loop:<rtspsrc_12> error: Internal data stream error.
1:32:20.464187510     1 0x7f4aece01000 WARN                 rtspsrc gstrtspsrc.c:6057:gst_rtspsrc_loop:<rtspsrc_12> error: streaming stopped, reason error (-5)
  1. what dose “there is only one dynamic element and I have 7” means?
  2. why take all elements one by one and run stop? why not use pipeline.set_state(Gst.State.NULL)?
  3. if found any bug, please provide simplified code to reproduce the issue, including source file and configuration file.
  1. I mean in the deepstream_rt_src_add_del.py example, there is one gst element uridecodebin which is dynamically added/removed to the pipeline. In my case I have 7 elements that dynamically add/remove from pipeline for each stream.

  2. I have multiple streams (up to 32) in one pipeline and I want to continue processing all other streams and remove only one.

  3. The main problem, is that it is hard to reproduce. I have it only when some camera have some issue with the stream.

There is no update from you for a period, assuming this is not an issue anymore.
Hence we are closing this topic. If need further support, please open a new one.
Thanks

you can use a bin like uridecodebin to manage these 7 elements, then call bin.set_state(Gst.State.NULL).

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.