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

Andriy Gelman andriy.gelman at gmail.com
Sat Nov 21 20:35:07 CET 2020


On Sat, 21. Nov 20:16, Rémi Denis-Courmont wrote:
> 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.

No, in my testing now that path is not reached, so infinite timeout is not set.
There is probably a bug somewhere in this part of the code.

Yes, 60 seconds is a more sane time out. But I didn't see a clear way to
propagate the timeouts, and as is the code doesn't work.

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

I agree this should be improved.

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

Would be nice if you actually tried to run the example I sent in the patch.

-- 
Andriy


More information about the vlc-devel mailing list