How to dynamic push rtmp stream from a nvstreamdemux to rtmpsink

My pipeline is like below,
nvarguscamerasrc ! nvvideoconvert ! capsfilter ! nvstreammux ! nvinfer ! nvtracker ! nvdsosd ! tee name=t
t. ! fakesink
t. ! queue ! nvstreamdemux name=demuxer demuxer.src_0 ! queue ! nvh264enc ! h264parse ! flvmux ! rtmpsink
of course I have 5 camera src ,then use nvstreammux mux them together, when I want push a stream I’ll dynamic link rtmpsink branch . But occasionally it works, most of the time it doesn’t,I notice that when I success push the rtmp stream,the log is
Opening in BLOCKING MODE
Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 4
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4
H264: Profile = 66, Level = 0
NVMEDIA_ENC: bBlitMode is set to TRUE
If the RTMP stream is not successfully pushed, the log only
Opening in BLOCKING MODE
Opening in BLOCKING MODE.

Could someone help me?Very thanks!