// Calculate the current cost for our sending/receiving codecs int CpPhoneMediaInterface::getCodecCPUCost() { int iCost = SdpCodec::SDP_CODEC_CPU_LOW ; if (mMediaConnections.entries() > 0) { CpPhoneMediaConnection* mediaConnection = NULL; // Iterate the connections and determine the most expensive supported // codec. UtlDListIterator connectionIterator(mMediaConnections); while ((mediaConnection = (CpPhoneMediaConnection*) connectionIterator())) { // If the codec is null, assume LOW. if (mediaConnection->mpPrimaryCodec != NULL) { int iCodecCost = mediaConnection->mpPrimaryCodec->getCPUCost(); if (iCodecCost > iCost) iCost = iCodecCost; } // Optimization: If we have already hit the highest, kick out. if (iCost == SdpCodec::SDP_CODEC_CPU_HIGH) break ; } } return iCost ; }
// Calculate the worst case cost for our sending/receiving codecs int CpPhoneMediaInterface::getCodecCPULimit() { int iCost = SdpCodec::SDP_CODEC_CPU_LOW ; int iCodecs = 0 ; SdpCodec** codecs ; // // If have connections; report what we have offered // if (mMediaConnections.entries() > 0) { CpPhoneMediaConnection* mediaConnection = NULL; // Iterate the connections and determine the most expensive supported // codec. UtlDListIterator connectionIterator(mMediaConnections); while ((mediaConnection = (CpPhoneMediaConnection*) connectionIterator())) { mediaConnection->mpCodecFactory->getCodecs(iCodecs, codecs) ; for(int i = 0; i < iCodecs; i++) { // If the cost is greater than what we have, then make that the cost. int iCodecCost = codecs[i]->getCPUCost(); if (iCodecCost > iCost) iCost = iCodecCost; delete codecs[i]; } delete[] codecs; // Optimization: If we have already hit the highest, kick out. if (iCost == SdpCodec::SDP_CODEC_CPU_HIGH) break ; } } // // If no connections; report what we plan on using // else { mSupportedCodecs.getCodecs(iCodecs, codecs) ; for(int i = 0; i < iCodecs; i++) { // If the cost is greater than what we have, then make that the cost. int iCodecCost = codecs[i]->getCPUCost(); if (iCodecCost > iCost) iCost = iCodecCost; delete codecs[i]; } delete[] codecs; } return iCost ; }
// Limits the available codecs to only those within the designated limit. void CpPhoneMediaInterface::setCodecCPULimit(int iLimit) { mSupportedCodecs.setCodecCPULimit(iLimit) ; CpPhoneMediaConnection* mediaConnection = NULL; UtlDListIterator connectionIterator(mMediaConnections); while ((mediaConnection = (CpPhoneMediaConnection*) connectionIterator())) { mediaConnection->mpCodecFactory->setCodecCPULimit(iLimit) ; } }
void ConferenceEngineMediaInterface::setCodecCPULimit(int iLimit) { Os::Logger::instance().log(FAC_MP, PRI_ERR, "ConferenceEngineMediaInterface::setCodecCPULimit to %d", iLimit); ConferenceEngineMediaConnection* mediaConnection = NULL; UtlSListIterator connectionIterator(mMediaConnections); while ((mediaConnection = (ConferenceEngineMediaConnection*) connectionIterator())) { mediaConnection->mpCodecFactory->setCodecCPULimit(iLimit) ; } }