The RTSP server was implemented as a transcoding server, and the clients connected to the server are periodically disconnected

Hello.

I’m currently developing a server to run GstRTSPServer as a transcoding server on uuntu 22.04.

Git The code developed so far can be found through the git address.

The role of the transcoding server receives one camera RTSP address.
예) rtsp://admin:pass@192.168.1.1:554

And make the rtsp a profile with four resolution sizes with media factory.
Original Size (first),
1280x960(second),
640x480(third),
320x240(fourth)

This is how you divide it and register it with the server GstRTSPMountPoints, and the client connects with the mount points that were created like this.
Example) The client connects at rtsp://{server IP}:8555/64/first.

[Problem]
The problem is that the client is attached to the server and is streaming, and after about three to four minutes, multiple clients are all disconnected at the same time, and this process happens repeatedly. The client automatically tries to reconnect and then disconnects after three to four minutes. Then, later, the server cannot connect itself.
I think there’s a time when the session automatically expires

gst_rtsp_session_prevent_expire(session);

I’ve also taken this step to no avail.

Is there a problem with the option setting part of the mounting point I set?

GstRTSPMountPoints* mounts = gst_rtsp_server_get_mount_points(Server);
        if (!mounts) {
            std::cerr << "Failed to get mount points." << std::endl;
            return false;
        }

        GstRTSPMediaFactory* firstFactory = gst_rtsp_media_factory_new();
        //latency=0 ! rtph264depay ! rtph264pay name=pay0 pt=96
        //latency=500 ! rtph264depay ! h264parse ! nvh264dec ! videoconvert ! queue ! x264enc ! rtph264pay config-interval=1 name=pay0 pt=96
        gst_rtsp_media_factory_set_launch(firstFactory, ("( rtspsrc location=" + uri + " latency=500 ! rtph264depay ! rtph264pay name=pay0 pt=96 )").c_str());
        gst_rtsp_media_factory_set_shared(firstFactory, TRUE);

        GstRTSPMediaFactory* secondFactory = gst_rtsp_media_factory_new();
        gst_rtsp_media_factory_set_launch(secondFactory, ("( rtspsrc location=" + uri + " latency=500 ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! queue ! videoscale ! videorate ! video/x-raw,framerate=15/1,width=1280,height=960 ! x264enc bitrate=2000 speed-preset=ultrafast tune=zerolatency cabac=true ! rtph264pay config-interval=1 name=pay0 pt=96 )").c_str());
        gst_rtsp_media_factory_set_shared(secondFactory, TRUE);

        GstRTSPMediaFactory* thirdFactory = gst_rtsp_media_factory_new();
        gst_rtsp_media_factory_set_launch(thirdFactory, ("( rtspsrc location=" + uri + " latency=500 ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! queue ! videoscale ! videorate ! video/x-raw,framerate=10/1,width=640,height=480 ! x264enc bitrate=800 speed-preset=ultrafast tune=zerolatency cabac=true ! rtph264pay config-interval=1 name=pay0 pt=96 )").c_str());
        gst_rtsp_media_factory_set_shared(thirdFactory, TRUE);

        GstRTSPMediaFactory* forthFactory = gst_rtsp_media_factory_new();
        gst_rtsp_media_factory_set_launch(forthFactory, ("( rtspsrc location=" + uri + " latency=500 ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! queue ! videoscale ! videorate ! video/x-raw,framerate=10/1,width=320,height=240 ! x264enc bitrate=400 speed-preset=ultrafast tune=zerolatency cabac=true ! rtph264pay config-interval=1 name=pay0 pt=96 )").c_str());
        gst_rtsp_media_factory_set_shared(forthFactory, TRUE);

        g_print("RTSP mount points : %s\n", firstMount.c_str());
        g_print("RTSP mount points : %s\n", secondMount.c_str());
        g_print("RTSP mount points : %s\n", thirdMount.c_str());
        g_print("RTSP mount points : %s\n", fourthMount.c_str());

        gst_rtsp_mount_points_add_factory(mounts, firstMount.c_str(), firstFactory);
        mediaFactories[firstMount] = firstFactory;
        gst_rtsp_mount_points_add_factory(mounts, secondMount.c_str(), secondFactory);
        mediaFactories[secondMount] = secondFactory;
        gst_rtsp_mount_points_add_factory(mounts, thirdMount.c_str(), thirdFactory);
        mediaFactories[thirdMount] = thirdFactory;
        gst_rtsp_mount_points_add_factory(mounts, fourthMount.c_str(), forthFactory);
        mediaFactories[fourthMount] = forthFactory;
        g_object_unref(mounts);

I sincerely ask for your help.

After reboot ubuntu, the issue was cleared.