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

Rémi Denis-Courmont remi at remlab.net
Sat Nov 21 19:16:26 CET 2020


Le lauantaina 21. marraskuuta 2020, 19.59.12 EET Andriy Gelman a écrit :
> 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().

AFAIK, httpd code disables time-outs for RTSP connections (httpd.c:1575). 
That's obviously wrong and it's even kinda vain, so it should be fixed.

But to the point, there should not be a 10-second connection timeout, so I 
don't really follow the rationale behind your patch. Furthermore, 10 seconds 
seems way too few for the session timeout. The current default value of 60 
seconds seems much saner.

> 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).

That would seem to be an FFplay bug. Even if the RTSP connection ends due to 
whatever reason, the session ID remains still valid, so the client can still 
refresh.

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

I agree that the RTSP connection timeout should be consistent with, meaning no 
shorter than, the RTSP session timeout, just to avoid reconnecting. But this 
patch does not make too much sense, TBH.

-- 
Реми Дёни-Курмон
http://www.remlab.net/





More information about the vlc-devel mailing list