I’m investigating the keep-alive functionality of the rtspsrc element in GStreamer. Specifically, I’m observing a discrepancy in behavior between UDP and TCP transport.
The rtspsrc element has a property do-rtsp-keep-alive
that’s intended to periodically send RTSP GET_PARAMETER requests to maintain the RTSP connection.
This functionality works correctly when receiving data over UDP. However, when receiving data over TCP, the keep-alive mechanism appears to fail.
Root Cause (as understood):
Upon examining the GStreamer code, I’ve noticed that gst_rtspsrc_send_keep_alive() is triggered only when rtspsrc hasn’t received any messages from the server within a specified timeout period.
UDP: This timeout condition is met because RTP data packets are transmitted over a separate connection, allowing the RTSP connection to remain idle.
TCP: In TCP mode, data is received continuously over the same connection, preventing the timeout condition from being met. Consequently, keep-alive requests are never sent.
Questions/Concerns:
-
I’d like to understand the reason for different behavior between TCP and UDP in the rtspsrc plugin.
-
Some RTSP servers (e.g., cameras) require keep-alive requests even when using TCP, or they will terminate the RTSP connection, so keep-alive is required for some cases.
-
While the get-parameters action signal can be used as a workaround, it’s not a viable solution for gst-launch based pipelines.
Would modifying the rtspsrc plugin to send keep-alive requests for TCP streams be an acceptable solution for the GStreamer community?
I noted that GStreamer 1.16 exhibited different behavior, sending keep-alive requests even for TCP streams. Why was this changed?