[Live-devel] Overuse of CPU in binaries of CYGWIN

Ross Finlayson finlayson at live555.com
Tue Feb 25 13:33:21 PST 2014


> This is an educated guess.

Remember, You Have Complete Source Code.  Rather than making "an educated guess", you should be able to figure out exactly what's going on.


> In Cygwin the RTSPClientConnection
> socket doesn't close explicitly after a TEAR. The read bitmask
> in the call to select in BasicTaskScheduler remains active
> and the call returns immediately by some reason which doesn't
> apply to other posixes.

"RTSPServer::RTSPClientSession::handleCmd_TEARDOWN()" deliberately doesn't close the "RTSPServer::RTSPClientConnection" object - on *any* OS.  This is because "RTSPClientSession" and "RTSPClientConnection" objects have separate purposes, and can have separate lifetimes.  E.g., it's possible, in principle, for a RTSP client to operate on more than one RTSP session (sequentially or concurrently) using the same "RTSPClientConnection" (i.e., the same TCP connection); and it's possible for a RTSP client to use multiple "RTSPClientConnection"s during the lifetime of a RTSP session (e.g., it could create (then close) a new TCP connection for each RTSP command that it sends).

The "RTSPClientConnection" object gets deleted if the call to "readSocket()" in "RTSPServer::RTSPClientConnection::incomingRequestHandler1()" (line 786 of "RTSPServer.cpp) returns a value < 0 - which should happen when the remote (i.e., client) end of the TCP connection gets closed - i.e., when the RTSP client closes the TCP connection after sending the "TEARDOWN".

In other words, it's not the "TEARDOWN" command that causes the "RTSPClientConnection" object to get deleted, but rather the client's closing of the TCP connection afterwards that (should be) causing the "RTSPClientConnection" object to get deleted.  If, for some reason, that's not happening on your system, then you should try to figure out why.


> Modifying handleCmd_TEARDOWN so that the RTSPClientSession
> deletes itself and its ourClientConnection closes sockets

If you insist on doing this, then DON'T modify the supplied code.  Instead, subclass "RTSPServer::RTSPClientSession" and reimplement the virtual function "handleCmd_TEARDOWN()".

If you modify the supplied code, then you can expect no support on this mailing list, and your modifications will be subject to the conditions of the LGPL.  This is explained very clearly in the FAQ.


Ross Finlayson
Live Networks, Inc.
http://www.live555.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20140226/62ae10ce/attachment.html>


More information about the live-devel mailing list