Example #1
0
	// OnRtpHandler
	virtual void onReceiveEvent(CRTPData::pointer receiveData, DoRtpHandler::pointer pDoRtpHandler, void * rtpParam)
	{
		BOOST_ASSERT (receiveData.get() != 0);
		if (m_commHandler.get() != NULL)
		{
			// ?
			unsigned long destIp = receiveData->destip();
			unsigned int  destPort = receiveData->destport();
			u_long remoteAddrHash = destIp + destPort;

			cgcRemote::pointer pCgcRemote;
			if (!m_mapCgcRemote.find(remoteAddrHash, pCgcRemote, false))
			{
				pCgcRemote = cgcRemote::pointer(new CcgcRemote(destIp, destPort, (CRemoteHandler*)this, m_pDoRtpHandler));
				m_mapCgcRemote.insert(remoteAddrHash, pCgcRemote);
			}else if (pCgcRemote->isInvalidate())
			{
				m_mapCgcRemote.remove(remoteAddrHash);
				pCgcRemote = cgcRemote::pointer(new CcgcRemote(destIp, destPort, (CRemoteHandler*)this, m_pDoRtpHandler));
				m_mapCgcRemote.insert(remoteAddrHash, pCgcRemote);
			}else
			{
				((CcgcRemote*)pCgcRemote.get())->SetRemote(destIp, destPort);
			}
			CRtpRemoteInfo::pointer pEventData = CRtpRemoteInfo::create(CCommEventData::CET_Recv);
			pEventData->setRemote(pCgcRemote);
			pEventData->setRemoteId(pCgcRemote->getRemoteId());
			pEventData->recvdata(receiveData);
			m_listMgr.add(pEventData);
		}
	}
Example #2
0
void CRtp::stopRtp(DoRtpHandler::pointer handler)
{
	CRtpProxy::pointer rtpProxy;
	if (m_rtpProxy.find(handler.get(), rtpProxy, true))
	{
		//handler->doSetRtpHandler(0);
		rtpProxy->DestroySession();
		handler->doSetRtpHandler(0);
	}
}