[Live-devel] Event Loop Not Terminating
Ross Finlayson
finlayson at live555.com
Wed May 7 21:29:13 PDT 2014
> We use the event loop ‘watch variable’ mechanism to stop the event loop and terminate our application (which is based on the testRTSPClient sample). This works about 99.9% of the time. However our systems run 24/7 and occasionally we are finding that the event loop does not terminate. After some painful investigation we figured out why. The problem is in RTPInterface.cpp, member function sendDataOverTCP(). The event loop is hung in the socket send function – because the socket is in blocking mode.
Note that the blocking "send()" is done *only if* the immediately-previous, non-blocking "send()" succeeded in writing only part of the data. That's why it's done. And it has to be done (and therefore, your timeout hack couldn't be applied, unless - at the end of the timeout - the socket were always closed). See
http://lists.live555.com/pipermail/live-devel/2014-April/018270.html
I don't know why this "send()" is blocking for a long period of time for you, but it suggests that you may have severe network congestion (and insufficient network bandwidth), for which RTP/RTCP-over-TCP delivery is not appropriate. As noted in the link above, you can now disable RTP/RTCP-over-TCP delivery in your server.
> Another option would be to close the socket handle from a different thread which would cause the socket send function to return. (This is how we break out of a blocking socket call in other environments). However there does not seem to be a way to get the socket handle since these variables are private
No, they're not. They're "protected". Note the fields "fClientInputSocket" and "fClientOutputSocket" in "RTSPServer::RTSPClientConnection". You could subclass "RTSPServer::RTSPClientConnection" (and therefore also subclass "RTSPServer" and reimplement "createNewClientConnection()"). Then your subclass would have access to these two sockets (which are usually the same, unless you're doing RTSP/RTP/RTCP-over-HTTP).
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/20140507/2536b740/attachment.html>
More information about the live-devel
mailing list