[Live-devel] Fwd: Destructor of SocketDescriptor seems do things wrong.

趙國章 kcchao0921 at gmail.com
Wed Feb 12 23:52:43 PST 2014


Hi Ross,
  I use liveMedia library 2014.01.24 to do streaming via RTSP over TCP.
When client is still connecting to server and I delete RTSPServer,
my system will crash. The following is the call stack I traced:

== RTSPServer.cpp
RTSPServer::~RTSPServer (line 309) -> RTSPClientSession::~RTSPClientSession
-> RTSPClientSession::reclaimStreamStates
== OnDemandServerMediaSubsession.cpp
-> OnDemandServerMediaSubsession::deleteStream -> StreamState::endPlaying
== RTPInterface.cpp
-> RTPInterface::removeStreamSocket (fRTPSink or fRTCPInstance called)
-> deregisterSocket -> SocketDescriptor::deregisterRTPInterface
->SocketDescriptor::~SocketDescriptor

two things happend:
1. RTPInterface::removeStreamSocket is called and it seems lead to
recursive and double delete SocketDescriptor.
2. Callback fServerRequestAlternativeByteHandler is called. Now It
is RTSPClientConnection::handleAlternativeRequestByte (line 1933) and
   call RTSPClientConnection::handleAlternativeRequestByte1 of one
RTSPClientConnection instance. But all RTSPClientConnection objects
have  been deleted before deleting RTSPClientSession in
RTSPServer::~RTSPServer.

Here is my solution:
1. Just comment the code that handling remove stream socket.
2. Switch the handling order of RTSPClientConnection and RTSPClientSession.
It means to delete RTSPClientSession first because
    RTSPClientSession is based on RTSPClientConnection. I think this is
better.

Don't describe very well, hope you can understand :) .
Many thanks.

-- 
走遍眾世誰為痴
笑看百態追楚狂
我心自有極樂國
風雲星月皆文章
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20140213/ce43013b/attachment.html>


More information about the live-devel mailing list