rtspsrc: Send RTSP keepalives in TCP/interleaved modes

When rtspsrc is using an interleaved connection to the camera,
it will continously receive a stream of tunnelled RTP packets
from the server, so the rtspconnection doesn't return ETIMEOUT
and trigger the keepalive. Add a check on the RTSP timer
and send the keepalive whenever we haven't sent a message to
the server in some time.

Fixes problems with some cameras that don't see the RTCP traffic
as sufficient proof of liveness, when using TCP/HTTP tunnelled
modes

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9577>
This commit is contained in:
Jan Schmidt 2025-08-18 23:58:32 +10:00 committed by GStreamer Marge Bot
parent 7205433549
commit 492a420fa9

View File

@ -6355,6 +6355,19 @@ gst_rtspsrc_loop_interleaved (GstRTSPSrc * src)
message.type);
break;
}
/* In interleaved mode, we expect to receive a continuous stream of data,
* but we still need to do keepalives, so even without an GST_RTSP_ETIMEOUT
* check the timeout timer */
gint64 timeout =
gst_rtsp_connection_next_timeout_usec (src->conninfo.connection);
if (timeout == 0) {
GST_DEBUG_OBJECT (src,
"Keepalive timeout expired. Sending keep-alive request");
if ((res = gst_rtspsrc_send_keep_alive (src)) == GST_RTSP_EINTR) {
goto interrupt;
}
}
}
g_assert_not_reached ();