Beispiel #1
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);
	}
}
Beispiel #2
0
	virtual bool initService(cgcValueInfo::pointer parameter)
	{
		if (m_commHandler.get() == NULL) return false;
		if (m_bServiceInited) return true;

		if (parameter.get() != NULL && parameter->getType() == cgcValueInfo::TYPE_VECTOR)
		{
			const std::vector<cgcValueInfo::pointer>& lists = parameter->getVector();
			if (lists.size() > 2)
				m_protocol = lists[2]->getInt();
			if (lists.size() > 1)
				m_capacity = lists[1]->getInt();
			if (lists.size() > 0)
				m_commPort = lists[0]->getInt();
			else
				return false;
		}

		if (m_pDoRtpHandler.get() == 0)
		{
			m_pDoRtpHandler = m_rtpService->startRtp(m_commPort);
			if (m_pDoRtpHandler.get() == 0)
				return false;
			m_pDoRtpHandler->doSetMediaType(1);
			m_pDoRtpHandler->doSetRtpHandler(this);
		}

		m_capacity = m_capacity < 1 ? 1 : m_capacity;
		CIDEvent * pIDEvent = new CIDEvent();
		pIDEvent->m_nCurIDEvent = theCurrentIdEvent+1;
		pIDEvent->m_nCapacity = m_capacity;
		theAppAttributes->setAttribute(EVENT_ATTRIBUTE, this, cgcObject::pointer(pIDEvent));

		for (int i=0; i<m_capacity; i++)
		{
			theApplication->SetTimer(++theCurrentIdEvent, m_capacity, shared_from_this());
		}

		m_bServiceInited = true;
		CGC_LOG((LOG_INFO, _T("**** [%s:%d] Start succeeded ****\n"), serviceName().c_str(), m_commPort));
		return true;
	}