<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<p>In order to switch my server implementation from multicast to unicast, I use the following function in my live555 wrapper code to close the current session before re-opening the new session.</p>
<p>void CRTSPWrapper::RemoveSMS()<br />{<br /> streamStream_t *stream = m_StreamArray[m_StreamIndex];<br /> if (stream->isMulticast)<br /> {<br /> Medium::close(stream->rtcp);<br /> Medium::close(stream->sink);<br /> Medium::close(stream->framedSource);<br /> delete stream->rtcpGroupsock;<br /> delete stream->rtpGroupsock;<br /> }<br /> rtspServer->deleteServerMediaSession(stream->sms);<br /> stream->iRefCount = 0;<br /> stream->sms = NULL;<br /> m_RemoveSuccess = 1;<br />}</p>
<p>I'm using VLC as the client to test this and I can connect to my server using a multicast url of the form:- rtp://@224.50.87.90:3000</p>
<p>I can also connect using the unicast address form:- rtsp://10.50.87.90:554/stream0</p>
<p>I find, if I have a unicast connection to the server and I call the above code to shut it down, I get a segmentation fault in deleteServerMediaSession. I don't get this crash if I connect only via the multicast addressing method.</p>
<p>Digging a bit deeper, I'm finding the crash to be in the (RTSPServer.cpp) reclaimStreamStates() function called from the RTSPClientSession destructor. I suspect fStreamStates[i].subsession is not NULL but not legitimate, but I've no idea why not.</p>
<p>It seems that there is no client session to destroy if the rtp multicast address method is used, neither is the reference count incremented in this case.</p>
<p>Any advice or help would be appreciated.</p>
<p>- David J Myers</p>
<div> </div>
</body></html>