public void Close()
{
try
{
if (!_isClosed)
{
logger.Debug("RTSP client, closing connection for " + _url + ".");
_isClosed = true;
_sendKeepAlivesMRE.Set();
Teardown();
if (_rtspSession != null && !_rtspSession.IsClosed)
{
_rtspSession.Close();
}
if (_rtspStream != null)
{
try
{
_rtspStream.Close();
}
catch (Exception rtpStreamExcp)
{
logger.Error("Exception RTSPClient.Close closing RTP stream. " + rtpStreamExcp);
}
}
if (OnClosed != null)
{
OnClosed(this);
}
}
}
catch (Exception excp)
{
logger.Error("Exception RTSPClient.Close. " + excp);
}
}