/*!a Test case to test the destroy() * method. */ void testRemoveAndDestroy() { const char* prefix = "test the destroy() method " ; UtlContainableTestStub uStub(0) ; UtlContainableTestStub* uStubPtr ; uStubPtr = new UtlContainableTestStub(1) ; commonList.append(&uStub) ; commonList.append(uStubPtr) ; int cCountBefore = UtlContainableTestStub :: getCount() ; UtlBoolean returnValue = commonList.destroy(uStubPtr) ; UtlContainable* uLast = commonList.last() ; string msg ; TestUtilities::createMessage(2, &msg, prefix, ":- Verify the return value") ; CPPUNIT_ASSERT_MESSAGE(msg.data(), returnValue) ; TestUtilities::createMessage(2, &msg, prefix, ":- Verify that the entry is removed") ; CPPUNIT_ASSERT_EQUAL_MESSAGE(msg.data(), (void*)&uStub, (void*)uLast) ; // The CollectableTestStub has been implemented such that a static counter gets decremented // for every descruction of an object instance. To verify that the object was destroyed, // verify that the static count went down. int cCountAfter = UtlContainableTestStub :: getCount() ; TestUtilities::createMessage(2, &msg, prefix, ":- Verify that the object was deleted") ; CPPUNIT_ASSERT_EQUAL_MESSAGE(msg.data(), cCountBefore -1, cCountAfter) ; }
OsStatus CpNotificationRegister::unsubscribe(CP_NOTIFICATION_TYPE notificationType, const SipDialog& callbackSipDialog) { OsStatus result = OS_FAILED; UtlInt key((int)notificationType); UtlSList* pDialogList = dynamic_cast<UtlSList*>(m_register.findValue(&key)); if (!pDialogList) { return OS_SUCCESS; } if (pDialogList) { UtlSListIterator itor(*pDialogList); while (itor()) { SipDialog* pSipDialog = dynamic_cast<SipDialog*>(itor.item()); if (pSipDialog && pSipDialog->compareDialogs(callbackSipDialog) != SipDialog::DIALOG_MISMATCH) { pDialogList->destroy(pSipDialog); } } result = OS_SUCCESS; } return result; }
void MpRtpInputAudioConnection::handleStartReceiveRtp(UtlSList& codecList, OsSocket& rRtpSocket, OsSocket& rRtcpSocket) { m_bAudioReceived = FALSE; m_inactiveFrameCount = 0; if (codecList.entries() > 0) { // if RFC2833 DTMF is disabled if (!m_bRFC2833DTMFEnabled) { UtlSListIterator itor(codecList); SdpCodec* pCodec = NULL; // go through all codecs, if you find telephone event, remove it while (itor()) { pCodec = dynamic_cast<SdpCodec*>(itor.item()); if (pCodec && pCodec->getCodecType() == SdpCodec::SDP_CODEC_TONES) { codecList.destroy(pCodec); } } } // continue only if numCodecs is still greater than 0 if (codecList.entries() > 0) { // initialize jitter buffers for all codecs mpDejitter->initJitterBuffers(codecList); mpDecode->selectCodecs(codecList); } } // No need to synchronize as the decoder is not part of the // flowgraph. It is part of this connection/resource //mpFlowGraph->synchronize(); prepareStartReceiveRtp(rRtpSocket, rRtcpSocket); // No need to synchronize as the decoder is not part of the // flowgraph. It is part of this connection/resource //mpFlowGraph->synchronize(); if (codecList.entries() > 0) { mpDecode->enable(); if (mpDtmfDetector) { mpDtmfDetector->enable(); } } sendConnectionNotification(MP_NOTIFICATION_START_RTP_RECEIVE, 0); }