Gstreamer pipeline stop when idle and back playing when connect

Hi,
In general we launch a RTSP server through test-launch. It is a simple sample based on https://gstreamer.freedesktop.org/documentation/gst-rtsp-server/rtsp-media-factory.html?gi-language=c

For launching a single pipeline you can run like:

nvarguscamerasrc! nvv4l2h264enc ! h264parse ! rtph264pay name=pay0 pt=96

We have reference steps in Jetson Nano FAQ

Your use-case is complicated. One possible solution is to register a signal to inform you that clients are connected so that you can launch the camera pipeline. Signals are listed in https://gstreamer.freedesktop.org/documentation/gst-rtsp-server/rtsp-media-factory.html?gi-language=c#signals