dynamic stream addition/removal with rtmp

Hi,
we met a problem in out application with dynamic stream addition/removal, here is our pipiline structure:

{…,live_stream_i,…}—>nvstreammux—>pgie–>nvtracker–>nvstreamdemux–> {…,output_stream_i,…}–> etc_i

different from the exmaple deepstream_reference_apps/runtime_source_add_delete at master · NVIDIA-AI-IOT/deepstream_reference_apps · GitHub, besides uridecodebin, there are also dynamic del/add of GSTelements after nvstreamdemux of pipeline in each stream. our problem is:
removal of stream was ok, but after addition of stream, the stream just played for a while(several seconds), then stoped. once removal of a running stream and addition of next stream (played for a while then stoped ), the stoped stream recovered. and the problem only occured in rtmp live source, while rtsp is ok.
could you give me some advices? thanks!

duplicate of https://devtalk.nvidia.com/default/topic/1068860/