[vlc-devel] [PATCH] rtp: use a consistent timeout with httpd

Andriy Gelman andriy.gelman at gmail.com
Sat Nov 21 18:59:12 CET 2020


From: Andriy Gelman <andriy.gelman at gmail.com>

The parameter rtsp-timeout is advertised to rtsp clients. Clients use
this information to send a keep-alive message so that the connection is
not closed.

Currently, rtsp-timeout is set to 60 seconds but the underlying httpd
timeout is hardcoded to 10 seconds in httpd_ClientInit(). So the tcp
connection ends up being reset before the client sends its keep-alive
message (if the client properly uses the rtsp-timeout setting).

This can be tested with ffmpeg:

$ ./vlc -vvv v4l2:///dev/video0 ":sout=#transcode{vcodec=h264,vb=300}:rtp{sdp=rtsp://:8554/test.sdp}"
$ ./ffplay -loglevel trace  -i rtsp://127.0.0.1:8554/test.sdp

After ~30 seconds of streaming, ffplay will start to show errors (the
async keep-alive message is sent after 60/2 seconds from ffmpeg), and the
connection will be closed after ~60 seconds (due to the timer in rtsp
server).

This problem can be solved by using a consistent timeout between httpd
and rtsp server.

Signed-off-by: Andriy Gelman <andriy.gelman at gmail.com>
---
 modules/stream_out/rtp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/stream_out/rtp.c b/modules/stream_out/rtp.c
index 1a0ebbd2df..018c327eab 100644
--- a/modules/stream_out/rtp.c
+++ b/modules/stream_out/rtp.c
@@ -217,7 +217,7 @@ vlc_module_begin ()
               RTCP_MUX_TEXT, RTCP_MUX_LONGTEXT, false )
     add_integer( SOUT_CFG_PREFIX "caching", MS_FROM_VLC_TICK(DEFAULT_PTS_DELAY),
                  CACHING_TEXT, CACHING_LONGTEXT, true )
-    add_integer( "rtsp-timeout", 60, RTSP_TIMEOUT_TEXT,
+    add_integer( "rtsp-timeout", 10, RTSP_TIMEOUT_TEXT,
                  RTSP_TIMEOUT_LONGTEXT, true )
     add_string( "sout-rtsp-user", "",
                 RTSP_USER_TEXT, RTSP_USER_LONGTEXT, true )
-- 
2.28.0



More information about the vlc-devel mailing list