OsStatus ConferenceEngineMediaInterface::deleteConnection(int connectionId) { mLock.acquire(); OsStatus rc = OS_NOT_FOUND ; ConferenceEngineMediaConnection* pMediaConnection = getMediaConnection(connectionId) ; if (pMediaConnection) { stopRtpSend(connectionId) ; stopRtpReceive(connectionId) ; OsProtectEventMgr* eventMgr = OsProtectEventMgr::getEventMgr(); OsProtectedEvent* rtpSockeRemoveEvent = eventMgr->alloc(); OsProtectedEvent* rtcpSockeRemoveEvent = eventMgr->alloc(); OsTime maxEventTime(20, 0); ConferenceEngineNetTask* pNetTask = NULL; pNetTask = ConferenceEngineNetTask::getConferenceEngineNetTask(); if (pNetTask) { pNetTask->removeInputSource(pMediaConnection->mpRtpSocket, rtpSockeRemoveEvent) ; pNetTask->removeInputSource(pMediaConnection->mpRtcpSocket, rtcpSockeRemoveEvent) ; // Wait until the call sets the number of connections rtpSockeRemoveEvent->wait(0, maxEventTime); rtcpSockeRemoveEvent->wait(0, maxEventTime); } mpFactoryImpl->releaseRtpPort(pMediaConnection->mRtcpReceivePort) ; UtlInt container(connectionId); mMediaConnections.destroy(&container); int iRC = mpConferenceEngine->GIPSConf_DeleteChannel(connectionId) ; assert(iRC == 0); eventMgr->release(rtpSockeRemoveEvent); eventMgr->release(rtcpSockeRemoveEvent); delete pMediaConnection; rc = OS_SUCCESS; } mLock.release(); return rc ; }
OsStatus CpPhoneMediaInterface::doDeleteConnection(CpPhoneMediaConnection* mediaConnection) { OsStatus returnCode = OS_NOT_FOUND; if(mediaConnection) { OsSysLog::add(FAC_CP, PRI_DEBUG, "CpPhoneMediaInterface::deleteConnection deleting the connection %p", mediaConnection); returnCode = OS_SUCCESS; mediaConnection->mDestinationSet = FALSE; #ifdef TEST_PRINT if (mediaConnection && mediaConnection->mpRtpSocket && mediaConnection->mpRtcpSocket) OsSysLog::add(FAC_CP, PRI_DEBUG, "stopping RTP/RTCP send & receive sockets %p/%p descriptors: %d/%d", mediaConnection->mpRtpSocket, mediaConnection->mpRtcpSocket, mediaConnection->mpRtpSocket->getSocketDescriptor(), mediaConnection->mpRtcpSocket->getSocketDescriptor()); else if (!mediaConnection) OsSysLog::add(FAC_CP, PRI_DEBUG, "CpPhoneMediaInterface::doDeleteConnection mediaConnection is NULL!"); else OsSysLog::add(FAC_CP, PRI_DEBUG, "CpPhoneMediaInterface::doDeleteConnection NULL socket: mpRtpSocket=0x%08x, mpRtpSocket=0x%08x", mediaConnection->mpRtpSocket, mediaConnection->mpRtcpSocket); #endif returnCode = stopRtpSend(mediaConnection->getValue()); returnCode = stopRtpReceive(mediaConnection->getValue()); if(mediaConnection->getValue() >= 0) { mpFlowGraph->deleteConnection(mediaConnection->getValue()); mediaConnection->setValue(-1); mpFlowGraph->synchronize(); } mpFactoryImpl->releaseRtpPort(mediaConnection->mRtpReceivePort) ; if(mediaConnection->mpRtpSocket) { #ifdef TEST_PRINT #endif OsSysLog::add(FAC_CP, PRI_DEBUG, "CpPhoneMediaInterface::doDeleteConnection deleting RTP socket: %p descriptor: %d", mediaConnection->mpRtpSocket, mediaConnection->mpRtpSocket->getSocketDescriptor()); delete mediaConnection->mpRtpSocket; mediaConnection->mpRtpSocket = NULL; } if(mediaConnection->mpRtcpSocket) { #ifdef TEST_PRINT #endif OsSysLog::add(FAC_CP, PRI_DEBUG, "CpPhoneMediaInterface::doDeleteConnection deleting RTCP socket: %p descriptor: %d", mediaConnection->mpRtcpSocket, mediaConnection->mpRtcpSocket->getSocketDescriptor()); delete mediaConnection->mpRtcpSocket; mediaConnection->mpRtcpSocket = NULL; } } return(returnCode); }