Dynamic recoding by

I want to do dynamic recording but leave the display and udp streams running. This is my pipeline

        "v4l2src device=%1 ! "
        "image/jpeg,width=1920,height=1080,framerate=30/1 ! "
        "jpegdec ! "
        "videoconvert ! "
        "queue max-size-buffers=0 max-size-bytes=0 max-size-time=1000000000 ! "
        "gdkpixbufoverlay name=logo ! "
        "clockoverlay name=DT "
        "halignment=left valignment=top font-desc=\"Sans, 12\" time-format=\"%d %b %Y %H:%M:%S\" ! "
        "textoverlay name=O1 halignment=left valignment=top ! "
        
        "tee name=t "

        "t. ! queue ! glimagesink name=sink sync=false "

        "t. ! queue leaky=1 ! x264enc tune=zerolatency ! "
        "rtph264pay ! "
        "udpsink host=224.1.1.1 auto-multicast=true port=%2 "

        "t. !  queue ! "
        "x264enc speed-preset=ultrafast tune=zerolatency byte-stream=true bitrate=%3 key-int-max=%4 ! "
        "mux. pulsesrc device=%5 ! "      // device = 0
        "queue ! audioconvert ! "
        "audioresample ! audio/x-raw, rate=48000 ! "
        "queue ! avenc_aac ! "
        "queue ! mux. qtmux name=mux ! "
        "filesink location=%6").toString ()

Should I link and unlink the elements of the recording pipeline or disconnect the pads on the video and audio queues.
I tried a valve after the queure but opening it stalled the whole pipeline. What is different valve vs unlinking pads