diff options
author | bodamnam <bodamnam@google.com> | 2023-01-10 12:00:45 +0000 |
---|---|---|
committer | bodamnam <bodamnam@google.com> | 2023-01-10 12:35:17 +0000 |
commit | ae764ce9ef54ca56bad9c461f72943c7aa1c2ef5 (patch) | |
tree | 3ee1193df8a9ca5ded2a32d9d7a2f059a9deaf83 /service/src/com | |
parent | 8d24925c114842fea1b1a0b11ead21f8a5ce4457 (diff) | |
download | ImsMedia-ae764ce9ef54ca56bad9c461f72943c7aa1c2ef5.tar.gz |
Fix the manual code review
Use nullptr instead of NULL
Bug: 260305828
Test: atest ImsMediaNativeTests
Change-Id: I3a327830092f2d9310fd138e4a03abc764a3bc06
Diffstat (limited to 'service/src/com')
129 files changed, 1114 insertions, 1111 deletions
diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/AmrParams.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/AmrParams.cpp index b99598a9..70cfb3f1 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/AmrParams.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/AmrParams.cpp @@ -65,7 +65,7 @@ bool AmrParams::operator!=(const AmrParams& param) const status_t AmrParams::writeToParcel(Parcel* out) const { status_t err; - if (out == NULL) + if (out == nullptr) { return BAD_VALUE; } @@ -95,7 +95,7 @@ status_t AmrParams::writeToParcel(Parcel* out) const status_t AmrParams::readFromParcel(const Parcel* in) { status_t err; - if (in == NULL) + if (in == nullptr) { return BAD_VALUE; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/AudioConfig.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/AudioConfig.cpp index d8dabb19..6c4ee8b7 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/AudioConfig.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/AudioConfig.cpp @@ -43,7 +43,7 @@ AudioConfig::AudioConfig() : AudioConfig::AudioConfig(AudioConfig* config) : RtpConfig(config) { - if (config != NULL) + if (config != nullptr) { pTimeMillis = config->pTimeMillis; maxPtimeMillis = config->maxPtimeMillis; @@ -113,7 +113,7 @@ bool AudioConfig::operator!=(const AudioConfig& config) const status_t AudioConfig::writeToParcel(Parcel* out) const { status_t err; - if (out == NULL) + if (out == nullptr) { return BAD_VALUE; } @@ -202,7 +202,7 @@ status_t AudioConfig::writeToParcel(Parcel* out) const status_t AudioConfig::readFromParcel(const Parcel* in) { status_t err; - if (in == NULL) + if (in == nullptr) { return BAD_VALUE; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/EvsParams.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/EvsParams.cpp index 4f2ccb06..cad1f4b6 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/EvsParams.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/EvsParams.cpp @@ -75,7 +75,7 @@ bool EvsParams::operator!=(const EvsParams& param) const status_t EvsParams::writeToParcel(Parcel* out) const { status_t err; - if (out == NULL) + if (out == nullptr) { return BAD_VALUE; } @@ -118,7 +118,7 @@ status_t EvsParams::writeToParcel(Parcel* out) const status_t EvsParams::readFromParcel(const Parcel* in) { status_t err; - if (in == NULL) + if (in == nullptr) { return BAD_VALUE; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/RtcpConfig.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/RtcpConfig.cpp index dc191ba3..16a99af5 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/RtcpConfig.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/RtcpConfig.cpp @@ -54,7 +54,7 @@ bool RtcpConfig::operator!=(const RtcpConfig& config) const status_t RtcpConfig::writeToParcel(Parcel* out) const { status_t err; - if (out == NULL) + if (out == nullptr) { return BAD_VALUE; } @@ -90,7 +90,7 @@ status_t RtcpConfig::writeToParcel(Parcel* out) const status_t RtcpConfig::readFromParcel(const Parcel* in) { status_t err; - if (in == NULL) + if (in == nullptr) { return BAD_VALUE; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/RtpConfig.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/RtpConfig.cpp index 02230830..c38922a8 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/RtpConfig.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/RtpConfig.cpp @@ -45,7 +45,7 @@ RtpConfig::~RtpConfig() {} RtpConfig::RtpConfig(RtpConfig* config) { - if (config == NULL) + if (config == nullptr) { return; } @@ -115,7 +115,7 @@ bool RtpConfig::operator!=(const RtpConfig& config) const status_t RtpConfig::writeToParcel(Parcel* out) const { status_t err; - if (out == NULL) + if (out == nullptr) { return BAD_VALUE; } @@ -194,7 +194,7 @@ status_t RtpConfig::writeToParcel(Parcel* out) const status_t RtpConfig::readFromParcel(const Parcel* in) { status_t err; - if (in == NULL) + if (in == nullptr) { return BAD_VALUE; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/TextConfig.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/TextConfig.cpp index cbf4055b..93eda550 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/TextConfig.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/TextConfig.cpp @@ -38,7 +38,7 @@ TextConfig::TextConfig() : TextConfig::TextConfig(TextConfig* config) : RtpConfig(config) { - if (config != NULL) + if (config != nullptr) { this->mCodecType = config->mCodecType; this->mBitrate = config->mBitrate; @@ -89,7 +89,7 @@ bool TextConfig::operator!=(const TextConfig& config) const status_t TextConfig::writeToParcel(Parcel* out) const { status_t err; - if (out == NULL) + if (out == nullptr) { return BAD_VALUE; } @@ -138,7 +138,7 @@ status_t TextConfig::writeToParcel(Parcel* out) const status_t TextConfig::readFromParcel(const Parcel* in) { status_t err; - if (in == NULL) + if (in == nullptr) { return BAD_VALUE; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/VideoConfig.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/VideoConfig.cpp index 2867457f..292b3a68 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/VideoConfig.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/VideoConfig.cpp @@ -52,7 +52,7 @@ VideoConfig::VideoConfig() : VideoConfig::VideoConfig(VideoConfig* config) : RtpConfig(config) { - if (config == NULL) + if (config == nullptr) return; videoMode = config->videoMode; codecType = config->codecType; @@ -155,7 +155,7 @@ bool VideoConfig::operator!=(const VideoConfig& config) const status_t VideoConfig::writeToParcel(Parcel* out) const { status_t err; - if (out == NULL) + if (out == nullptr) { return BAD_VALUE; } @@ -274,7 +274,7 @@ status_t VideoConfig::writeToParcel(Parcel* out) const status_t VideoConfig::readFromParcel(const Parcel* in) { status_t err; - if (in == NULL) + if (in == nullptr) { return BAD_VALUE; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/BaseJitterBuffer.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/BaseJitterBuffer.cpp index 331cc2e1..06eda0ff 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/BaseJitterBuffer.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/BaseJitterBuffer.cpp @@ -19,7 +19,7 @@ BaseJitterBuffer::BaseJitterBuffer() { - mCallback = NULL; + mCallback = nullptr; mFirstFrameReceived = false; mSsrc = 0; mCodecType = 0; diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/BaseManager.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/BaseManager.cpp index b7ea6617..f3e7e811 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/BaseManager.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/BaseManager.cpp @@ -19,14 +19,14 @@ BaseManager::BaseManager() { - mCallback = NULL; + mCallback = nullptr; } BaseManager::~BaseManager() {} void BaseManager::setCallback(CBManager pfnCallback) { - if (mCallback == NULL) + if (mCallback == nullptr) { IMLOGI0("[setCallback]"); mCallback = std::bind(pfnCallback, std::placeholders::_1, std::placeholders::_2); @@ -35,7 +35,7 @@ void BaseManager::setCallback(CBManager pfnCallback) int BaseManager::sendResponse(int sessionId, const android::Parcel& parcel) { - if (mCallback != NULL) + if (mCallback != nullptr) { return mCallback(sessionId, parcel); } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/BaseStreamGraph.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/BaseStreamGraph.cpp index c1b218b8..d2b2292c 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/BaseStreamGraph.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/BaseStreamGraph.cpp @@ -25,7 +25,7 @@ BaseStreamGraph::BaseStreamGraph(BaseSessionCallback* callback, int localFd) : std::unique_ptr<StreamScheduler> scheduler(new StreamScheduler()); mScheduler = std::move(scheduler); - if (mCallback != NULL) + if (mCallback != nullptr) { mCallback->SendEvent(kImsMediaEventStateChanged); } @@ -81,7 +81,7 @@ void BaseStreamGraph::setState(StreamState state) { mGraphState = state; - if (mCallback != NULL) + if (mCallback != nullptr) { mCallback->SendEvent(kImsMediaEventStateChanged); } @@ -95,7 +95,7 @@ StreamState BaseStreamGraph::getState() void BaseStreamGraph::AddNode(BaseNode* pNode, bool bReverse) { - if (pNode == NULL) + if (pNode == nullptr) { return; } @@ -120,7 +120,7 @@ void BaseStreamGraph::AddNode(BaseNode* pNode, bool bReverse) void BaseStreamGraph::RemoveNode(BaseNode* pNode) { - if (pNode == NULL) + if (pNode == nullptr) { return; } @@ -142,7 +142,7 @@ ImsMediaResult BaseStreamGraph::startNodes() { BaseNode* pNode = mListNodeToStart.front(); - if (pNode != NULL) + if (pNode != nullptr) { IMLOGD2("[startNodes] media[%d], start node[%s]", pNode->GetMediaType(), pNode->GetNodeName()); @@ -172,7 +172,7 @@ ImsMediaResult BaseStreamGraph::stopNodes() { BaseNode* pNode = mListNodeStarted.front(); - if (pNode != NULL) + if (pNode != nullptr) { IMLOGD2("[stopNodes] media[%d], stop node[%s]", pNode->GetMediaType(), pNode->GetNodeName()); @@ -196,7 +196,7 @@ void BaseStreamGraph::deleteNodes() { BaseNode* pNode = mListNodeToStart.front(); - if (pNode != NULL) + if (pNode != nullptr) { IMLOGD2("[deleteNodes] media[%d], delete node[%s]", pNode->GetMediaType(), pNode->GetNodeName()); @@ -213,7 +213,7 @@ BaseNode* BaseStreamGraph::findNode(kBaseNodeId id) { for (auto& node : mListNodeToStart) { - if (node != NULL && node->GetNodeId() == id) + if (node != nullptr && node->GetNodeId() == id) { return node; } @@ -221,13 +221,13 @@ BaseNode* BaseStreamGraph::findNode(kBaseNodeId id) for (auto& node : mListNodeStarted) { - if (node != NULL && node->GetNodeId() == id) + if (node != nullptr && node->GetNodeId() == id) { return node; } } - return NULL; + return nullptr; } bool BaseStreamGraph::setMediaQualityThreshold(MediaQualityThreshold* threshold) diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/IRtpSession.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/IRtpSession.cpp index 2a969452..b41d6763 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/IRtpSession.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/IRtpSession.cpp @@ -28,7 +28,7 @@ IRtpSession* IRtpSession::GetInstance( for (auto& i : mListRtpSession) { - if (i != NULL && i->isSameInstance(type, localAddress, peerAddress)) + if (i != nullptr && i->isSameInstance(type, localAddress, peerAddress)) { i->increaseRefCounter(); return i; @@ -49,7 +49,7 @@ IRtpSession* IRtpSession::GetInstance( void IRtpSession::ReleaseInstance(IRtpSession* session) { - if (session == NULL) + if (session == nullptr) { return; } @@ -79,10 +79,10 @@ IRtpSession::IRtpSession( mRefCount = 0; mLocalAddress = localAddress; mPeerAddress = peerAddress; - mRtpEncoderListener = NULL; - mRtpDecoderListener = NULL; - mRtcpEncoderListener = NULL; - mRtcpDecoderListener = NULL; + mRtpEncoderListener = nullptr; + mRtpDecoderListener = nullptr; + mRtcpEncoderListener = nullptr; + mRtcpDecoderListener = nullptr; std::memset(mPayloadParam, 0, sizeof(tRtpSvc_SetPayloadParam) * MAX_NUM_PAYLOAD_PARAM); mNumPayloadParam = 0; mLocalRtpSsrc = 0; @@ -115,10 +115,10 @@ IRtpSession::IRtpSession( IRtpSession::~IRtpSession() { IMS_RtpSvc_DeleteSession(mRtpSessionId); - mRtpEncoderListener = NULL; - mRtpDecoderListener = NULL; - mRtcpEncoderListener = NULL; - mRtcpDecoderListener = NULL; + mRtpEncoderListener = nullptr; + mRtpDecoderListener = nullptr; + mRtcpEncoderListener = nullptr; + mRtcpDecoderListener = nullptr; } bool IRtpSession::operator==(const IRtpSession& obj2) @@ -312,7 +312,7 @@ bool IRtpSession::SendRtpPacket(uint32_t nPayloadType, uint8_t* pData, uint32_t stRtpPacketParam.diffFromLastRtpTimestamp = nTimeDiff; stRtpPacketParam.bXbit = bExtension ? eRTP_TRUE : eRTP_FALSE; - if (bExtension && pExtensionInfo != NULL) + if (bExtension && pExtensionInfo != nullptr) { stRtpPacketParam.nDefinedByProfile = pExtensionInfo->nDefinedByProfile; stRtpPacketParam.nLength = pExtensionInfo->nLength; @@ -391,7 +391,7 @@ int IRtpSession::OnRtcpPacket(unsigned char* pData, RtpSvc_Length wLen) std::lock_guard<std::mutex> guard(mutexEncoder); if (mRtcpEncoderListener) { - if (pData != NULL) + if (pData != nullptr) { mNumRtcpPacketSent++; mRtcpEncoderListener->OnRtcpPacket(pData, wLen); @@ -478,7 +478,7 @@ void IRtpSession::OnPeerRtcpComponents(void* nMsg) { IMLOGD0("[OnPeerRtcpComponents]"); - if (nMsg != NULL && mRtcpDecoderListener != NULL) + if (nMsg != nullptr && mRtcpDecoderListener != nullptr) { int32_t roundTripTimeDelay = *reinterpret_cast<int32_t*>(nMsg); mRtcpDecoderListener->OnEvent(kRequestRoundTripTimeDelayUpdate, roundTripTimeDelay); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/StreamScheduler.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/StreamScheduler.cpp index fb070f1e..566d7061 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/StreamScheduler.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/StreamScheduler.cpp @@ -34,7 +34,7 @@ StreamScheduler::~StreamScheduler() void StreamScheduler::RegisterNode(BaseNode* pNode) { - if (pNode == NULL) + if (pNode == nullptr) { return; } @@ -54,7 +54,7 @@ void StreamScheduler::RegisterNode(BaseNode* pNode) void StreamScheduler::DeRegisterNode(BaseNode* pNode) { - if (pNode == NULL) + if (pNode == nullptr) { return; } @@ -79,7 +79,7 @@ void StreamScheduler::Start() for (auto& node : mlistSourceNode) { - if (node != NULL) + if (node != nullptr) { nNumOfRegisteredNode++; IMLOGD2("[Start] [%p] registered source node [%s]", this, node->GetNodeName()); @@ -88,7 +88,7 @@ void StreamScheduler::Start() for (auto& node : mlistRegisteredNode) { - if (node != NULL) + if (node != nullptr) { nNumOfRegisteredNode++; IMLOGD2("[Start] [%p] registered node [%s]", this, node->GetNodeName()); @@ -124,15 +124,15 @@ BaseNode* StreamScheduler::DetermineProcessingNode(uint32_t* pnMaxDataInNode) { if (IsThreadStopped()) { - return NULL; + return nullptr; } - BaseNode* pRetNode = NULL; + BaseNode* pRetNode = nullptr; uint32_t nMaxDataInNode = 0; for (auto& node : mlistNodeToRun) { - if (node != NULL) + if (node != nullptr) { uint32_t nDataInNode = node->GetDataCount(); @@ -155,7 +155,7 @@ void StreamScheduler::RunRegisteredNode() // run source nodes for (auto& node : mlistSourceNode) { - if (node != NULL && node->GetState() == kNodeStateRunning) + if (node != nullptr && node->GetState() == kNodeStateRunning) { node->ProcessData(); } @@ -164,7 +164,7 @@ void StreamScheduler::RunRegisteredNode() // run nodes for (auto& node : mlistRegisteredNode) { - if (node != NULL) + if (node != nullptr) { mlistNodeToRun.push_back(node); } @@ -174,7 +174,7 @@ void StreamScheduler::RunRegisteredNode() { BaseNode* pNode = DetermineProcessingNode(&nMaxDataInNode); - if (pNode == NULL) + if (pNode == nullptr) { break; } @@ -215,5 +215,5 @@ void* StreamScheduler::run() mConditionExit.signal(); IMLOGD1("[run] [%p] exit", this); - return NULL; + return nullptr; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/AudioJitterBuffer.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/AudioJitterBuffer.cpp index 9056900e..e56247e2 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/AudioJitterBuffer.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/AudioJitterBuffer.cpp @@ -227,7 +227,7 @@ void AudioJitterBuffer::Add(ImsMediaSubType subtype, uint8_t* pbBuffer, uint32_t DataEntry* pEntry; mDataQueue.GetLast(&pEntry); - if (pEntry == NULL) + if (pEntry == nullptr) { return; } @@ -266,7 +266,7 @@ bool AudioJitterBuffer::Get(ImsMediaSubType* psubtype, uint8_t** ppData, uint32_ if (psubtype) *psubtype = MEDIASUBTYPE_UNDEFINED; if (ppData) - *ppData = NULL; + *ppData = nullptr; if (pnDataSize) *pnDataSize = 0; if (pnTimestamp) @@ -284,7 +284,7 @@ bool AudioJitterBuffer::Get(ImsMediaSubType* psubtype, uint8_t** ppData, uint32_ std::lock_guard<std::mutex> guard(mMutex); bool bWait = false; - DataEntry* pEntry = NULL; + DataEntry* pEntry = nullptr; bool bForceToPlay = false; mUpdateJitterBufferSize++; // add code for no dtx mCheckUpdateJitterPacketCnt++; @@ -369,7 +369,7 @@ bool AudioJitterBuffer::Get(ImsMediaSubType* psubtype, uint8_t** ppData, uint32_ if (psubtype) *psubtype = MEDIASUBTYPE_UNDEFINED; if (ppData) - *ppData = NULL; + *ppData = nullptr; if (pnDataSize) *pnDataSize = 0; if (pnTimestamp) @@ -417,7 +417,7 @@ bool AudioJitterBuffer::Get(ImsMediaSubType* psubtype, uint8_t** ppData, uint32_ { mDataQueue.Get(&pEntry); - if (pEntry == NULL) + if (pEntry == nullptr) { return false; } @@ -632,7 +632,7 @@ bool AudioJitterBuffer::Get(ImsMediaSubType* psubtype, uint8_t** ppData, uint32_ mDeleteCount++; } - if (mDataQueue.Get(&pEntry) && pEntry != NULL && + if (mDataQueue.Get(&pEntry) && pEntry != nullptr && (pEntry->nTimestamp == mCurrPlayingTS || bForceToPlay || (pEntry->nTimestamp < TS_ROUND_QUARD && mCurrPlayingTS > 0xFFFF))) { @@ -705,7 +705,7 @@ bool AudioJitterBuffer::Get(ImsMediaSubType* psubtype, uint8_t** ppData, uint32_ if (psubtype) *psubtype = MEDIASUBTYPE_UNDEFINED; if (ppData) - *ppData = NULL; + *ppData = nullptr; if (pnDataSize) *pnDataSize = 0; if (pnTimestamp) @@ -756,7 +756,7 @@ void AudioJitterBuffer::CollectRxRtpStatus(int32_t seq, kRtpPacketStatus status) { IMLOGD_PACKET2(IM_PACKET_LOG_JITTER, "[CollectRxRtpStatus] seq[%d], status[%d]", seq, status); - if (mCallback != NULL) + if (mCallback != nullptr) { SessionCallbackParameter* param = new SessionCallbackParameter(seq, status, ImsMediaTimer::GetTimeInMilliSeconds()); @@ -768,7 +768,7 @@ void AudioJitterBuffer::CollectJitterBufferStatus(int32_t currSize, int32_t maxS IMLOGD_PACKET2(IM_PACKET_LOG_JITTER, "[CollectJitterBufferStatus] currSize[%d], maxSize[%d]", currSize, maxSize); - if (mCallback != NULL) + if (mCallback != nullptr) { mCallback->SendEvent(kCollectJitterBufferSize, currSize, maxSize); } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/AudioManager.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/AudioManager.cpp index d5bee8a8..6a711584 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/AudioManager.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/AudioManager.cpp @@ -20,7 +20,7 @@ using namespace android; -AudioManager* AudioManager::sManager = NULL; +AudioManager* AudioManager::sManager = nullptr; AudioManager::AudioManager() {} @@ -28,7 +28,7 @@ AudioManager::~AudioManager() {} AudioManager* AudioManager::getInstance() { - if (sManager == NULL) + if (sManager == nullptr) { sManager = new AudioManager(); } @@ -289,7 +289,7 @@ void AudioManager::RequestHandler::processEvent( case kAudioOpenSession: { EventParamOpenSession* param = reinterpret_cast<EventParamOpenSession*>(paramA); - if (param != NULL) + if (param != nullptr) { AudioConfig* pConfig = reinterpret_cast<AudioConfig*>(param->mConfig); result = AudioManager::getInstance()->openSession( @@ -308,7 +308,7 @@ void AudioManager::RequestHandler::processEvent( delete param; - if (pConfig != NULL) + if (pConfig != nullptr) { delete pConfig; } @@ -357,7 +357,7 @@ void AudioManager::RequestHandler::processEvent( case kAudioDeleteConfig: { AudioConfig* config = reinterpret_cast<AudioConfig*>(paramA); - if (config != NULL) + if (config != nullptr) { AudioManager::getInstance()->deleteConfig(static_cast<int>(sessionId), config); delete config; @@ -367,7 +367,7 @@ void AudioManager::RequestHandler::processEvent( case kAudioSendDtmf: { EventParamDtmf* param = reinterpret_cast<EventParamDtmf*>(paramA); - if (param != NULL) + if (param != nullptr) { AudioManager::getInstance()->sendDtmf( static_cast<int>(sessionId), param->digit, param->duration); @@ -381,7 +381,7 @@ void AudioManager::RequestHandler::processEvent( case kAudioSetMediaQualityThreshold: { MediaQualityThreshold* threshold = reinterpret_cast<MediaQualityThreshold*>(paramA); - if (threshold != NULL) + if (threshold != nullptr) { AudioManager::getInstance()->setMediaQualityThreshold( static_cast<int>(sessionId), threshold); @@ -432,7 +432,7 @@ void AudioManager::ResponseHandler::processEvent( parcel.writeInt32(event); parcel.writeInt32(paramA); // result AudioConfig* config = reinterpret_cast<AudioConfig*>(paramB); - if (config != NULL) + if (config != nullptr) { config->writeToParcel(&parcel); AudioManager::getInstance()->sendResponse(sessionId, parcel); @@ -444,7 +444,7 @@ void AudioManager::ResponseHandler::processEvent( { parcel.writeInt32(event); AudioConfig* config = reinterpret_cast<AudioConfig*>(paramA); - if (config != NULL) + if (config != nullptr) { config->writeToParcel(&parcel); AudioManager::getInstance()->sendResponse(sessionId, parcel); @@ -470,7 +470,7 @@ void AudioManager::ResponseHandler::processEvent( { parcel.writeInt32(event); MediaQuality* quality = reinterpret_cast<MediaQuality*>(paramA); - if (quality != NULL) + if (quality != nullptr) { quality->writeToParcel(&parcel); AudioManager::getInstance()->sendResponse(sessionId, parcel); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/AudioSession.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/AudioSession.cpp index e9b4a07b..025e9e42 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/AudioSession.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/AudioSession.cpp @@ -83,7 +83,7 @@ SessionState AudioSession::getState() for (auto& graph : mListGraphRtpTx) { - if (graph != NULL && graph->getState() == kStreamStateRunning) + if (graph != nullptr && graph->getState() == kStreamStateRunning) { return kSessionStateActive; } @@ -91,7 +91,7 @@ SessionState AudioSession::getState() for (auto& graph : mListGraphRtpRx) { - if (graph != NULL && graph->getState() == kStreamStateRunning) + if (graph != nullptr && graph->getState() == kStreamStateRunning) { return kSessionStateActive; } @@ -99,7 +99,7 @@ SessionState AudioSession::getState() for (auto& graph : mListGraphRtcp) { - if (graph != NULL && graph->getState() == kStreamStateRunning) + if (graph != nullptr && graph->getState() == kStreamStateRunning) { return kSessionStateSuspended; } @@ -112,7 +112,7 @@ ImsMediaResult AudioSession::startGraph(RtpConfig* config) { IMLOGI0("[startGraph]"); - if (config == NULL) + if (config == nullptr) { return RESULT_INVALID_PARAM; } @@ -131,7 +131,7 @@ ImsMediaResult AudioSession::startGraph(RtpConfig* config) { for (auto& graph : mListGraphRtpTx) { - if (graph != NULL && graph->isSameGraph(config)) + if (graph != nullptr && graph->isSameGraph(config)) { ret = graph->update(config); break; @@ -168,7 +168,7 @@ ImsMediaResult AudioSession::startGraph(RtpConfig* config) { for (auto& graph : mListGraphRtpRx) { - if (graph != NULL && graph->isSameGraph(config)) + if (graph != nullptr && graph->isSameGraph(config)) { graph->setMediaQualityThreshold(&mThreshold); ret = graph->update(config); @@ -208,7 +208,7 @@ ImsMediaResult AudioSession::startGraph(RtpConfig* config) { for (auto& graph : mListGraphRtcp) { - if (graph != NULL && graph->isSameGraph(config)) + if (graph != nullptr && graph->isSameGraph(config)) { graph->setMediaQualityThreshold(&mThreshold); ret = graph->update(config); @@ -242,7 +242,7 @@ ImsMediaResult AudioSession::startGraph(RtpConfig* config) // TODO : check that the timing is correct IMLOGI1("[startGraph] state[%d]", getState()); - if (mMediaQualityAnalyzer != NULL && + if (mMediaQualityAnalyzer != nullptr && !mMediaQualityAnalyzer->isSameConfig(reinterpret_cast<AudioConfig*>(config))) { mMediaQualityAnalyzer->stop(); @@ -257,14 +257,14 @@ ImsMediaResult AudioSession::addGraph(RtpConfig* config, bool enableRtcp) { IMLOGD1("[addGraph], enable rtcp[%d]", enableRtcp); - if (config == NULL || std::strcmp(config->getRemoteAddress().c_str(), "") == 0) + if (config == nullptr || std::strcmp(config->getRemoteAddress().c_str(), "") == 0) { return RESULT_INVALID_PARAM; } for (auto& graph : mListGraphRtpTx) { - if (graph != NULL && graph->isSameGraph(config)) + if (graph != nullptr && graph->isSameGraph(config)) { IMLOGW0("[addGraph] same config is exist"); return startGraph(config); @@ -273,7 +273,7 @@ ImsMediaResult AudioSession::addGraph(RtpConfig* config, bool enableRtcp) for (auto& graph : mListGraphRtpTx) { - if (graph != NULL) + if (graph != nullptr) { graph->stop(); } @@ -281,7 +281,7 @@ ImsMediaResult AudioSession::addGraph(RtpConfig* config, bool enableRtcp) for (auto& graph : mListGraphRtpRx) { - if (graph != NULL) + if (graph != nullptr) { graph->stop(); } @@ -289,7 +289,7 @@ ImsMediaResult AudioSession::addGraph(RtpConfig* config, bool enableRtcp) for (auto& graph : mListGraphRtcp) { - if (graph != NULL && graph->getState() != kStreamStateRunning) + if (graph != nullptr && graph->getState() != kStreamStateRunning) { enableRtcp ? graph->start() : graph->stop(); } @@ -344,7 +344,7 @@ ImsMediaResult AudioSession::addGraph(RtpConfig* config, bool enableRtcp) IMLOGD1("[addGraph] mListGraphRtcp size[%d]", mListGraphRtcp.size()); - if (mMediaQualityAnalyzer != NULL && + if (mMediaQualityAnalyzer != nullptr && !mMediaQualityAnalyzer->isSameConfig(reinterpret_cast<AudioConfig*>(config))) { mMediaQualityAnalyzer->stop(); @@ -357,7 +357,7 @@ ImsMediaResult AudioSession::addGraph(RtpConfig* config, bool enableRtcp) ImsMediaResult AudioSession::confirmGraph(RtpConfig* config) { - if (config == NULL || std::strcmp(config->getRemoteAddress().c_str(), "") == 0) + if (config == nullptr || std::strcmp(config->getRemoteAddress().c_str(), "") == 0) { return RESULT_INVALID_PARAM; } @@ -367,7 +367,7 @@ ImsMediaResult AudioSession::confirmGraph(RtpConfig* config) /** Stop unmatched running instances of StreamGraph. */ for (auto& graph : mListGraphRtpTx) { - if (graph != NULL && !graph->isSameGraph(config)) + if (graph != nullptr && !graph->isSameGraph(config)) { graph->stop(); } @@ -375,7 +375,7 @@ ImsMediaResult AudioSession::confirmGraph(RtpConfig* config) for (auto& graph : mListGraphRtpRx) { - if (graph != NULL && !graph->isSameGraph(config)) + if (graph != nullptr && !graph->isSameGraph(config)) { graph->stop(); } @@ -383,7 +383,7 @@ ImsMediaResult AudioSession::confirmGraph(RtpConfig* config) for (auto& graph : mListGraphRtcp) { - if (graph != NULL && !graph->isSameGraph(config)) + if (graph != nullptr && !graph->isSameGraph(config)) { graph->stop(); } @@ -395,7 +395,7 @@ ImsMediaResult AudioSession::confirmGraph(RtpConfig* config) { AudioStreamGraphRtpTx* graph = *iter; - if (graph == NULL) + if (graph == nullptr) { continue; } @@ -434,7 +434,7 @@ ImsMediaResult AudioSession::confirmGraph(RtpConfig* config) { AudioStreamGraphRtpRx* graph = *iter; - if (graph == NULL) + if (graph == nullptr) { continue; } @@ -466,7 +466,7 @@ ImsMediaResult AudioSession::confirmGraph(RtpConfig* config) { AudioStreamGraphRtcp* graph = *iter; - if (graph == NULL) + if (graph == nullptr) { continue; } @@ -507,7 +507,7 @@ ImsMediaResult AudioSession::deleteGraph(RtpConfig* config) { AudioStreamGraphRtpTx* graph = *iter; - if (graph == NULL) + if (graph == nullptr) { continue; } @@ -542,7 +542,7 @@ ImsMediaResult AudioSession::deleteGraph(RtpConfig* config) { AudioStreamGraphRtpRx* graph = *iter; - if (graph == NULL) + if (graph == nullptr) { continue; } @@ -570,7 +570,7 @@ ImsMediaResult AudioSession::deleteGraph(RtpConfig* config) { AudioStreamGraphRtcp* graph = *iter; - if (graph == NULL) + if (graph == nullptr) { continue; } @@ -645,7 +645,7 @@ void AudioSession::onEvent(int32_t type, uint64_t param1, uint64_t param2) case kCollectRxRtpStatus: case kCollectJitterBufferSize: case kGetRtcpXrReportBlock: - if (mMediaQualityAnalyzer != NULL) + if (mMediaQualityAnalyzer != nullptr) { mMediaQualityAnalyzer->SendEvent(type, param1, param2); } @@ -662,7 +662,7 @@ void AudioSession::setMediaQualityThreshold(const MediaQualityThreshold& thresho for (auto& graph : mListGraphRtpRx) { - if (graph != NULL && graph->getState() == kStreamStateRunning) + if (graph != nullptr && graph->getState() == kStreamStateRunning) { graph->setMediaQualityThreshold(&mThreshold); } @@ -670,13 +670,13 @@ void AudioSession::setMediaQualityThreshold(const MediaQualityThreshold& thresho for (auto& graph : mListGraphRtcp) { - if (graph != NULL && graph->getState() == kStreamStateRunning) + if (graph != nullptr && graph->getState() == kStreamStateRunning) { graph->setMediaQualityThreshold(&mThreshold); } } - if (mMediaQualityAnalyzer != NULL) + if (mMediaQualityAnalyzer != nullptr) { mMediaQualityAnalyzer->setJitterThreshold( mThreshold.getJitterDurationMillis() / 1000, // milliseconds to seconds @@ -694,7 +694,7 @@ void AudioSession::sendDtmf(char digit, int duration) { AudioStreamGraphRtpTx* graph = *iter; - if (graph != NULL && graph->getState() == kStreamStateRunning) + if (graph != nullptr && graph->getState() == kStreamStateRunning) { graph->sendDtmf(digit, duration); } @@ -707,7 +707,7 @@ bool AudioSession::IsGraphAlreadyExist(RtpConfig* config) { for (auto& graph : mListGraphRtpTx) { - if (graph != NULL && graph->isSameGraph(config)) + if (graph != nullptr && graph->isSameGraph(config)) { return true; } @@ -729,7 +729,7 @@ void AudioSession::SendInternalEvent(int32_t type, uint64_t param1, uint64_t par { AudioStreamGraphRtpTx* graph = *iter; - if (graph != NULL && graph->getState() == kStreamStateRunning) + if (graph != nullptr && graph->getState() == kStreamStateRunning) { graph->processCmr(static_cast<uint32_t>(param1)); } @@ -741,7 +741,7 @@ void AudioSession::SendInternalEvent(int32_t type, uint64_t param1, uint64_t par { AudioStreamGraphRtcp* graph = *iter; - if (graph != NULL && graph->getState() == kStreamStateRunning) + if (graph != nullptr && graph->getState() == kStreamStateRunning) { graph->OnEvent(type, param1, param2); } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/AudioStreamGraphRtcp.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/AudioStreamGraphRtcp.cpp index 0e767a2c..09b0e06f 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/AudioStreamGraphRtcp.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/AudioStreamGraphRtcp.cpp @@ -25,7 +25,7 @@ AudioStreamGraphRtcp::AudioStreamGraphRtcp(BaseSessionCallback* callback, int localFd) : AudioStreamGraph(callback, localFd) { - mConfig = NULL; + mConfig = nullptr; } AudioStreamGraphRtcp::~AudioStreamGraphRtcp() {} @@ -34,7 +34,7 @@ ImsMediaResult AudioStreamGraphRtcp::create(RtpConfig* config) { IMLOGD1("[create] state[%d]", mGraphState); - if (config == NULL) + if (config == nullptr) { return RESULT_INVALID_PARAM; } @@ -83,7 +83,7 @@ ImsMediaResult AudioStreamGraphRtcp::update(RtpConfig* config) { IMLOGD1("[update] state[%d]", mGraphState); - if (config == NULL) + if (config == nullptr) { return RESULT_INVALID_PARAM; } @@ -96,7 +96,7 @@ ImsMediaResult AudioStreamGraphRtcp::update(RtpConfig* config) return RESULT_SUCCESS; } - if (mConfig != NULL) + if (mConfig != nullptr) { delete mConfig; mConfig = new AudioConfig(pConfig); @@ -140,11 +140,11 @@ ImsMediaResult AudioStreamGraphRtcp::update(RtpConfig* config) bool AudioStreamGraphRtcp::setMediaQualityThreshold(MediaQualityThreshold* threshold) { - if (threshold != NULL) + if (threshold != nullptr) { BaseNode* node = findNode(kNodeIdRtcpDecoder); - if (node != NULL) + if (node != nullptr) { RtcpDecoderNode* decoder = reinterpret_cast<RtcpDecoderNode*>(node); decoder->SetInactivityTimerSec(threshold->getRtcpInactivityTimerMillis() / 1000); @@ -165,7 +165,7 @@ bool AudioStreamGraphRtcp::OnEvent(int32_t type, uint64_t param1, uint64_t param { BaseNode* node = findNode(kNodeIdRtcpEncoder); - if (node != NULL) + if (node != nullptr) { RtcpEncoderNode* encoder = reinterpret_cast<RtcpEncoderNode*>(node); encoder->SendRtcpXr( diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/AudioStreamGraphRtpRx.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/AudioStreamGraphRtpRx.cpp index 647d41c0..016d124c 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/AudioStreamGraphRtpRx.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/AudioStreamGraphRtpRx.cpp @@ -34,7 +34,7 @@ ImsMediaResult AudioStreamGraphRtpRx::create(RtpConfig* config) { IMLOGI1("[create] state[%d]", mGraphState); - if (config == NULL) + if (config == nullptr) { return RESULT_INVALID_PARAM; } @@ -79,7 +79,7 @@ ImsMediaResult AudioStreamGraphRtpRx::update(RtpConfig* config) { IMLOGI1("[update] state[%d]", mGraphState); - if (config == NULL) + if (config == nullptr) { return RESULT_INVALID_PARAM; } @@ -92,7 +92,7 @@ ImsMediaResult AudioStreamGraphRtpRx::update(RtpConfig* config) return RESULT_SUCCESS; } - if (mConfig != NULL) + if (mConfig != nullptr) { delete mConfig; } @@ -148,11 +148,11 @@ ImsMediaResult AudioStreamGraphRtpRx::update(RtpConfig* config) bool AudioStreamGraphRtpRx::setMediaQualityThreshold(MediaQualityThreshold* threshold) { - if (threshold != NULL) + if (threshold != nullptr) { BaseNode* node = findNode(kNodeIdRtpDecoder); - if (node != NULL) + if (node != nullptr) { RtpDecoderNode* decoder = reinterpret_cast<RtpDecoderNode*>(node); decoder->SetInactivityTimerSec(threshold->getRtpInactivityTimerMillis() / 1000); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/AudioStreamGraphRtpTx.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/AudioStreamGraphRtpTx.cpp index 442d4cb6..372a137d 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/AudioStreamGraphRtpTx.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/AudioStreamGraphRtpTx.cpp @@ -36,7 +36,7 @@ ImsMediaResult AudioStreamGraphRtpTx::create(RtpConfig* config) { IMLOGI1("[create] state[%d]", mGraphState); - if (config == NULL) + if (config == nullptr) { return RESULT_INVALID_PARAM; } @@ -87,7 +87,7 @@ ImsMediaResult AudioStreamGraphRtpTx::update(RtpConfig* config) { IMLOGI1("[update] state[%d]", mGraphState); - if (config == NULL) + if (config == nullptr) { return RESULT_INVALID_PARAM; } @@ -100,7 +100,7 @@ ImsMediaResult AudioStreamGraphRtpTx::update(RtpConfig* config) return RESULT_SUCCESS; } - if (mConfig != NULL) + if (mConfig != nullptr) { delete mConfig; } @@ -157,7 +157,7 @@ ImsMediaResult AudioStreamGraphRtpTx::update(RtpConfig* config) bool AudioStreamGraphRtpTx::createDtmfGraph(RtpConfig* config, BaseNode* rtpEncoderNode) { - if (config == NULL) + if (config == nullptr) { return false; } @@ -182,7 +182,7 @@ bool AudioStreamGraphRtpTx::createDtmfGraph(RtpConfig* config, BaseNode* rtpEnco AddNode(pDtmfSenderNode); mListDtmfNodes.push_back(pDtmfSenderNode); - if (rtpEncoderNode != NULL) + if (rtpEncoderNode != nullptr) { pDtmfSenderNode->ConnectRearNode(rtpEncoderNode); } @@ -193,13 +193,13 @@ bool AudioStreamGraphRtpTx::createDtmfGraph(RtpConfig* config, BaseNode* rtpEnco bool AudioStreamGraphRtpTx::sendDtmf(char digit, int duration) { IMLOGD1("[sendDtmf], state[%d]", mGraphState); - BaseNode* pDTMFNode = NULL; + BaseNode* pDTMFNode = nullptr; if (!mListDtmfNodes.empty()) { pDTMFNode = mListDtmfNodes.front(); } - if (pDTMFNode != NULL && pDTMFNode->GetNodeId() == kNodeIdDtmfEncoder) + if (pDTMFNode != nullptr && pDTMFNode->GetNodeId() == kNodeIdDtmfEncoder) { IMLOGD2("[sendDtmf] %c, duration[%d]", digit, duration); ImsMediaSubType subtype = MEDIASUBTYPE_DTMF_PAYLOAD; @@ -225,7 +225,7 @@ void AudioStreamGraphRtpTx::processCmr(const uint32_t cmr) { BaseNode* node = findNode(kNodeIdAudioSource); - if (node != NULL) + if (node != nullptr) { (reinterpret_cast<IAudioSourceNode*>(node))->ProcessCmr(cmr); } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/MediaQualityAnalyzer.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/MediaQualityAnalyzer.cpp index 7fa02b5a..b89c740c 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/MediaQualityAnalyzer.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/MediaQualityAnalyzer.cpp @@ -37,7 +37,7 @@ MediaQualityAnalyzer::MediaQualityAnalyzer() { mCodecType = 0; mCodecAttribute = 0; - mCallback = NULL; + mCallback = nullptr; std::unique_ptr<RtcpXrEncoder> analyzer(new RtcpXrEncoder()); mRtcpXrEncoder = std::move(analyzer); mJitterThreshold = 0; @@ -122,7 +122,7 @@ void MediaQualityAnalyzer::stop() StopThread(); mConditionExit.wait_timeout(STOP_TIMEOUT); - if (mCallback != NULL) + if (mCallback != nullptr) { MediaQuality* quality = new MediaQuality(mMediaQuality); mCallback->SendEvent(kAudioCallQualityChangedInd, reinterpret_cast<uint64_t>(quality)); @@ -134,7 +134,7 @@ void MediaQualityAnalyzer::stop() void MediaQualityAnalyzer::collectInfo(const int32_t streamType, RtpPacket* packet) { - if (packet == NULL) + if (packet == nullptr) { return; } @@ -346,7 +346,7 @@ void MediaQualityAnalyzer::processData(const int32_t timeCount) { mMediaQuality.setRtpInactivityDetected(true); - if (mCallback != NULL) + if (mCallback != nullptr) { MediaQuality* mediaQuality = new MediaQuality(mMediaQuality); mCallback->SendEvent( @@ -373,7 +373,7 @@ void MediaQualityAnalyzer::processData(const int32_t timeCount) { mMediaQuality.setDownlinkCallQualityLevel(quality); - if (mCallback != NULL) + if (mCallback != nullptr) { MediaQuality* mediaQuality = new MediaQuality(mMediaQuality); mCallback->SendEvent( @@ -397,7 +397,7 @@ void MediaQualityAnalyzer::processData(const int32_t timeCount) IMLOGD1("[processData] lossRate[%lf]", lossRate); - if (lossRate >= mPacketLossThreshold && mCallback != NULL) + if (lossRate >= mPacketLossThreshold && mCallback != nullptr) { mCallback->SendEvent(kImsMediaEventPacketLoss, lossRate); } @@ -411,7 +411,7 @@ void MediaQualityAnalyzer::processData(const int32_t timeCount) { IMLOGD1("[processData] Jitter[%lf]", mJitterRxPacket); - if (mJitterRxPacket >= mJitterThreshold && mCallback != NULL) + if (mJitterRxPacket >= mJitterThreshold && mCallback != nullptr) { mCallback->SendEvent(kImsMediaEventNotifyJitter, mJitterRxPacket); } @@ -591,7 +591,7 @@ void* MediaQualityAnalyzer::run() IMLOGD1("[run] exit %p", this); mConditionExit.signal(); - return NULL; + return nullptr; } void MediaQualityAnalyzer::reset() diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/RtcpXrEncoder.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/RtcpXrEncoder.cpp index 3f4651d1..c0e1611e 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/RtcpXrEncoder.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/RtcpXrEncoder.cpp @@ -142,7 +142,7 @@ bool RtcpXrEncoder::createRtcpXrReport(const uint32_t rtcpXrReport, std::list<Rt { size = 0; - if (data == NULL || rtcpXrReport == RtcpConfig::FLAG_RTCPXR_NONE) + if (data == nullptr || rtcpXrReport == RtcpConfig::FLAG_RTCPXR_NONE) { return false; } @@ -159,22 +159,22 @@ bool RtcpXrEncoder::createRtcpXrReport(const uint32_t rtcpXrReport, std::list<Rt encodeStatisticSummeryReport(lossReport, jitterReport, ttlReport, duplicateReport, buffer); - if (lossReport != NULL) + if (lossReport != nullptr) { delete lossReport; } - if (jitterReport != NULL) + if (jitterReport != nullptr) { delete jitterReport; } - if (ttlReport != NULL) + if (ttlReport != nullptr) { delete ttlReport; } - if (duplicateReport != NULL) + if (duplicateReport != nullptr) { delete duplicateReport; } @@ -188,7 +188,7 @@ bool RtcpXrEncoder::createRtcpXrReport(const uint32_t rtcpXrReport, std::list<Rt encodeVoipMetricReport(voipReport, buffer + size); size += BLOCK_LENGTH_STATISTICS; - if (voipReport != NULL) + if (voipReport != nullptr) { delete voipReport; } @@ -444,8 +444,8 @@ void RtcpXrEncoder::encodeStatisticSummeryReport(tLossReport* lossReport, | min_ttl_or_hl | max_ttl_or_hl |mean_ttl_or_hl | dev_ttl_or_hl | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ - if (data == NULL || lossReport == NULL || jitterReport == NULL || ttlReport == NULL || - duplicateReport == NULL) + if (data == nullptr || lossReport == nullptr || jitterReport == nullptr || + ttlReport == nullptr || duplicateReport == nullptr) { return; } @@ -507,7 +507,7 @@ void RtcpXrEncoder::encodeStatisticSummeryReport(tLossReport* lossReport, void RtcpXrEncoder::encodeVoipMetricReport(tVoIPMatricReport* report, uint8_t* data) { - if (report == NULL || data == NULL) + if (report == nullptr || data == nullptr) { return; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/android/ImsMediaAudioPlayer.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/android/ImsMediaAudioPlayer.cpp index 5fff0beb..389f9853 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/android/ImsMediaAudioPlayer.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/android/ImsMediaAudioPlayer.cpp @@ -38,8 +38,8 @@ using namespace android; ImsMediaAudioPlayer::ImsMediaAudioPlayer() { - mAudioStream = NULL; - mCodec = NULL; + mAudioStream = nullptr; + mCodec = nullptr; mSamplingRate = DEFAULT_SAMPLING_RATE; mEvsCodecHeaderMode = kRtpPyaloadHeaderModeEvsHeaderFull; mFirstFrame = false; @@ -109,7 +109,7 @@ bool ImsMediaAudioPlayer::Start() openAudioStream(); - if (mAudioStream == NULL) + if (mAudioStream == nullptr) { IMLOGE0("[Start] create audio stream failed"); return false; @@ -126,24 +126,24 @@ bool ImsMediaAudioPlayer::Start() mCodec = AMediaCodec_createDecoderByType(kMimeType); - if (mCodec == NULL) + if (mCodec == nullptr) { IMLOGE1("[Start] unable to create %s codec instance", kMimeType); AMediaFormat_delete(mFormat); - mFormat = NULL; + mFormat = nullptr; return false; } IMLOGD0("[Start] configure codec"); - media_status_t codecResult = AMediaCodec_configure(mCodec, mFormat, NULL, NULL, 0); + media_status_t codecResult = AMediaCodec_configure(mCodec, mFormat, nullptr, nullptr, 0); if (codecResult != AMEDIA_OK) { IMLOGE2("[Start] unable to configure[%s] codec - err[%d]", kMimeType, codecResult); AMediaCodec_delete(mCodec); - mCodec = NULL; + mCodec = nullptr; AMediaFormat_delete(mFormat); - mFormat = NULL; + mFormat = nullptr; return false; } } @@ -158,9 +158,9 @@ bool ImsMediaAudioPlayer::Start() if (mCodecType == kAudioCodecAmr || mCodecType == kAudioCodecAmrWb) { AMediaCodec_delete(mCodec); - mCodec = NULL; + mCodec = nullptr; AMediaFormat_delete(mFormat); - mFormat = NULL; + mFormat = nullptr; } return false; } @@ -174,9 +174,9 @@ bool ImsMediaAudioPlayer::Start() if (mCodecType == kAudioCodecAmr || mCodecType == kAudioCodecAmrWb) { AMediaCodec_delete(mCodec); - mCodec = NULL; + mCodec = nullptr; AMediaFormat_delete(mFormat); - mFormat = NULL; + mFormat = nullptr; } return false; } @@ -190,9 +190,9 @@ bool ImsMediaAudioPlayer::Start() { IMLOGE1("[Start] unable to start codec - err[%d]", codecResult); AMediaCodec_delete(mCodec); - mCodec = NULL; + mCodec = nullptr; AMediaFormat_delete(mFormat); - mFormat = NULL; + mFormat = nullptr; return false; } } @@ -205,20 +205,20 @@ void ImsMediaAudioPlayer::Stop() { IMLOGD0("[Stop] enter"); std::lock_guard<std::mutex> guard(mMutex); - if ((mCodecType == kAudioCodecAmr || mCodecType == kAudioCodecAmrWb) && (mCodec != NULL)) + if ((mCodecType == kAudioCodecAmr || mCodecType == kAudioCodecAmrWb) && (mCodec != nullptr)) { AMediaCodec_stop(mCodec); AMediaCodec_delete(mCodec); - mCodec = NULL; + mCodec = nullptr; } - if ((mCodecType == kAudioCodecAmr || mCodecType == kAudioCodecAmrWb) && (mFormat != NULL)) + if ((mCodecType == kAudioCodecAmr || mCodecType == kAudioCodecAmrWb) && (mFormat != nullptr)) { AMediaFormat_delete(mFormat); - mFormat = NULL; + mFormat = nullptr; } - if (mAudioStream != NULL) + if (mAudioStream != nullptr) { aaudio_stream_state_t inputState = AAUDIO_STREAM_STATE_STOPPING; aaudio_stream_state_t nextState = AAUDIO_STREAM_STATE_UNINITIALIZED; @@ -241,7 +241,7 @@ void ImsMediaAudioPlayer::Stop() IMLOGI1("[Stop] stream state[%s]", AAudio_convertStreamStateToText(nextState)); AAudioStream_close(mAudioStream); - mAudioStream = NULL; + mAudioStream = nullptr; } IMLOGD0("[Stop] exit "); @@ -251,7 +251,7 @@ bool ImsMediaAudioPlayer::onDataFrame(uint8_t* buffer, uint32_t size) { std::lock_guard<std::mutex> guard(mMutex); - if (size == 0 || buffer == NULL || mAudioStream == NULL || + if (size == 0 || buffer == nullptr || mAudioStream == nullptr || AAudioStream_getState(mAudioStream) != AAUDIO_STREAM_STATE_STARTED) { return false; @@ -259,7 +259,7 @@ bool ImsMediaAudioPlayer::onDataFrame(uint8_t* buffer, uint32_t size) if (mCodecType == kAudioCodecAmr || mCodecType == kAudioCodecAmrWb) { - if (mCodec == NULL) + if (mCodec == nullptr) { return false; } @@ -284,7 +284,7 @@ bool ImsMediaAudioPlayer::decodeAmr(uint8_t* buffer, uint32_t size) { size_t bufferSize = 0; uint8_t* inputBuffer = AMediaCodec_getInputBuffer(mCodec, index, &bufferSize); - if (inputBuffer != NULL) + if (inputBuffer != nullptr) { memcpy(inputBuffer, buffer, size); IMLOGD_PACKET2(IM_PACKET_LOG_AUDIO, @@ -316,7 +316,7 @@ bool ImsMediaAudioPlayer::decodeAmr(uint8_t* buffer, uint32_t size) { size_t buffCapacity; uint8_t* buf = AMediaCodec_getOutputBuffer(mCodec, index, &buffCapacity); - if (buf != NULL && buffCapacity > 0) + if (buf != nullptr && buffCapacity > 0) { memcpy(mBuffer, buf, info.size); // call audio write @@ -332,7 +332,7 @@ bool ImsMediaAudioPlayer::decodeAmr(uint8_t* buffer, uint32_t size) } else if (index == AMEDIACODEC_INFO_OUTPUT_FORMAT_CHANGED) { - if (mFormat != NULL) + if (mFormat != nullptr) { AMediaFormat_delete(mFormat); } @@ -382,7 +382,7 @@ bool ImsMediaAudioPlayer::decodeEvs(uint8_t* buffer, uint32_t size) void ImsMediaAudioPlayer::openAudioStream() { - AAudioStreamBuilder* builder = NULL; + AAudioStreamBuilder* builder = nullptr; aaudio_result_t result = AAudio_createStreamBuilder(&builder); if (result != AAUDIO_OK) @@ -411,11 +411,11 @@ void ImsMediaAudioPlayer::openAudioStream() { IMLOGE1("[openAudioStream] Failed to openStream. Error[%s]", AAudio_convertResultToText(result)); - if (mAudioStream != NULL) + if (mAudioStream != nullptr) { AAudioStream_close(mAudioStream); } - mAudioStream = NULL; + mAudioStream = nullptr; } } @@ -423,7 +423,7 @@ void ImsMediaAudioPlayer::restartAudioStream() { std::lock_guard<std::mutex> guard(mMutex); - if (mAudioStream == NULL) + if (mAudioStream == nullptr) { return; } @@ -431,10 +431,10 @@ void ImsMediaAudioPlayer::restartAudioStream() AAudioStream_requestStop(mAudioStream); AAudioStream_close(mAudioStream); - mAudioStream = NULL; + mAudioStream = nullptr; openAudioStream(); - if (mAudioStream == NULL) + if (mAudioStream == nullptr) { return; } @@ -464,7 +464,7 @@ void ImsMediaAudioPlayer::restartAudioStream() void ImsMediaAudioPlayer::audioErrorCallback( AAudioStream* stream, void* userData, aaudio_result_t error) { - if (stream == NULL || userData == NULL) + if (stream == nullptr || userData == nullptr) { return; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/android/ImsMediaAudioSource.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/android/ImsMediaAudioSource.cpp index e127e434..3fce5b19 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/android/ImsMediaAudioSource.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/android/ImsMediaAudioSource.cpp @@ -36,10 +36,10 @@ using namespace android; ImsMediaAudioSource::ImsMediaAudioSource() { - mAudioStream = NULL; - mCodec = NULL; - mFormat = NULL; - mCallback = NULL; + mAudioStream = nullptr; + mCodec = nullptr; + mFormat = nullptr; + mCallback = nullptr; mCodecType = -1; mMode = 0; mPtime = 0; @@ -125,7 +125,7 @@ bool ImsMediaAudioSource::Start() openAudioStream(); - if (mAudioStream == NULL) + if (mAudioStream == nullptr) { IMLOGE0("[Start] create audio stream failed"); return false; @@ -143,25 +143,25 @@ bool ImsMediaAudioSource::Start() mCodec = AMediaCodec_createEncoderByType(kMimeType); - if (mCodec == NULL) + if (mCodec == nullptr) { IMLOGE1("[Start] unable to create %s codec instance", kMimeType); AMediaFormat_delete(mFormat); - mFormat = NULL; + mFormat = nullptr; return false; } IMLOGD0("[Start] configure codec"); media_status_t codecResult = AMediaCodec_configure( - mCodec, mFormat, NULL, NULL, AMEDIACODEC_CONFIGURE_FLAG_ENCODE); + mCodec, mFormat, nullptr, nullptr, AMEDIACODEC_CONFIGURE_FLAG_ENCODE); if (codecResult != AMEDIA_OK) { IMLOGE2("[Start] unable to configure[%s] codec - err[%d]", kMimeType, codecResult); AMediaCodec_delete(mCodec); - mCodec = NULL; + mCodec = nullptr; AMediaFormat_delete(mFormat); - mFormat = NULL; + mFormat = nullptr; return false; } } @@ -180,9 +180,9 @@ bool ImsMediaAudioSource::Start() if (mCodecType == kAudioCodecAmr || mCodecType == kAudioCodecAmrWb) { AMediaCodec_delete(mCodec); - mCodec = NULL; + mCodec = nullptr; AMediaFormat_delete(mFormat); - mFormat = NULL; + mFormat = nullptr; } return false; @@ -200,9 +200,9 @@ bool ImsMediaAudioSource::Start() if (mCodecType == kAudioCodecAmr || mCodecType == kAudioCodecAmrWb) { AMediaCodec_delete(mCodec); - mCodec = NULL; + mCodec = nullptr; AMediaFormat_delete(mFormat); - mFormat = NULL; + mFormat = nullptr; } return false; @@ -218,9 +218,9 @@ bool ImsMediaAudioSource::Start() { IMLOGE1("[Start] unable to start codec - err[%d]", codecResult); AMediaCodec_delete(mCodec); - mCodec = NULL; + mCodec = nullptr; AMediaFormat_delete(mFormat); - mFormat = NULL; + mFormat = nullptr; return false; } } @@ -243,7 +243,7 @@ void ImsMediaAudioSource::Stop() std::lock_guard<std::mutex> guard(mMutexUplink); - if (mAudioStream != NULL) + if (mAudioStream != nullptr) { aaudio_stream_state_t inputState = AAUDIO_STREAM_STATE_STOPPING; aaudio_stream_state_t nextState = AAUDIO_STREAM_STATE_UNINITIALIZED; @@ -266,20 +266,20 @@ void ImsMediaAudioSource::Stop() IMLOGI1("[Stop] stream state[%s]", AAudio_convertStreamStateToText(nextState)); AAudioStream_close(mAudioStream); - mAudioStream = NULL; + mAudioStream = nullptr; } - if (mCodec != NULL) + if (mCodec != nullptr) { AMediaCodec_stop(mCodec); AMediaCodec_delete(mCodec); - mCodec = NULL; + mCodec = nullptr; } - if (mFormat != NULL) + if (mFormat != nullptr) { AMediaFormat_delete(mFormat); - mFormat = NULL; + mFormat = nullptr; } } @@ -300,7 +300,7 @@ void ImsMediaAudioSource::ProcessCmr(const uint32_t cmr) void ImsMediaAudioSource::audioErrorCallback( AAudioStream* stream, void* userData, aaudio_result_t error) { - if (stream == NULL || userData == NULL) + if (stream == nullptr || userData == nullptr) { return; } @@ -337,7 +337,7 @@ void* ImsMediaAudioSource::run() break; } - if (mAudioStream != NULL && + if (mAudioStream != nullptr && AAudioStream_getState(mAudioStream) == AAUDIO_STREAM_STATE_STARTED) { aaudio_result_t readSize = AAudioStream_read(mAudioStream, buffer, mBufferSize, 0); @@ -362,7 +362,7 @@ void* ImsMediaAudioSource::run() ptsUsec = ImsMediaTimer::GetTimeInMicroSeconds() / 1000; } - if (mCallback != NULL && outputBuf[0] != 0) + if (mCallback != nullptr && outputBuf[0] != 0) { // TODO: integration with libEVS is require to encode outputBuf mCallback->onDataFrame(outputBuf, size, ptsUsec, evsFlags); @@ -387,12 +387,12 @@ void* ImsMediaAudioSource::run() } mConditionExit.signal(); - return NULL; + return nullptr; } void ImsMediaAudioSource::openAudioStream() { - AAudioStreamBuilder* builder = NULL; + AAudioStreamBuilder* builder = nullptr; aaudio_result_t result = AAudio_createStreamBuilder(&builder); if (result != AAUDIO_OK) @@ -418,7 +418,7 @@ void ImsMediaAudioSource::openAudioStream() result = AAudioStreamBuilder_openStream(builder, &mAudioStream); AAudioStreamBuilder_delete(builder); - if (result == AAUDIO_OK && mAudioStream != NULL) + if (result == AAUDIO_OK && mAudioStream != nullptr) { mBufferSize = AAudioStream_getFramesPerBurst(mAudioStream); IMLOGD3("[openAudioStream] samplingRate[%d], framesPerBurst[%d], " @@ -433,7 +433,7 @@ void ImsMediaAudioSource::openAudioStream() { IMLOGE1("[openAudioStream] Failed to openStream. Error[%s]", AAudio_convertResultToText(result)); - mAudioStream = NULL; + mAudioStream = nullptr; } } @@ -441,17 +441,17 @@ void ImsMediaAudioSource::restartAudioStream() { std::lock_guard<std::mutex> guard(mMutexUplink); - if (mAudioStream == NULL) + if (mAudioStream == nullptr) { return; } AAudioStream_requestStop(mAudioStream); AAudioStream_close(mAudioStream); - mAudioStream = NULL; + mAudioStream = nullptr; openAudioStream(); - if (mAudioStream == NULL) + if (mAudioStream == nullptr) { return; } @@ -481,7 +481,7 @@ void ImsMediaAudioSource::restartAudioStream() void ImsMediaAudioSource::queueInputBuffer(int16_t* buffer, uint32_t size) { - if (mCodec == NULL) + if (mCodec == nullptr) { return; } @@ -493,7 +493,7 @@ void ImsMediaAudioSource::queueInputBuffer(int16_t* buffer, uint32_t size) size_t bufferSize = 0; uint8_t* inputBuffer = AMediaCodec_getInputBuffer(mCodec, index, &bufferSize); - if (inputBuffer != NULL) + if (inputBuffer != nullptr) { memcpy(inputBuffer, buffer, size); IMLOGD_PACKET2(IM_PACKET_LOG_AUDIO, @@ -527,7 +527,7 @@ flags[%d]", size_t buffCapacity; uint8_t* buf = AMediaCodec_getOutputBuffer(mCodec, index, &buffCapacity); - if (mCallback != NULL) + if (mCallback != nullptr) { mCallback->onDataFrame(buf, info.size, info.presentationTimeUs, info.flags); } @@ -541,7 +541,7 @@ flags[%d]", } else if (index == AMEDIACODEC_INFO_OUTPUT_FORMAT_CHANGED) { - if (mFormat != NULL) + if (mFormat != nullptr) { AMediaFormat_delete(mFormat); } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/nodes/AudioRtpPayloadDecoderNode.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/nodes/AudioRtpPayloadDecoderNode.cpp index 538b9fd8..2525acfd 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/nodes/AudioRtpPayloadDecoderNode.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/nodes/AudioRtpPayloadDecoderNode.cpp @@ -74,7 +74,7 @@ bool AudioRtpPayloadDecoderNode::IsSourceNode() void AudioRtpPayloadDecoderNode::SetConfig(void* config) { AudioConfig* pConfig = reinterpret_cast<AudioConfig*>(config); - if (pConfig != NULL) + if (pConfig != nullptr) { mCodecType = ImsMediaAudioUtil::ConvertCodecType(pConfig->getCodecType()); if (mCodecType == kAudioCodecAmr || mCodecType == kAudioCodecAmrWb) @@ -94,7 +94,7 @@ void AudioRtpPayloadDecoderNode::SetConfig(void* config) bool AudioRtpPayloadDecoderNode::IsSameConfig(void* config) { - if (config == NULL) + if (config == nullptr) return true; AudioConfig* pConfig = reinterpret_cast<AudioConfig*>(config); @@ -125,7 +125,7 @@ void AudioRtpPayloadDecoderNode::OnDataFromFrontNode(ImsMediaSubType subtype, ui { if (subtype == MEDIASUBTYPE_REFRESHED) { - SendDataToRearNode(subtype, NULL, nDataSize, 0, 0, 0, MEDIASUBTYPE_UNDEFINED); + SendDataToRearNode(subtype, nullptr, nDataSize, 0, 0, 0, MEDIASUBTYPE_UNDEFINED); return; } @@ -154,7 +154,7 @@ void AudioRtpPayloadDecoderNode::OnDataFromFrontNode(ImsMediaSubType subtype, ui void AudioRtpPayloadDecoderNode::DecodePayloadAmr(uint8_t* pData, uint32_t nDataSize, uint32_t nTimestamp, bool bMark, uint32_t nSeqNum, uint32_t arrivalTime) { - if (pData == NULL || nDataSize == 0) + if (pData == nullptr || nDataSize == 0) { return; } @@ -258,7 +258,7 @@ void AudioRtpPayloadDecoderNode::DecodePayloadAmr(uint8_t* pData, uint32_t nData void AudioRtpPayloadDecoderNode::DecodePayloadEvs(uint8_t* pData, uint32_t nDataSize, uint32_t nTimeStamp, bool bMark, uint32_t nSeqNum, uint32_t arrivalTime) { - if (pData == NULL || nDataSize == 0) + if (pData == nullptr || nDataSize == 0) { return; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/nodes/AudioRtpPayloadEncoderNode.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/nodes/AudioRtpPayloadEncoderNode.cpp index e22f40a4..547f65ef 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/nodes/AudioRtpPayloadEncoderNode.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/nodes/AudioRtpPayloadEncoderNode.cpp @@ -117,7 +117,7 @@ void AudioRtpPayloadEncoderNode::SetConfig(void* config) { AudioConfig* pConfig = reinterpret_cast<AudioConfig*>(config); - if (pConfig != NULL) + if (pConfig != nullptr) { mCodecType = ImsMediaAudioUtil::ConvertCodecType(pConfig->getCodecType()); if (mCodecType == kAudioCodecAmr || mCodecType == kAudioCodecAmrWb) @@ -140,7 +140,7 @@ void AudioRtpPayloadEncoderNode::SetConfig(void* config) bool AudioRtpPayloadEncoderNode::IsSameConfig(void* config) { - if (config == NULL) + if (config == nullptr) return true; AudioConfig* pConfig = reinterpret_cast<AudioConfig*>(config); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/nodes/DtmfEncoderNode.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/nodes/DtmfEncoderNode.cpp index 95ef224e..a3b750e8 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/nodes/DtmfEncoderNode.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/nodes/DtmfEncoderNode.cpp @@ -79,7 +79,7 @@ void DtmfEncoderNode::SetConfig(void* config) { AudioConfig* pConfig = reinterpret_cast<AudioConfig*>(config); - if (pConfig != NULL) + if (pConfig != nullptr) { mSamplingRate = pConfig->getDtmfsamplingRateKHz(); mDuration = DTMF_DEFAULT_DURATION; @@ -91,7 +91,7 @@ void DtmfEncoderNode::SetConfig(void* config) bool DtmfEncoderNode::IsSameConfig(void* config) { - if (config == NULL) + if (config == nullptr) { return true; } @@ -119,9 +119,9 @@ void DtmfEncoderNode::OnDataFromFrontNode(ImsMediaSubType subtype, uint8_t* pDat { return; } - SendDataToRearNode(MEDIASUBTYPE_DTMFSTART, NULL, 0, 0, 0, 0); // set dtmf mode true + SendDataToRearNode(MEDIASUBTYPE_DTMFSTART, nullptr, 0, 0, 0, 0); // set dtmf mode true SendDTMFEvent(nSignal, duration); - SendDataToRearNode(MEDIASUBTYPE_DTMFEND, NULL, 0, 0, 0, 0); // set dtmf mode false + SendDataToRearNode(MEDIASUBTYPE_DTMFEND, nullptr, 0, 0, 0, 0); // set dtmf mode false } else { @@ -174,7 +174,7 @@ void* DtmfEncoderNode::run() bool bMarker = true; nPayloadSize = MakeDTMFPayload(pbPayload, mListDtmfDigit.front(), false, mVolume, nPeriod); - SendDataToRearNode(MEDIASUBTYPE_DTMFSTART, NULL, 0, 0, 0, 0); // set dtmf mode true + SendDataToRearNode(MEDIASUBTYPE_DTMFSTART, nullptr, 0, 0, 0, 0); // set dtmf mode true for (;;) { @@ -203,7 +203,7 @@ void* DtmfEncoderNode::run() } } - SendDataToRearNode(MEDIASUBTYPE_DTMFEND, NULL, 0, 0, 0, 0); + SendDataToRearNode(MEDIASUBTYPE_DTMFEND, nullptr, 0, 0, 0, 0); mListDtmfDigit.pop_front(); mMutex.unlock(); break; @@ -229,7 +229,7 @@ void* DtmfEncoderNode::run() } } } - return NULL; + return nullptr; } uint32_t DtmfEncoderNode::calculateDtmfDuration(uint32_t duration) diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/nodes/DtmfSenderNode.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/nodes/DtmfSenderNode.cpp index 8090b944..d0c75835 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/nodes/DtmfSenderNode.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/nodes/DtmfSenderNode.cpp @@ -63,7 +63,7 @@ void DtmfSenderNode::SetConfig(void* config) { AudioConfig* pConfig = reinterpret_cast<AudioConfig*>(config); - if (pConfig != NULL) + if (pConfig != nullptr) { mPtime = pConfig->getPtimeMillis(); } @@ -71,7 +71,7 @@ void DtmfSenderNode::SetConfig(void* config) bool DtmfSenderNode::IsSameConfig(void* config) { - if (config == NULL) + if (config == nullptr) { return true; } @@ -89,7 +89,7 @@ void DtmfSenderNode::ProcessData() bool bMark; uint32_t nCurrTime; - if (GetData(&subtype, &pData, &nDataSize, &nTimeStamp, &bMark, NULL) == false) + if (GetData(&subtype, &pData, &nDataSize, &nTimeStamp, &bMark, nullptr) == false) { return; } @@ -109,7 +109,7 @@ void DtmfSenderNode::ProcessData() mNextTime = nCurrTime; // send the first dtmf packet - if (GetData(&subtype, &pData, &nDataSize, &nTimeStamp, &bMark, NULL, NULL) && + if (GetData(&subtype, &pData, &nDataSize, &nTimeStamp, &bMark, nullptr, nullptr) && subtype == MEDIASUBTYPE_DTMF_PAYLOAD) { SendDataToRearNode(subtype, pData, nDataSize, nTimeStamp, bMark, 0); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/nodes/IAudioPlayerNode.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/nodes/IAudioPlayerNode.cpp index babdd891..b66822ce 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/nodes/IAudioPlayerNode.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/nodes/IAudioPlayerNode.cpp @@ -28,12 +28,12 @@ IAudioPlayerNode::IAudioPlayerNode(BaseSessionCallback* callback) : { std::unique_ptr<ImsMediaAudioPlayer> track(new ImsMediaAudioPlayer()); mAudioPlayer = std::move(track); - mConfig = NULL; + mConfig = nullptr; } IAudioPlayerNode::~IAudioPlayerNode() { - if (mConfig != NULL) + if (mConfig != nullptr) { delete mConfig; } @@ -108,15 +108,15 @@ bool IAudioPlayerNode::IsSourceNode() void IAudioPlayerNode::SetConfig(void* config) { - if (config == NULL) + if (config == nullptr) { return; } - if (mConfig != NULL) + if (mConfig != nullptr) { delete mConfig; - mConfig = NULL; + mConfig = nullptr; } mConfig = new AudioConfig(*static_cast<AudioConfig*>(config)); @@ -144,7 +144,7 @@ void IAudioPlayerNode::SetConfig(void* config) bool IAudioPlayerNode::IsSameConfig(void* config) { - if (config == NULL) + if (config == nullptr) { return true; } @@ -178,7 +178,7 @@ void* IAudioPlayerNode::run() IMLOGD0("[run] enter"); ImsMediaSubType subtype = MEDIASUBTYPE_UNDEFINED; ImsMediaSubType datatype = MEDIASUBTYPE_UNDEFINED; - uint8_t* pData = NULL; + uint8_t* pData = nullptr; uint32_t nDataSize = 0; uint32_t nTimestamp = 0; bool bMark = false; @@ -226,5 +226,5 @@ void* IAudioPlayerNode::run() ImsMediaTimer::USleep(nTime); } - return NULL; + return nullptr; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/nodes/IAudioSourceNode.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/nodes/IAudioSourceNode.cpp index 106c6020..7268f8fc 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/nodes/IAudioSourceNode.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/nodes/IAudioSourceNode.cpp @@ -103,7 +103,7 @@ bool IAudioSourceNode::IsSourceNode() void IAudioSourceNode::SetConfig(void* config) { - if (config == NULL) + if (config == nullptr) { return; } @@ -128,7 +128,7 @@ void IAudioSourceNode::SetConfig(void* config) bool IAudioSourceNode::IsSameConfig(void* config) { - if (config == NULL) + if (config == nullptr) { return true; } @@ -171,7 +171,7 @@ void IAudioSourceNode::ProcessCmr(uint32_t cmr) { IMLOGD1("[ProcessCmr] cmr[%d]", cmr); - if (mAudioSource == NULL) + if (mAudioSource == nullptr) { return; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/BaseJitterBuffer.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/BaseJitterBuffer.h index 728d4d3d..1883aecf 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/BaseJitterBuffer.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/BaseJitterBuffer.h @@ -78,7 +78,8 @@ public: * @param pnChecker */ virtual bool Get(ImsMediaSubType* psubtype, uint8_t** ppData, uint32_t* pnDataSize, - uint32_t* ptimestamp, bool* pmark, uint32_t* pnSeqNum, uint32_t* pnChecker = NULL) = 0; + uint32_t* ptimestamp, bool* pmark, uint32_t* pnSeqNum, + uint32_t* pnChecker = nullptr) = 0; protected: BaseSessionCallback* mCallback; diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/IRtpSession.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/IRtpSession.h index 538ea311..3c294a29 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/IRtpSession.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/IRtpSession.h @@ -103,7 +103,7 @@ public: void StopRtcp(); bool SendRtpPacket(uint32_t nPayloadType, uint8_t* pData, uint32_t nDataSize, uint32_t timestamp, bool mark, uint32_t nTimeDiff, bool bExtension = false, - tRtpHeaderExtensionInfo* pExtensionInfo = NULL); + tRtpHeaderExtensionInfo* pExtensionInfo = nullptr); bool ProcRtpPacket(uint8_t* pData, uint32_t nDataSize); bool ProcRtcpPacket(uint8_t* pData, uint32_t nDataSize); void OnTimer(); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/ImsMediaDefine.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/ImsMediaDefine.h index 5ed3fdb0..d2983669 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/ImsMediaDefine.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/ImsMediaDefine.h @@ -396,7 +396,7 @@ public: int rtpFd; int rtcpFd; EventParamOpenSession( - int rtp = UNDEFINED_SOCKET_FD, int rtcp = UNDEFINED_SOCKET_FD, void* config = NULL) : + int rtp = UNDEFINED_SOCKET_FD, int rtcp = UNDEFINED_SOCKET_FD, void* config = nullptr) : mConfig(config), rtpFd(rtp), rtcpFd(rtcp) @@ -600,10 +600,10 @@ struct tRtpHeaderExtensionInfo class RtpAddress { public: - RtpAddress(const char* ip = NULL, uint32_t p = 0) + RtpAddress(const char* ip = nullptr, uint32_t p = 0) { memset(this->ipAddress, 0, MAX_IP_LEN); - if (ip != NULL) + if (ip != nullptr) { std::strncpy(ipAddress, ip, MAX_IP_LEN); } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/AudioJitterBuffer.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/AudioJitterBuffer.h index bef6f69b..2ab210ce 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/AudioJitterBuffer.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/AudioJitterBuffer.h @@ -34,7 +34,7 @@ public: ImsMediaSubType nDataType = ImsMediaSubType::MEDIASUBTYPE_UNDEFINED, uint32_t arrivalTime = 0); virtual bool Get(ImsMediaSubType* psubtype, uint8_t** ppData, uint32_t* pnDataSize, - uint32_t* pnTimestamp, bool* pbMark, uint32_t* pnSeqNum, uint32_t* pnChecker = NULL); + uint32_t* pnTimestamp, bool* pbMark, uint32_t* pnSeqNum, uint32_t* pnChecker = nullptr); private: bool IsSID(uint8_t* pbBuffer, uint32_t nBufferSize); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/AudioStreamGraph.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/AudioStreamGraph.h index e7852791..8031a3fd 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/AudioStreamGraph.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/AudioStreamGraph.h @@ -26,21 +26,21 @@ class AudioStreamGraph : public BaseStreamGraph public: AudioStreamGraph(BaseSessionCallback* callback, int localFd = 0) : BaseStreamGraph(callback, localFd), - mConfig(NULL) + mConfig(nullptr) { } virtual ~AudioStreamGraph() { - if (mConfig != NULL) + if (mConfig != nullptr) { delete mConfig; - mConfig = NULL; + mConfig = nullptr; } } virtual bool isSameGraph(RtpConfig* config) { - if (config == NULL || mConfig == NULL) + if (config == nullptr || mConfig == nullptr) { return false; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/nodes/AudioRtpPayloadDecoderNode.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/nodes/AudioRtpPayloadDecoderNode.h index 1cbd94a7..469ea586 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/nodes/AudioRtpPayloadDecoderNode.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/nodes/AudioRtpPayloadDecoderNode.h @@ -30,7 +30,7 @@ class AudioRtpPayloadDecoderNode : public BaseNode { public: - AudioRtpPayloadDecoderNode(BaseSessionCallback* callback = NULL); + AudioRtpPayloadDecoderNode(BaseSessionCallback* callback = nullptr); virtual ~AudioRtpPayloadDecoderNode(); virtual kBaseNodeId GetNodeId(); virtual ImsMediaResult Start(); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/nodes/AudioRtpPayloadEncoderNode.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/nodes/AudioRtpPayloadEncoderNode.h index de991c17..28adc783 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/nodes/AudioRtpPayloadEncoderNode.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/nodes/AudioRtpPayloadEncoderNode.h @@ -23,7 +23,7 @@ class AudioRtpPayloadEncoderNode : public BaseNode { public: - AudioRtpPayloadEncoderNode(BaseSessionCallback* callback = NULL); + AudioRtpPayloadEncoderNode(BaseSessionCallback* callback = nullptr); virtual ~AudioRtpPayloadEncoderNode(); virtual kBaseNodeId GetNodeId(); virtual ImsMediaResult Start(); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/nodes/DtmfEncoderNode.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/nodes/DtmfEncoderNode.h index ad1dacc4..541ecdbf 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/nodes/DtmfEncoderNode.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/nodes/DtmfEncoderNode.h @@ -26,7 +26,7 @@ class DtmfEncoderNode : public BaseNode, IImsMediaThread { public: - DtmfEncoderNode(BaseSessionCallback* callback = NULL); + DtmfEncoderNode(BaseSessionCallback* callback = nullptr); virtual ~DtmfEncoderNode(); virtual kBaseNodeId GetNodeId(); virtual ImsMediaResult Start(); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/nodes/DtmfSenderNode.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/nodes/DtmfSenderNode.h index b2a2e522..8956b90b 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/nodes/DtmfSenderNode.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/nodes/DtmfSenderNode.h @@ -23,7 +23,7 @@ class DtmfSenderNode : public BaseNode { public: - DtmfSenderNode(BaseSessionCallback* callback = NULL); + DtmfSenderNode(BaseSessionCallback* callback = nullptr); virtual ~DtmfSenderNode(); virtual kBaseNodeId GetNodeId(); virtual ImsMediaResult Start(); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/nodes/IAudioPlayerNode.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/nodes/IAudioPlayerNode.h index 2266c981..8cd0e3cc 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/nodes/IAudioPlayerNode.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/nodes/IAudioPlayerNode.h @@ -31,7 +31,7 @@ class IAudioPlayerNode : public JitterBufferControlNode, IImsMediaThread { public: - IAudioPlayerNode(BaseSessionCallback* callback = NULL); + IAudioPlayerNode(BaseSessionCallback* callback = nullptr); virtual ~IAudioPlayerNode(); virtual kBaseNodeId GetNodeId(); virtual ImsMediaResult Start(); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/nodes/IAudioSourceNode.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/nodes/IAudioSourceNode.h index 28a224e5..e96ac672 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/nodes/IAudioSourceNode.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/nodes/IAudioSourceNode.h @@ -27,7 +27,7 @@ class IAudioSourceNode : public BaseNode, IFrameCallback { public: - IAudioSourceNode(BaseSessionCallback* callback = NULL); + IAudioSourceNode(BaseSessionCallback* callback = nullptr); virtual ~IAudioSourceNode(); virtual kBaseNodeId GetNodeId(); virtual ImsMediaResult Start(); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/nodes/BaseNode.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/nodes/BaseNode.h index 156d16f1..78dde778 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/nodes/BaseNode.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/nodes/BaseNode.h @@ -71,7 +71,7 @@ enum kBaseNodeId class BaseNode { public: - BaseNode(BaseSessionCallback* callback = NULL); + BaseNode(BaseSessionCallback* callback = nullptr); virtual ~BaseNode(); /** * @brief Sets the BaseSession callback listener @@ -224,8 +224,8 @@ public: * @return false Fails to gets the valid data */ virtual bool GetData(ImsMediaSubType* subtype, uint8_t** data, uint32_t* dataSize, - uint32_t* timestamp, bool* mark, uint32_t* seq, ImsMediaSubType* dataType = NULL, - uint32_t* arrivalTime = NULL); + uint32_t* timestamp, bool* mark, uint32_t* seq, ImsMediaSubType* dataType = nullptr, + uint32_t* arrivalTime = nullptr); /** * @brief Deletes the data stored in the front of the data queue diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/nodes/JitterBufferControlNode.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/nodes/JitterBufferControlNode.h index 39b11453..e794ce13 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/nodes/JitterBufferControlNode.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/nodes/JitterBufferControlNode.h @@ -24,7 +24,7 @@ class JitterBufferControlNode : public BaseNode { public: JitterBufferControlNode( - BaseSessionCallback* callback = NULL, ImsMediaType type = IMS_MEDIA_AUDIO); + BaseSessionCallback* callback = nullptr, ImsMediaType type = IMS_MEDIA_AUDIO); virtual ~JitterBufferControlNode(); void SetJitterBufferSize(uint32_t nInit, uint32_t nMin, uint32_t nMax); void SetJitterOptions(uint32_t nReduceTH, uint32_t nStepSize, double zValue, bool bIgnoreSID, @@ -37,7 +37,7 @@ public: uint32_t arrivalTime = 0); virtual bool GetData(ImsMediaSubType* psubtype, uint8_t** ppData, uint32_t* pnDataSize, uint32_t* ptimestamp, bool* pmark, uint32_t* pnSeqNum, - ImsMediaSubType* pnDataType = NULL, uint32_t* arrivalTime = NULL); + ImsMediaSubType* pnDataType = nullptr, uint32_t* arrivalTime = nullptr); virtual void DeleteData(); private: diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/nodes/RtcpDecoderNode.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/nodes/RtcpDecoderNode.h index b655837f..77c60906 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/nodes/RtcpDecoderNode.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/nodes/RtcpDecoderNode.h @@ -24,7 +24,7 @@ class RtcpDecoderNode : public BaseNode, public IRtcpDecoderListener { public: - RtcpDecoderNode(BaseSessionCallback* callback = NULL); + RtcpDecoderNode(BaseSessionCallback* callback = nullptr); virtual ~RtcpDecoderNode(); virtual kBaseNodeId GetNodeId(); virtual ImsMediaResult Start(); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/nodes/RtcpEncoderNode.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/nodes/RtcpEncoderNode.h index 26d4053e..5693f2c9 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/nodes/RtcpEncoderNode.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/nodes/RtcpEncoderNode.h @@ -30,7 +30,7 @@ class RtcpEncoderNode : public BaseNode, public IRtcpEncoderListener { public: - RtcpEncoderNode(BaseSessionCallback* callback = NULL); + RtcpEncoderNode(BaseSessionCallback* callback = nullptr); ~RtcpEncoderNode(); static void OnTimer(hTimerHandler hTimer, void* pUserData); virtual kBaseNodeId GetNodeId(); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/nodes/RtpDecoderNode.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/nodes/RtpDecoderNode.h index 2c460868..53176f71 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/nodes/RtpDecoderNode.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/nodes/RtpDecoderNode.h @@ -34,7 +34,7 @@ class RtpDecoderNode : public BaseNode, public IRtpDecoderListener { public: - RtpDecoderNode(BaseSessionCallback* callback = NULL); + RtpDecoderNode(BaseSessionCallback* callback = nullptr); virtual ~RtpDecoderNode(); virtual kBaseNodeId GetNodeId(); virtual ImsMediaResult Start(); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/nodes/RtpEncoderNode.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/nodes/RtpEncoderNode.h index 15dde732..d134f435 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/nodes/RtpEncoderNode.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/nodes/RtpEncoderNode.h @@ -24,7 +24,7 @@ class RtpEncoderNode : public BaseNode, public IRtpEncoderListener { public: - RtpEncoderNode(BaseSessionCallback* callback = NULL); + RtpEncoderNode(BaseSessionCallback* callback = nullptr); virtual ~RtpEncoderNode(); virtual kBaseNodeId GetNodeId(); virtual ImsMediaResult Start(); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/nodes/SocketReaderNode.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/nodes/SocketReaderNode.h index 6cbb156c..0f530953 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/nodes/SocketReaderNode.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/nodes/SocketReaderNode.h @@ -24,7 +24,7 @@ class SocketReaderNode : public BaseNode, public ISocketListener { public: - SocketReaderNode(BaseSessionCallback* callback = NULL); + SocketReaderNode(BaseSessionCallback* callback = nullptr); virtual ~SocketReaderNode(); virtual kBaseNodeId GetNodeId(); virtual ImsMediaResult Start(); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/nodes/SocketWriterNode.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/nodes/SocketWriterNode.h index a79662ba..3ef549e4 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/nodes/SocketWriterNode.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/nodes/SocketWriterNode.h @@ -23,7 +23,7 @@ class SocketWriterNode : public BaseNode { public: - SocketWriterNode(BaseSessionCallback* callback = NULL); + SocketWriterNode(BaseSessionCallback* callback = nullptr); virtual ~SocketWriterNode(); virtual kBaseNodeId GetNodeId(); virtual ImsMediaResult Start(); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/text/TextJitterBuffer.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/text/TextJitterBuffer.h index bc0957b2..0cab794c 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/text/TextJitterBuffer.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/text/TextJitterBuffer.h @@ -30,7 +30,7 @@ public: ImsMediaSubType dataType = ImsMediaSubType::MEDIASUBTYPE_UNDEFINED, uint32_t arrivalTime = 0); virtual bool Get(ImsMediaSubType* subtype, uint8_t** data, uint32_t* dataSize, - uint32_t* timestamp, bool* mark, uint32_t* seqNum, uint32_t* checker = NULL); + uint32_t* timestamp, bool* mark, uint32_t* seqNum, uint32_t* checker = nullptr); virtual void Delete(); }; diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/text/TextStreamGraph.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/text/TextStreamGraph.h index 36c3ff35..87453b0a 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/text/TextStreamGraph.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/text/TextStreamGraph.h @@ -26,21 +26,21 @@ class TextStreamGraph : public BaseStreamGraph public: TextStreamGraph(BaseSessionCallback* callback, int localFd = 0) : BaseStreamGraph(callback, localFd), - mConfig(NULL) + mConfig(nullptr) { } virtual ~TextStreamGraph() { - if (mConfig != NULL) + if (mConfig != nullptr) { delete mConfig; - mConfig = NULL; + mConfig = nullptr; } } virtual bool isSameGraph(RtpConfig* config) { - if (config == NULL || mConfig == NULL) + if (config == nullptr || mConfig == nullptr) { return false; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/text/nodes/TextRendererNode.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/text/nodes/TextRendererNode.h index aa968ca4..80338641 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/text/nodes/TextRendererNode.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/text/nodes/TextRendererNode.h @@ -25,7 +25,7 @@ class TextRendererNode : public JitterBufferControlNode { public: - TextRendererNode(BaseSessionCallback* callback = NULL); + TextRendererNode(BaseSessionCallback* callback = nullptr); virtual ~TextRendererNode(); virtual kBaseNodeId GetNodeId(); virtual ImsMediaResult Start(); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/text/nodes/TextRtpPayloadDecoderNode.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/text/nodes/TextRtpPayloadDecoderNode.h index 13b881a3..c8b0292d 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/text/nodes/TextRtpPayloadDecoderNode.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/text/nodes/TextRtpPayloadDecoderNode.h @@ -24,7 +24,7 @@ class TextRtpPayloadDecoderNode : public BaseNode { public: - TextRtpPayloadDecoderNode(BaseSessionCallback* callback = NULL); + TextRtpPayloadDecoderNode(BaseSessionCallback* callback = nullptr); virtual ~TextRtpPayloadDecoderNode(); virtual kBaseNodeId GetNodeId(); virtual ImsMediaResult Start(); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/text/nodes/TextRtpPayloadEncoderNode.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/text/nodes/TextRtpPayloadEncoderNode.h index 83ec6df5..c18a620b 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/text/nodes/TextRtpPayloadEncoderNode.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/text/nodes/TextRtpPayloadEncoderNode.h @@ -24,7 +24,7 @@ class TextRtpPayloadEncoderNode : public BaseNode { public: - TextRtpPayloadEncoderNode(BaseSessionCallback* callback = NULL); + TextRtpPayloadEncoderNode(BaseSessionCallback* callback = nullptr); virtual ~TextRtpPayloadEncoderNode(); virtual kBaseNodeId GetNodeId(); virtual ImsMediaResult Start(); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/text/nodes/TextSourceNode.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/text/nodes/TextSourceNode.h index 48f86bb7..5b61a77e 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/text/nodes/TextSourceNode.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/text/nodes/TextSourceNode.h @@ -26,7 +26,7 @@ class TextSourceNode : public BaseNode { public: - TextSourceNode(BaseSessionCallback* callback = NULL); + TextSourceNode(BaseSessionCallback* callback = nullptr); virtual ~TextSourceNode(); virtual kBaseNodeId GetNodeId(); virtual ImsMediaResult Start(); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/utils/ImsMediaDataQueue.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/utils/ImsMediaDataQueue.h index 82bfcc98..fcc710e6 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/utils/ImsMediaDataQueue.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/utils/ImsMediaDataQueue.h @@ -27,7 +27,7 @@ class DataEntry public: DataEntry() { - pbBuffer = NULL; + pbBuffer = nullptr; nBufferSize = 0; nTimestamp = 0; bMark = false; @@ -41,7 +41,7 @@ public: DataEntry(const DataEntry& entry) { - if (entry.nBufferSize > 0 && entry.pbBuffer != NULL) + if (entry.nBufferSize > 0 && entry.pbBuffer != nullptr) { pbBuffer = new uint8_t[entry.nBufferSize]; memcpy(pbBuffer, entry.pbBuffer, entry.nBufferSize); @@ -62,7 +62,7 @@ public: void deleteBuffer() { - if (pbBuffer != NULL) + if (pbBuffer != nullptr) { delete[] pbBuffer; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/VideoJitterBuffer.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/VideoJitterBuffer.h index 8bd27985..3316f85c 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/VideoJitterBuffer.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/VideoJitterBuffer.h @@ -45,7 +45,7 @@ public: uint32_t nTimeStamp, bool mark, uint32_t nSeqNum, ImsMediaSubType nDataType, uint32_t arrivalTime); virtual bool Get(ImsMediaSubType* pImsMediaSubType, uint8_t** ppData, uint32_t* pnDataSize, - uint32_t* pnTimeStamp, bool* pmark, uint32_t* pnSeqNum, uint32_t* pnChecker = NULL); + uint32_t* pnTimeStamp, bool* pmark, uint32_t* pnSeqNum, uint32_t* pnChecker = nullptr); /** * @brief Set the video codec type diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/VideoStreamGraph.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/VideoStreamGraph.h index c0b45770..aef426f5 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/VideoStreamGraph.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/VideoStreamGraph.h @@ -26,22 +26,22 @@ class VideoStreamGraph : public BaseStreamGraph public: VideoStreamGraph(BaseSessionCallback* callback, int localFd = 0) : BaseStreamGraph(callback, localFd), - mConfig(NULL) + mConfig(nullptr) { } virtual ~VideoStreamGraph() { - if (mConfig != NULL) + if (mConfig != nullptr) { delete mConfig; - mConfig = NULL; + mConfig = nullptr; } } virtual bool isSameGraph(RtpConfig* config) { - if (config == NULL || mConfig == NULL) + if (config == nullptr || mConfig == nullptr) { return false; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/android/ImsMediaCamera.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/android/ImsMediaCamera.h index 7da26597..b77bc135 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/android/ImsMediaCamera.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/android/ImsMediaCamera.h @@ -43,13 +43,13 @@ public: int32_t mFacing; bool mAvailable; bool mOwner; - explicit CameraId(const char* id = NULL) : - mDevice(NULL), + explicit CameraId(const char* id = nullptr) : + mDevice(nullptr), mFacing(ACAMERA_LENS_FACING_FRONT), mAvailable(false), mOwner(false) { - mId = (id != NULL) ? id : ""; + mId = (id != nullptr) ? id : ""; } CameraId& operator=(const CameraId& camera) @@ -100,7 +100,7 @@ public: outputNativeWindows.clear(); sessionOutputs.clear(); targets.clear(); - request = NULL; + request = nullptr; sessionSequenceId = -1; } std::vector<ANativeWindow*> outputNativeWindows; diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/android/ImsMediaVideoRenderer.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/android/ImsMediaVideoRenderer.h index 098a017c..9ac6c37e 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/android/ImsMediaVideoRenderer.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/android/ImsMediaVideoRenderer.h @@ -29,12 +29,12 @@ struct FrameData { public: - FrameData( - uint8_t* data = NULL, uint32_t size = 0, uint32_t timestamp = 0, bool isConfig = false) + FrameData(uint8_t* data = nullptr, uint32_t size = 0, uint32_t timestamp = 0, + bool isConfig = false) { - this->data = NULL; + this->data = nullptr; - if (size != 0 && data != NULL) + if (size != 0 && data != nullptr) { this->data = new uint8_t[size]; memcpy(this->data, data, size); @@ -47,7 +47,7 @@ public: ~FrameData() { - if (data != NULL) + if (data != nullptr) { delete[] data; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/nodes/IVideoRendererNode.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/nodes/IVideoRendererNode.h index d32f901c..caa54322 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/nodes/IVideoRendererNode.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/nodes/IVideoRendererNode.h @@ -35,7 +35,7 @@ class IVideoRendererNode : public JitterBufferControlNode { public: - IVideoRendererNode(BaseSessionCallback* callback = NULL); + IVideoRendererNode(BaseSessionCallback* callback = nullptr); virtual ~IVideoRendererNode(); virtual kBaseNodeId GetNodeId(); virtual ImsMediaResult Start(); @@ -70,8 +70,8 @@ public: private: bool IsIntraFrame(uint8_t* pbBuffer, uint32_t nBufferSize); - bool IsConfigFrame(uint8_t* pbBuffer, uint32_t nBufferSize, uint32_t* nBufferOffset = NULL); - bool IsSps(uint8_t* pbBuffer, uint32_t nBufferSize, uint32_t* nBufferOffset = NULL); + bool IsConfigFrame(uint8_t* pbBuffer, uint32_t nBufferSize, uint32_t* nBufferOffset = nullptr); + bool IsSps(uint8_t* pbBuffer, uint32_t nBufferSize, uint32_t* nBufferOffset = nullptr); void SaveConfigFrame(uint8_t* pbBuffer, uint32_t nBufferSize, uint32_t type); /** * @brief Remove Access Uint Delimiter Nal Unit. diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/nodes/IVideoSourceNode.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/nodes/IVideoSourceNode.h index 7a6c2ed4..bcc43d5b 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/nodes/IVideoSourceNode.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/nodes/IVideoSourceNode.h @@ -28,7 +28,7 @@ class IVideoSourceNode : public BaseNode, IVideoSourceCallback { public: - IVideoSourceNode(BaseSessionCallback* callback = NULL); + IVideoSourceNode(BaseSessionCallback* callback = nullptr); virtual ~IVideoSourceNode(); virtual kBaseNodeId GetNodeId(); virtual ImsMediaResult Start(); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/nodes/VideoRtpPayloadDecoderNode.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/nodes/VideoRtpPayloadDecoderNode.h index 796f9aac..42072cc7 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/nodes/VideoRtpPayloadDecoderNode.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/nodes/VideoRtpPayloadDecoderNode.h @@ -23,7 +23,7 @@ class VideoRtpPayloadDecoderNode : public BaseNode { public: - VideoRtpPayloadDecoderNode(BaseSessionCallback* callback = NULL); + VideoRtpPayloadDecoderNode(BaseSessionCallback* callback = nullptr); virtual ~VideoRtpPayloadDecoderNode(); virtual kBaseNodeId GetNodeId(); virtual ImsMediaResult Start(); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/nodes/VideoRtpPayloadEncoderNode.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/nodes/VideoRtpPayloadEncoderNode.h index e5f60eb6..eeab0cc7 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/nodes/VideoRtpPayloadEncoderNode.h +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/nodes/VideoRtpPayloadEncoderNode.h @@ -29,7 +29,7 @@ class VideoRtpPayloadEncoderNode : public BaseNode { public: - VideoRtpPayloadEncoderNode(BaseSessionCallback* callback = NULL); + VideoRtpPayloadEncoderNode(BaseSessionCallback* callback = nullptr); virtual ~VideoRtpPayloadEncoderNode(); virtual kBaseNodeId GetNodeId(); virtual ImsMediaResult Start(); @@ -44,8 +44,8 @@ public: private: bool ResetStartTime(); - uint8_t* FindAvcStartCode(uint8_t* pData, uint32_t nDataSize, uint32_t* pnSkipSize = NULL); - uint8_t* FindHevcStartCode(uint8_t* pData, uint32_t nDataSize, uint32_t* pnSkipSize = NULL); + uint8_t* FindAvcStartCode(uint8_t* pData, uint32_t nDataSize, uint32_t* pnSkipSize = nullptr); + uint8_t* FindHevcStartCode(uint8_t* pData, uint32_t nDataSize, uint32_t* pnSkipSize = nullptr); void EncodeAvc(uint8_t* pData, uint32_t nDataSize, uint32_t nTimeStamp, bool bMark); /** h.264 start coded has been removed at EncodeAvc() * pData starts with nal unit header */ diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/BaseNode.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/BaseNode.cpp index ddb45534..ff8c7660 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/BaseNode.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/BaseNode.cpp @@ -45,7 +45,7 @@ static std::vector<NODE_ID_PAIR> vectorNodeId{ BaseNode::BaseNode(BaseSessionCallback* callback) { - mScheduler = NULL; + mScheduler = nullptr; mCallback = callback; mNodeState = kNodeStateStopped; mMediaType = IMS_MEDIA_AUDIO; @@ -71,7 +71,7 @@ void BaseNode::SetSchedulerCallback(std::shared_ptr<StreamSchedulerCallback>& ca void BaseNode::ConnectRearNode(BaseNode* pRearNode) { - if (pRearNode == NULL) + if (pRearNode == nullptr) { return; } @@ -168,7 +168,7 @@ const char* BaseNode::GetNodeName() } } - return NULL; + return nullptr; } void BaseNode::SetMediaType(ImsMediaType eType) @@ -228,7 +228,7 @@ bool BaseNode::GetData(ImsMediaSubType* psubtype, uint8_t** ppData, uint32_t* pn if (psubtype) *psubtype = MEDIASUBTYPE_UNDEFINED; if (ppData) - *ppData = NULL; + *ppData = nullptr; if (pnDataSize) *pnDataSize = 0; if (pnTimestamp) @@ -258,7 +258,7 @@ void BaseNode::SendDataToRearNode(ImsMediaSubType subtype, uint8_t* pData, uint3 for (auto& node : mListRearNodes) { - if (node != NULL && node->GetState() == kNodeStateRunning) + if (node != nullptr && node->GetState() == kNodeStateRunning) { node->OnDataFromFrontNode( subtype, pData, nDataSize, nTimestamp, bMark, nSeqNum, nDataType, arrivalTime); @@ -270,7 +270,7 @@ void BaseNode::SendDataToRearNode(ImsMediaSubType subtype, uint8_t* pData, uint3 } } - if (nNeedRunCount == true && mScheduler != NULL) + if (nNeedRunCount == true && mScheduler != nullptr) { mScheduler->onAwakeScheduler(); } @@ -295,7 +295,7 @@ void BaseNode::OnDataFromFrontNode(ImsMediaSubType subtype, uint8_t* pData, uint void BaseNode::DisconnectRearNode(BaseNode* pRearNode) { - if (pRearNode == NULL) + if (pRearNode == nullptr) { mListRearNodes.pop_back(); return; @@ -310,7 +310,7 @@ void BaseNode::DisconnectRearNode(BaseNode* pRearNode) void BaseNode::DisconnectFrontNode(BaseNode* pFrontNode) { - if (pFrontNode == NULL) + if (pFrontNode == nullptr) { mListFrontNodes.pop_back(); return; diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/JitterBufferControlNode.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/JitterBufferControlNode.cpp index f5b868c4..76b82284 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/JitterBufferControlNode.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/JitterBufferControlNode.cpp @@ -42,7 +42,7 @@ JitterBufferControlNode::JitterBufferControlNode(BaseSessionCallback* callback, JitterBufferControlNode::~JitterBufferControlNode() { - if (mJitterBuffer != NULL) + if (mJitterBuffer != nullptr) { delete mJitterBuffer; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/RtcpDecoderNode.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/RtcpDecoderNode.cpp index 8326d8dc..863b44f4 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/RtcpDecoderNode.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/RtcpDecoderNode.cpp @@ -21,18 +21,18 @@ RtcpDecoderNode::RtcpDecoderNode(BaseSessionCallback* callback) : BaseNode(callback) { - mRtpSession = NULL; + mRtpSession = nullptr; mInactivityTime = 0; mNoRtcpTime = 0; } RtcpDecoderNode::~RtcpDecoderNode() { - if (mRtpSession != NULL) + if (mRtpSession != nullptr) { - mRtpSession->SetRtcpEncoderListener(NULL); + mRtpSession->SetRtcpEncoderListener(nullptr); IRtpSession::ReleaseInstance(mRtpSession); - mRtpSession = NULL; + mRtpSession = nullptr; } } @@ -45,11 +45,11 @@ ImsMediaResult RtcpDecoderNode::Start() { IMLOGD0("[Start]"); - if (mRtpSession == NULL) + if (mRtpSession == nullptr) { mRtpSession = IRtpSession::GetInstance(mMediaType, mLocalAddress, mPeerAddress); - if (mRtpSession == NULL) + if (mRtpSession == nullptr) { IMLOGE0("[Start] Can't create rtp session"); return RESULT_NOT_READY; @@ -99,7 +99,7 @@ bool RtcpDecoderNode::IsSourceNode() void RtcpDecoderNode::SetConfig(void* config) { - if (config == NULL) + if (config == nullptr) { return; } @@ -111,7 +111,7 @@ void RtcpDecoderNode::SetConfig(void* config) bool RtcpDecoderNode::IsSameConfig(void* config) { - if (config == NULL) + if (config == nullptr) { return true; } @@ -125,7 +125,7 @@ bool RtcpDecoderNode::IsSameConfig(void* config) void RtcpDecoderNode::OnRtcpInd(tRtpSvc_IndicationFromStack type, void* data) { - if (data == NULL) + if (data == nullptr) { return; } @@ -206,7 +206,7 @@ void RtcpDecoderNode::OnNumReceivedPacket(uint32_t nNumRtcpSRPacket, uint32_t nN if (mInactivityTime != 0 && mNoRtcpTime == mInactivityTime) { - if (mCallback != NULL) + if (mCallback != nullptr) { mCallback->SendEvent(kImsMediaEventMediaInactivity, kProtocolRtcp, mInactivityTime); } @@ -237,7 +237,7 @@ void RtcpDecoderNode::SetInactivityTimerSec(const uint32_t time) void RtcpDecoderNode::ReceiveTmmbr(const tRtpSvcIndSt_ReceiveRtcpFeedbackInd* payload) { - if (payload == NULL || payload->pMsg == NULL || mCallback == NULL) + if (payload == nullptr || payload->pMsg == nullptr || mCallback == nullptr) { return; } @@ -272,7 +272,7 @@ void RtcpDecoderNode::RequestIdrFrame() { IMLOGD0("[RequestIdrFrame]"); - if (mCallback != NULL) + if (mCallback != nullptr) { mCallback->SendEvent(kRequestVideoIdrFrame, 0); } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/RtcpEncoderNode.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/RtcpEncoderNode.cpp index 3b0b0254..35b4acb8 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/RtcpEncoderNode.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/RtcpEncoderNode.cpp @@ -23,25 +23,25 @@ RtcpEncoderNode::RtcpEncoderNode(BaseSessionCallback* callback) : BaseNode(callback) { - mRtpSession = NULL; + mRtpSession = nullptr; mRtcpInterval = 0; - mRtcpXrPayload = NULL; + mRtcpXrPayload = nullptr; mEnableRtcpBye = false; mRtcpXrBlockTypes = RtcpConfig::FLAG_RTCPXR_NONE; mRtcpXrCounter = 0; - mTimer = NULL; + mTimer = nullptr; mLastTimeSentPli = 0; mLastTimeSentFir = 0; } RtcpEncoderNode::~RtcpEncoderNode() { - if (mRtpSession != NULL) + if (mRtpSession != nullptr) { mRtpSession->StopRtcp(); - mRtpSession->SetRtcpEncoderListener(NULL); + mRtpSession->SetRtcpEncoderListener(nullptr); IRtpSession::ReleaseInstance(mRtpSession); - mRtpSession = NULL; + mRtpSession = nullptr; } mRtcpXrBlockTypes = RtcpConfig::FLAG_RTCPXR_NONE; @@ -57,11 +57,11 @@ ImsMediaResult RtcpEncoderNode::Start() { std::lock_guard<std::mutex> guard(mMutexTimer); - if (mRtpSession == NULL) + if (mRtpSession == nullptr) { mRtpSession = IRtpSession::GetInstance(mMediaType, mLocalAddress, mPeerAddress); - if (mRtpSession == NULL) + if (mRtpSession == nullptr) { IMLOGE0("[Start] Can't create rtp session"); return RESULT_NOT_READY; @@ -78,7 +78,7 @@ ImsMediaResult RtcpEncoderNode::Start() mRtpSession->StartRtcp(mEnableRtcpBye); } - if (mTimer == NULL) + if (mTimer == nullptr) { mTimer = ImsMediaTimer::TimerStart(1000, true, OnTimer, this); IMLOGD0("[Start] Rtcp Timer started"); @@ -94,15 +94,15 @@ void RtcpEncoderNode::Stop() IMLOGD0("[Stop]"); std::lock_guard<std::mutex> guard(mMutexTimer); - if (mRtpSession != NULL) + if (mRtpSession != nullptr) { mRtpSession->StopRtcp(); } - if (mTimer != NULL) + if (mTimer != nullptr) { - ImsMediaTimer::TimerStop(mTimer, NULL); - mTimer = NULL; + ImsMediaTimer::TimerStop(mTimer, nullptr); + mTimer = nullptr; IMLOGD0("[Stop] Rtcp Timer stopped"); } @@ -140,7 +140,7 @@ void RtcpEncoderNode::SetConfig(void* config) bool RtcpEncoderNode::IsSameConfig(void* config) { - if (config == NULL) + if (config == nullptr) { return true; } @@ -206,7 +206,7 @@ void RtcpEncoderNode::OnTimer(hTimerHandler hTimer, void* pUserData) (void)hTimer; RtcpEncoderNode* pNode = reinterpret_cast<RtcpEncoderNode*>(pUserData); - if (pNode != NULL) + if (pNode != nullptr) { pNode->ProcessTimer(); } @@ -216,7 +216,7 @@ void RtcpEncoderNode::ProcessTimer() { std::lock_guard<std::mutex> guard(mMutexTimer); - if (mTimer == NULL || mRtpSession == NULL) + if (mTimer == nullptr || mRtpSession == nullptr) { return; } @@ -243,7 +243,7 @@ void RtcpEncoderNode::SetPeerAddress(const RtpAddress& address) bool RtcpEncoderNode::SendNack(NackParams* param) { - if (param == NULL) + if (param == nullptr) { return false; } @@ -268,7 +268,7 @@ bool RtcpEncoderNode::SendNack(NackParams* param) if (param->bNackReport) { - if (mRtpSession != NULL) + if (mRtpSession != nullptr) { return mRtpSession->SendRtcpFeedback(kRtpFbNack, pNackBuff, 4); } @@ -280,7 +280,7 @@ bool RtcpEncoderNode::SendNack(NackParams* param) bool RtcpEncoderNode::SendPictureLost(const uint32_t type) { - if (mRtpSession == NULL) + if (mRtpSession == nullptr) { return false; } @@ -294,7 +294,7 @@ bool RtcpEncoderNode::SendPictureLost(const uint32_t type) if (mLastTimeSentPli == 0 || (mLastTimeSentPli + RTCPFBMNGR_PLI_FIR_REQUEST_MIN_INTERVAL < nCurrentTime)) { - if (mRtpSession->SendRtcpFeedback(kPsfbPli, NULL, 0)) + if (mRtpSession->SendRtcpFeedback(kPsfbPli, nullptr, 0)) { mLastTimeSentPli = nCurrentTime; return true; @@ -306,7 +306,7 @@ bool RtcpEncoderNode::SendPictureLost(const uint32_t type) if (mLastTimeSentFir == 0 || (mLastTimeSentFir + RTCPFBMNGR_PLI_FIR_REQUEST_MIN_INTERVAL < nCurrentTime)) { - if (mRtpSession->SendRtcpFeedback(kPsfbFir, NULL, 0)) + if (mRtpSession->SendRtcpFeedback(kPsfbFir, nullptr, 0)) { mLastTimeSentFir = nCurrentTime; return true; @@ -319,7 +319,7 @@ bool RtcpEncoderNode::SendPictureLost(const uint32_t type) bool RtcpEncoderNode::SendTmmbrn(const uint32_t type, TmmbrParams* param) { - if (mRtpSession == NULL || param == NULL) + if (mRtpSession == nullptr || param == nullptr) { return false; } @@ -361,7 +361,7 @@ bool RtcpEncoderNode::SendTmmbrn(const uint32_t type, TmmbrParams* param) bool RtcpEncoderNode::SendRtcpXr(uint8_t* data, uint32_t size) { - if (data == NULL || mRtpSession == NULL) + if (data == nullptr || mRtpSession == nullptr) { return false; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/RtpDecoderNode.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/RtpDecoderNode.cpp index 29fcba32..cffb014c 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/RtpDecoderNode.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/RtpDecoderNode.cpp @@ -44,7 +44,7 @@ RtpDecoderNode::RtpDecoderNode(BaseSessionCallback* callback) : BaseNode(callback) { - mRtpSession = NULL; + mRtpSession = nullptr; mReceivingSSRC = 0; mInactivityTime = 0; mNoRtpTime = 0; @@ -74,9 +74,9 @@ RtpDecoderNode::~RtpDecoderNode() if (mRtpSession) { mRtpSession->StopRtp(); - mRtpSession->SetRtpDecoderListener(NULL); + mRtpSession->SetRtpDecoderListener(nullptr); IRtpSession::ReleaseInstance(mRtpSession); - mRtpSession = NULL; + mRtpSession = nullptr; } } @@ -95,11 +95,11 @@ ImsMediaResult RtpDecoderNode::Start() return RESULT_INVALID_PARAM; } - if (mRtpSession == NULL) + if (mRtpSession == nullptr) { mRtpSession = IRtpSession::GetInstance(mMediaType, mLocalAddress, mPeerAddress); - if (mRtpSession == NULL) + if (mRtpSession == nullptr) { IMLOGE0("[Start] - Can't create rtp session"); return RESULT_NOT_READY; @@ -303,7 +303,7 @@ void RtpDecoderNode::SetConfig(void* config) { IMLOGD1("[SetConfig] type[%d]", mMediaType); - if (config == NULL) + if (config == nullptr) { return; } @@ -343,7 +343,7 @@ void RtpDecoderNode::SetConfig(void* config) bool RtpDecoderNode::IsSameConfig(void* config) { - if (config == NULL) + if (config == nullptr) { return true; } @@ -411,7 +411,7 @@ void RtpDecoderNode::OnMediaDataInd(unsigned char* data, uint32_t datasize, uint IMLOGD3("[OnMediaDataInd] media[%d] SSRC changed, [%x] -> [%x]", mMediaType, mReceivingSSRC, ssrc); mReceivingSSRC = ssrc; - SendDataToRearNode(MEDIASUBTYPE_REFRESHED, NULL, mReceivingSSRC, 0, 0, 0); + SendDataToRearNode(MEDIASUBTYPE_REFRESHED, nullptr, mReceivingSSRC, 0, 0, 0); } /** TODO : add checking receiving dtmf by the payload type number */ @@ -501,7 +501,7 @@ void RtpDecoderNode::OnNumReceivedPacket(uint32_t nNumRtpPacket) if (mInactivityTime != 0 && mNoRtpTime == mInactivityTime) { - if (mCallback != NULL) + if (mCallback != nullptr) { mCallback->SendEvent(kImsMediaEventMediaInactivity, kProtocolRtp, mInactivityTime); } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/RtpEncoderNode.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/RtpEncoderNode.cpp index 56c4dacd..ff45e252 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/RtpEncoderNode.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/RtpEncoderNode.cpp @@ -26,7 +26,7 @@ RtpEncoderNode::RtpEncoderNode(BaseSessionCallback* callback) : BaseNode(callback) { - mRtpSession = NULL; + mRtpSession = nullptr; mDTMFMode = false; mMark = false; mPrevTimestamp = 0; @@ -48,9 +48,9 @@ RtpEncoderNode::~RtpEncoderNode() if (mRtpSession) { mRtpSession->StopRtp(); - mRtpSession->SetRtpEncoderListener(NULL); + mRtpSession->SetRtpEncoderListener(nullptr); IRtpSession::ReleaseInstance(mRtpSession); - mRtpSession = NULL; + mRtpSession = nullptr; } } @@ -69,11 +69,11 @@ ImsMediaResult RtpEncoderNode::Start() return RESULT_INVALID_PARAM; } - if (mRtpSession == NULL) + if (mRtpSession == nullptr) { mRtpSession = IRtpSession::GetInstance(mMediaType, mLocalAddress, mPeerAddress); - if (mRtpSession == NULL) + if (mRtpSession == nullptr) { IMLOGE0("[Start] Can't create rtp session"); return RESULT_NOT_READY; @@ -144,7 +144,7 @@ void RtpEncoderNode::ProcessData() } ImsMediaSubType subtype; - uint8_t* data = NULL; + uint8_t* data = nullptr; uint32_t size = 0; uint32_t timestamp = 0; bool mark = false; @@ -188,7 +188,7 @@ void RtpEncoderNode::SetConfig(void* config) { IMLOGD1("[SetConfig] media[%d]", mMediaType); - if (config == NULL) + if (config == nullptr) { return; } @@ -229,7 +229,7 @@ void RtpEncoderNode::SetConfig(void* config) bool RtpEncoderNode::IsSameConfig(void* config) { - if (config == NULL) + if (config == nullptr) { return true; } @@ -469,7 +469,7 @@ void RtpEncoderNode::ProcessVideoData( } else { - mRtpSession->SendRtpPacket(mRtpPayloadTx, data, size, timestamp, mark, 0, false, NULL); + mRtpSession->SendRtpPacket(mRtpPayloadTx, data, size, timestamp, mark, 0, false, nullptr); } } @@ -496,17 +496,18 @@ void RtpEncoderNode::ProcessTextData( if (mRedundantLevel > 1 && mRedundantPayload > 0) { mRtpSession->SendRtpPacket( - mRedundantPayload, data, size, timestamp, mark, timeDiff, 0, NULL); + mRedundantPayload, data, size, timestamp, mark, timeDiff, 0, nullptr); } else { mRtpSession->SendRtpPacket( - mRtpPayloadRx, data, size, timestamp, mark, timeDiff, 0, NULL); + mRtpPayloadRx, data, size, timestamp, mark, timeDiff, 0, nullptr); } } else if (subtype == MEDIASUBTYPE_BITSTREAM_T140_RED) { - mRtpSession->SendRtpPacket(mRtpPayloadTx, data, size, timestamp, mark, timeDiff, 0, NULL); + mRtpSession->SendRtpPacket( + mRtpPayloadTx, data, size, timestamp, mark, timeDiff, 0, nullptr); } mMark = false; diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/SocketReaderNode.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/SocketReaderNode.cpp index 95432196..9630fdfa 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/SocketReaderNode.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/SocketReaderNode.cpp @@ -41,7 +41,7 @@ ImsMediaResult SocketReaderNode::Start() IMLOGD1("[Start] media[%d]", mMediaType); mSocket = ISocket::GetInstance(mLocalAddress.port, mPeerAddress.ipAddress, mPeerAddress.port); - if (mSocket == NULL) + if (mSocket == nullptr) { IMLOGE0("[Start] can't create socket instance"); return RESULT_NOT_READY; @@ -76,9 +76,9 @@ void SocketReaderNode::Stop() IMLOGD1("[Stop] media[%d]", mMediaType); std::lock_guard<std::mutex> guard(mMutex); - if (mSocket != NULL) + if (mSocket != nullptr) { - mSocket->Listen(NULL); + mSocket->Listen(nullptr); if (mSocketOpened) { @@ -86,7 +86,7 @@ void SocketReaderNode::Stop() } ISocket::ReleaseInstance(mSocket); - mSocket = NULL; + mSocket = nullptr; mSocketOpened = false; } @@ -97,7 +97,7 @@ void SocketReaderNode::Stop() void SocketReaderNode::ProcessData() { std::lock_guard<std::mutex> guard(mMutex); - uint8_t* data = NULL; + uint8_t* data = nullptr; uint32_t dataSize = 0; uint32_t timeStamp = 0; bool bMark = false; @@ -129,7 +129,7 @@ bool SocketReaderNode::IsSourceNode() void SocketReaderNode::SetConfig(void* config) { - if (config == NULL) + if (config == nullptr) { return; } @@ -149,7 +149,7 @@ void SocketReaderNode::SetConfig(void* config) bool SocketReaderNode::IsSameConfig(void* config) { - if (config == NULL) + if (config == nullptr) { return true; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/SocketWriterNode.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/SocketWriterNode.cpp index 98ef9ee0..f2437eaf 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/SocketWriterNode.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/SocketWriterNode.cpp @@ -20,14 +20,14 @@ SocketWriterNode::SocketWriterNode(BaseSessionCallback* callback) : BaseNode(callback) { - mSocket = NULL; + mSocket = nullptr; mSocketOpened = false; mDisableSocket = false; } SocketWriterNode::~SocketWriterNode() { - if (mSocket != NULL) + if (mSocket != nullptr) { IMLOGE0("[~SocketWriterNode] socket is not closed"); } @@ -43,7 +43,7 @@ ImsMediaResult SocketWriterNode::Start() IMLOGD1("[Start] media[%d]", mMediaType); mSocket = ISocket::GetInstance(mLocalAddress.port, mPeerAddress.ipAddress, mPeerAddress.port); - if (mSocket == NULL) + if (mSocket == nullptr) { IMLOGE0("[Start] can't create socket instance"); return RESULT_NOT_READY; @@ -70,7 +70,7 @@ void SocketWriterNode::Stop() { IMLOGD1("[Stop] media[%d]", mMediaType); - if (mSocket != NULL) + if (mSocket != nullptr) { if (mSocketOpened) { @@ -79,7 +79,7 @@ void SocketWriterNode::Stop() } ISocket::ReleaseInstance(mSocket); - mSocket = NULL; + mSocket = nullptr; } mNodeState = kNodeStateStopped; @@ -97,7 +97,7 @@ bool SocketWriterNode::IsSourceNode() void SocketWriterNode::SetConfig(void* config) { - if (config == NULL) + if (config == nullptr) { return; } @@ -119,7 +119,7 @@ void SocketWriterNode::SetConfig(void* config) bool SocketWriterNode::IsSameConfig(void* config) { - if (config == NULL) + if (config == nullptr) { return true; } @@ -156,7 +156,7 @@ void SocketWriterNode::OnDataFromFrontNode(ImsMediaSubType subtype, uint8_t* pDa IMLOGD_PACKET3(IM_PACKET_LOG_SOCKET, "[OnDataFromFrontNode] TS[%d], SeqNum[%u], size[%u]", nTimestamp, nSeqNum, nDataSize); - if (mSocket == NULL) + if (mSocket == nullptr) { return; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/TextJitterBuffer.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/TextJitterBuffer.cpp index a34ed53f..179d45c2 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/TextJitterBuffer.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/TextJitterBuffer.cpp @@ -73,10 +73,10 @@ void TextJitterBuffer::Add(ImsMediaSubType subtype, uint8_t* buffer, uint32_t si } else { - DataEntry* pEntry = NULL; + DataEntry* pEntry = nullptr; mDataQueue.GetLast(&pEntry); - if (pEntry == NULL) + if (pEntry == nullptr) { return; } @@ -118,7 +118,7 @@ bool TextJitterBuffer::Get(ImsMediaSubType* subtype, uint8_t** data, uint32_t* d std::lock_guard<std::mutex> guard(mMutex); DataEntry* pEntry; - if (mDataQueue.Get(&pEntry) == true && pEntry != NULL) + if (mDataQueue.Get(&pEntry) == true && pEntry != nullptr) { if (subtype) *subtype = pEntry->subtype; @@ -144,7 +144,7 @@ bool TextJitterBuffer::Get(ImsMediaSubType* subtype, uint8_t** data, uint32_t* d if (subtype) *subtype = MEDIASUBTYPE_UNDEFINED; if (data) - *data = NULL; + *data = nullptr; if (dataSize) *dataSize = 0; if (timestamp) @@ -166,7 +166,7 @@ void TextJitterBuffer::Delete() std::lock_guard<std::mutex> guard(mMutex); mDataQueue.Get(&pEntry); - if (pEntry == NULL) + if (pEntry == nullptr) { return; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/TextManager.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/TextManager.cpp index c8bddcdc..f50a0ba8 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/TextManager.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/TextManager.cpp @@ -27,7 +27,7 @@ TextManager::~TextManager() {} TextManager* TextManager::getInstance() { - if (manager == NULL) + if (manager == nullptr) { manager = new TextManager(); } @@ -219,7 +219,7 @@ void TextManager::RequestHandler::processEvent( case kTextOpenSession: { EventParamOpenSession* param = reinterpret_cast<EventParamOpenSession*>(paramA); - if (param != NULL) + if (param != nullptr) { TextConfig* pConfig = reinterpret_cast<TextConfig*>(param->mConfig); result = TextManager::getInstance()->openSession( @@ -238,7 +238,7 @@ void TextManager::RequestHandler::processEvent( delete param; - if (pConfig != NULL) + if (pConfig != nullptr) { delete pConfig; } @@ -270,7 +270,7 @@ void TextManager::RequestHandler::processEvent( { MediaQualityThreshold* threshold = reinterpret_cast<MediaQualityThreshold*>(paramA); - if (threshold != NULL) + if (threshold != nullptr) { TextManager::getInstance()->setMediaQualityThreshold( static_cast<int>(sessionId), threshold); @@ -282,7 +282,7 @@ void TextManager::RequestHandler::processEvent( { android::String8* text = reinterpret_cast<android::String8*>(paramA); - if (text != NULL) + if (text != nullptr) { TextManager::getInstance()->sendRtt(static_cast<int>(sessionId), text); delete text; @@ -328,7 +328,7 @@ void TextManager::ResponseHandler::processEvent( parcel.writeInt32(paramA); // result TextConfig* config = reinterpret_cast<TextConfig*>(paramB); - if (config != NULL) + if (config != nullptr) { config->writeToParcel(&parcel); TextManager::getInstance()->sendResponse(sessionId, parcel); @@ -347,7 +347,7 @@ void TextManager::ResponseHandler::processEvent( parcel.writeInt32(event); android::String8* text = reinterpret_cast<String8*>(paramA); - if (text != NULL) + if (text != nullptr) { String16 rttText(*text); parcel.writeString16(rttText); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/TextSession.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/TextSession.cpp index 4778a178..2c3cf04d 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/TextSession.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/TextSession.cpp @@ -24,16 +24,16 @@ TextSession::TextSession() { IMLOGD0("[TextSession]"); - mGraphRtpTx = NULL; - mGraphRtpRx = NULL; - mGraphRtcp = NULL; + mGraphRtpTx = nullptr; + mGraphRtpRx = nullptr; + mGraphRtcp = nullptr; } TextSession::~TextSession() { IMLOGD0("[~TextSession]"); - if (mGraphRtpTx != NULL) + if (mGraphRtpTx != nullptr) { if (mGraphRtpTx->getState() == kStreamStateRunning) { @@ -41,10 +41,10 @@ TextSession::~TextSession() } delete mGraphRtpTx; - mGraphRtpTx = NULL; + mGraphRtpTx = nullptr; } - if (mGraphRtpRx != NULL) + if (mGraphRtpRx != nullptr) { if (mGraphRtpRx->getState() == kStreamStateRunning) { @@ -52,10 +52,10 @@ TextSession::~TextSession() } delete mGraphRtpRx; - mGraphRtpRx = NULL; + mGraphRtpRx = nullptr; } - if (mGraphRtcp != NULL) + if (mGraphRtcp != nullptr) { if (mGraphRtcp->getState() == kStreamStateRunning) { @@ -63,7 +63,7 @@ TextSession::~TextSession() } delete mGraphRtcp; - mGraphRtcp = NULL; + mGraphRtcp = nullptr; } } @@ -71,13 +71,13 @@ SessionState TextSession::getState() { SessionState state = kSessionStateOpened; - if ((mGraphRtpTx != NULL && mGraphRtpTx->getState() == kStreamStateRunning) || - (mGraphRtpRx != NULL && mGraphRtpRx->getState() == kStreamStateRunning)) + if ((mGraphRtpTx != nullptr && mGraphRtpTx->getState() == kStreamStateRunning) || + (mGraphRtpRx != nullptr && mGraphRtpRx->getState() == kStreamStateRunning)) { return kSessionStateActive; } - if (mGraphRtcp != NULL && mGraphRtcp->getState() == kStreamStateRunning) + if (mGraphRtcp != nullptr && mGraphRtcp->getState() == kStreamStateRunning) { return kSessionStateSuspended; } @@ -89,7 +89,7 @@ ImsMediaResult TextSession::startGraph(RtpConfig* config) { IMLOGI0("[startGraph]"); - if (config == NULL) + if (config == nullptr) { return RESULT_INVALID_PARAM; } @@ -103,7 +103,7 @@ ImsMediaResult TextSession::startGraph(RtpConfig* config) ImsMediaResult ret = RESULT_NOT_READY; - if (mGraphRtpTx != NULL) + if (mGraphRtpTx != nullptr) { ret = mGraphRtpTx->update(config); @@ -132,7 +132,7 @@ ImsMediaResult TextSession::startGraph(RtpConfig* config) } } - if (mGraphRtpRx != NULL) + if (mGraphRtpRx != nullptr) { mGraphRtpRx->setMediaQualityThreshold(&mThreshold); ret = mGraphRtpRx->update(config); @@ -162,7 +162,7 @@ ImsMediaResult TextSession::startGraph(RtpConfig* config) } } - if (mGraphRtcp != NULL) + if (mGraphRtcp != nullptr) { mGraphRtcp->setMediaQualityThreshold(&mThreshold); ret = mGraphRtcp->update(config); @@ -195,7 +195,7 @@ ImsMediaResult TextSession::startGraph(RtpConfig* config) ImsMediaResult TextSession::sendRtt(const android::String8* text) { - if (mGraphRtpTx != NULL && mGraphRtpTx->getState() == kStreamStateRunning) + if (mGraphRtpTx != nullptr && mGraphRtpTx->getState() == kStreamStateRunning) { mGraphRtpTx->sendRtt(text); return RESULT_SUCCESS; diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/TextStreamGraphRtcp.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/TextStreamGraphRtcp.cpp index 37e21ef7..922981e6 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/TextStreamGraphRtcp.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/TextStreamGraphRtcp.cpp @@ -34,7 +34,7 @@ ImsMediaResult TextStreamGraphRtcp::create(RtpConfig* config) { IMLOGI1("[create] state[%d]", mGraphState); - if (config == NULL) + if (config == nullptr) { return RESULT_INVALID_PARAM; } @@ -85,7 +85,7 @@ ImsMediaResult TextStreamGraphRtcp::update(RtpConfig* config) { IMLOGI1("[update] state[%d]", mGraphState); - if (config == NULL) + if (config == nullptr) { return RESULT_INVALID_PARAM; } @@ -98,7 +98,7 @@ ImsMediaResult TextStreamGraphRtcp::update(RtpConfig* config) return RESULT_SUCCESS; } - if (mConfig != NULL) + if (mConfig != nullptr) { delete mConfig; } @@ -120,7 +120,7 @@ ImsMediaResult TextStreamGraphRtcp::update(RtpConfig* config) for (auto& node : mListNodeStarted) { - if (node != NULL) + if (node != nullptr) { IMLOGD1("[update] update node[%s]", node->GetNodeName()); ret = node->UpdateConfig(pConfig); @@ -149,11 +149,11 @@ ImsMediaResult TextStreamGraphRtcp::update(RtpConfig* config) bool TextStreamGraphRtcp::setMediaQualityThreshold(MediaQualityThreshold* threshold) { - if (threshold != NULL) + if (threshold != nullptr) { BaseNode* node = findNode(kNodeIdRtcpDecoder); - if (node != NULL) + if (node != nullptr) { RtcpDecoderNode* decoder = reinterpret_cast<RtcpDecoderNode*>(node); decoder->SetInactivityTimerSec(threshold->getRtcpInactivityTimerMillis() / 1000); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/TextStreamGraphRtpRx.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/TextStreamGraphRtpRx.cpp index a450177b..7897d8ef 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/TextStreamGraphRtpRx.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/TextStreamGraphRtpRx.cpp @@ -34,7 +34,7 @@ ImsMediaResult TextStreamGraphRtpRx::create(RtpConfig* config) { IMLOGI1("[create] state[%d]", mGraphState); - if (config == NULL) + if (config == nullptr) { return RESULT_INVALID_PARAM; } @@ -80,7 +80,7 @@ ImsMediaResult TextStreamGraphRtpRx::update(RtpConfig* config) { IMLOGI1("[update] state[%d]", mGraphState); - if (config == NULL) + if (config == nullptr) { return RESULT_INVALID_PARAM; } @@ -93,10 +93,10 @@ ImsMediaResult TextStreamGraphRtpRx::update(RtpConfig* config) return RESULT_SUCCESS; } - if (mConfig != NULL) + if (mConfig != nullptr) { delete mConfig; - mConfig = NULL; + mConfig = nullptr; } mConfig = new TextConfig(pConfig); @@ -117,7 +117,7 @@ ImsMediaResult TextStreamGraphRtpRx::update(RtpConfig* config) for (auto& node : mListNodeStarted) { - if (node != NULL) + if (node != nullptr) { IMLOGD1("[update] update node[%s]", node->GetNodeName()); ret = node->UpdateConfig(mConfig); @@ -134,7 +134,7 @@ ImsMediaResult TextStreamGraphRtpRx::update(RtpConfig* config) { for (auto& node : mListNodeToStart) { - if (node != NULL) + if (node != nullptr) { IMLOGD1("[update] update node[%s]", node->GetNodeName()); ret = node->UpdateConfig(mConfig); @@ -162,7 +162,7 @@ ImsMediaResult TextStreamGraphRtpRx::start() { IMLOGD1("[start] state[%d]", mGraphState); - if (mConfig == NULL) + if (mConfig == nullptr) { return RESULT_INVALID_PARAM; } @@ -192,11 +192,11 @@ ImsMediaResult TextStreamGraphRtpRx::start() bool TextStreamGraphRtpRx::setMediaQualityThreshold(MediaQualityThreshold* threshold) { - if (threshold != NULL) + if (threshold != nullptr) { BaseNode* node = findNode(kNodeIdRtpDecoder); - if (node != NULL) + if (node != nullptr) { RtpDecoderNode* decoder = reinterpret_cast<RtpDecoderNode*>(node); decoder->SetInactivityTimerSec(threshold->getRtpInactivityTimerMillis() / 1000); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/TextStreamGraphRtpTx.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/TextStreamGraphRtpTx.cpp index 023646da..5976bb00 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/TextStreamGraphRtpTx.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/TextStreamGraphRtpTx.cpp @@ -34,17 +34,17 @@ ImsMediaResult TextStreamGraphRtpTx::create(RtpConfig* config) { IMLOGI1("[create] state[%d]", mGraphState); - if (config == NULL) + if (config == nullptr) { return RESULT_INVALID_PARAM; } TextConfig* pConfig = reinterpret_cast<TextConfig*>(config); - if (mConfig != NULL) + if (mConfig != nullptr) { delete mConfig; - mConfig = NULL; + mConfig = nullptr; } mConfig = new TextConfig(pConfig); @@ -89,7 +89,7 @@ ImsMediaResult TextStreamGraphRtpTx::update(RtpConfig* config) { IMLOGI1("[update] state[%d]", mGraphState); - if (config == NULL) + if (config == nullptr) { return RESULT_INVALID_PARAM; } @@ -102,10 +102,10 @@ ImsMediaResult TextStreamGraphRtpTx::update(RtpConfig* config) return RESULT_SUCCESS; } - if (mConfig != NULL) + if (mConfig != nullptr) { delete mConfig; - mConfig = NULL; + mConfig = nullptr; } ImsMediaResult ret = RESULT_NOT_READY; @@ -128,7 +128,7 @@ ImsMediaResult TextStreamGraphRtpTx::update(RtpConfig* config) for (auto& node : mListNodeStarted) { - if (node != NULL) + if (node != nullptr) { IMLOGD1("[update] update node[%s]", node->GetNodeName()); ret = node->UpdateConfig(mConfig); @@ -146,7 +146,7 @@ ImsMediaResult TextStreamGraphRtpTx::update(RtpConfig* config) { for (auto& node : mListNodeToStart) { - if (node != NULL) + if (node != nullptr) { IMLOGD1("[update] update node[%s]", node->GetNodeName()); ret = node->UpdateConfig(mConfig); @@ -174,7 +174,7 @@ ImsMediaResult TextStreamGraphRtpTx::start() { IMLOGI1("[start] state[%d]", mGraphState); - if (mConfig == NULL) + if (mConfig == nullptr) { return RESULT_INVALID_PARAM; } @@ -205,14 +205,14 @@ ImsMediaResult TextStreamGraphRtpTx::start() bool TextStreamGraphRtpTx::sendRtt(const android::String8* text) { IMLOGD1("[sendRtt], state[%d]", mGraphState); - TextSourceNode* node = NULL; + TextSourceNode* node = nullptr; if (!mListNodeStarted.empty()) { node = reinterpret_cast<TextSourceNode*>(mListNodeStarted.front()); } - if (node != NULL) + if (node != nullptr) { node->SendRtt(text); return true; diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextRendererNode.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextRendererNode.cpp index 5289795d..d2ec3f63 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextRendererNode.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextRendererNode.cpp @@ -74,7 +74,7 @@ bool TextRendererNode::IsSourceNode() void TextRendererNode::SetConfig(void* config) { - if (config == NULL) + if (config == nullptr) { return; } @@ -86,7 +86,7 @@ void TextRendererNode::SetConfig(void* config) bool TextRendererNode::IsSameConfig(void* config) { - if (config == NULL) + if (config == nullptr) { return true; } @@ -122,7 +122,7 @@ void TextRendererNode::ProcessData() break; } - if (data == NULL) + if (data == nullptr) { IMLOGD0("[ProcessData] invalid data"); break; diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextRtpPayloadDecoderNode.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextRtpPayloadDecoderNode.cpp index 2031faa0..284311e2 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextRtpPayloadDecoderNode.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextRtpPayloadDecoderNode.cpp @@ -70,7 +70,7 @@ void TextRtpPayloadDecoderNode::OnDataFromFrontNode(ImsMediaSubType subtype, uin if (subtype == MEDIASUBTYPE_REFRESHED) { - SendDataToRearNode(subtype, NULL, size, 0, 0, 0, MEDIASUBTYPE_UNDEFINED); + SendDataToRearNode(subtype, nullptr, size, 0, 0, 0, MEDIASUBTYPE_UNDEFINED); return; } @@ -88,7 +88,7 @@ void TextRtpPayloadDecoderNode::OnDataFromFrontNode(ImsMediaSubType subtype, uin void TextRtpPayloadDecoderNode::SetConfig(void* config) { - if (config == NULL) + if (config == nullptr) { return; } @@ -99,7 +99,7 @@ void TextRtpPayloadDecoderNode::SetConfig(void* config) bool TextRtpPayloadDecoderNode::IsSameConfig(void* config) { - if (config == NULL) + if (config == nullptr) { return true; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextRtpPayloadEncoderNode.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextRtpPayloadEncoderNode.cpp index a64038dc..265cfa59 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextRtpPayloadEncoderNode.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextRtpPayloadEncoderNode.cpp @@ -88,7 +88,7 @@ void TextRtpPayloadEncoderNode::OnDataFromFrontNode(ImsMediaSubType subtype, uin void TextRtpPayloadEncoderNode::SetConfig(void* config) { - if (config == NULL) + if (config == nullptr) { return; } @@ -102,7 +102,7 @@ void TextRtpPayloadEncoderNode::SetConfig(void* config) bool TextRtpPayloadEncoderNode::IsSameConfig(void* config) { - if (config == NULL) + if (config == nullptr) { return true; } @@ -154,9 +154,9 @@ void TextRtpPayloadEncoderNode::EncodeT140( } // Remove very old redundant data - DataEntry* pEntry = NULL; + DataEntry* pEntry = nullptr; - while (mBufferQueue.Get(&pEntry) && pEntry != NULL) + while (mBufferQueue.Get(&pEntry) && pEntry != nullptr) { /** [RFC 4103] 10.1. Registration of MIME Media Type text/t140 Required parameters: * rate: The RTP timestamp clock rate, which is equal to the sampling rate. The only @@ -173,7 +173,7 @@ void TextRtpPayloadEncoderNode::EncodeT140( if (nTSInterval >= PAYLOADENCODER_TEXT_MAX_REDUNDANT_INTERVAL || pEntry->arrivalTime == 0) { - pEntry = NULL; + pEntry = nullptr; mBufferQueue.Delete(); } else @@ -187,7 +187,7 @@ void TextRtpPayloadEncoderNode::EncodeT140( for (uint32_t i = 0; i < mBufferQueue.GetCount(); i++) { - if (mBufferQueue.GetAt(i, &pEntry) && pEntry != NULL) + if (mBufferQueue.GetAt(i, &pEntry) && pEntry != nullptr) { if (pEntry->nBufferSize > 0) { @@ -228,7 +228,7 @@ void TextRtpPayloadEncoderNode::EncodeT140( DataEntry nullRED; memset(&nullRED, 0, sizeof(DataEntry)); nullRED.subtype = MEDIASUBTYPE_RTPPAYLOAD; - nullRED.pbBuffer = NULL; + nullRED.pbBuffer = nullptr; nullRED.nBufferSize = 0; nullRED.nTimestamp = timestamp; nullRED.arrivalTime = 1; // Remained time to be retransmitted @@ -249,11 +249,11 @@ void TextRtpPayloadEncoderNode::EncodeT140( } // Write redundant header & data to payload - pEntry = NULL; + pEntry = nullptr; for (uint32_t i = 0; i < mBufferQueue.GetCount(); i++) { - if (mBufferQueue.GetAt(i, &pEntry) && pEntry != NULL) + if (mBufferQueue.GetAt(i, &pEntry) && pEntry != nullptr) { uint32_t nTSInterval = timestamp - pEntry->nTimestamp; mBWHeader.Write(1, 1); @@ -268,7 +268,7 @@ void TextRtpPayloadEncoderNode::EncodeT140( i, mBufferQueue.GetCount(), pEntry->arrivalTime, mRedundantPayload, nTSInterval, pEntry->nBufferSize); - if (pEntry->nBufferSize > 0 && pEntry->pbBuffer != NULL) + if (pEntry->nBufferSize > 0 && pEntry->pbBuffer != nullptr) { mBWPayload.WriteByteBuffer(pEntry->pbBuffer, pEntry->nBufferSize * 8); } @@ -285,7 +285,7 @@ void TextRtpPayloadEncoderNode::EncodeT140( * device needs to send new / non-redundant text data only, it shall send it using an RTP * packet that has a payload type (PT) of 111 (i.e., send in a T.140 RTP packet).*/ - if (size > 0 && data != NULL) + if (size > 0 && data != nullptr) { mBWPayload.WriteByteBuffer(data, size * 8); } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextSourceNode.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextSourceNode.cpp index 60e08cdb..82fc1b58 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextSourceNode.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextSourceNode.cpp @@ -82,7 +82,7 @@ bool TextSourceNode::IsSourceNode() void TextSourceNode::SetConfig(void* config) { - if (config == NULL) + if (config == nullptr) { return; } @@ -96,7 +96,7 @@ void TextSourceNode::SetConfig(void* config) bool TextSourceNode::IsSameConfig(void* config) { - if (config == NULL) + if (config == nullptr) { return true; } @@ -142,7 +142,7 @@ void TextSourceNode::ProcessData() uint8_t* pData = mListTextSource.front(); uint32_t nDataSize = mListTextSourceSize.front(); - if (pData == NULL || nDataSize == 0) + if (pData == nullptr || nDataSize == 0) { continue; } @@ -180,7 +180,7 @@ void TextSourceNode::ProcessData() */ IMLOGD1("[ProcessData] send empty, nRedCount[%d]", mRedundantCount); // send default if there is no data to send - SendDataToRearNode(MEDIASUBTYPE_BITSTREAM_T140, NULL, 0, + SendDataToRearNode(MEDIASUBTYPE_BITSTREAM_T140, nullptr, 0, ImsMediaTimer::GetTimeInMilliSeconds(), false, 0); mRedundantCount--; } @@ -188,7 +188,7 @@ void TextSourceNode::ProcessData() void TextSourceNode::SendRtt(const android::String8* text) { - if (text == NULL || text->length() == 0) + if (text == nullptr || text->length() == 0) { IMLOGE0("[SendRtt] invalid data"); return; @@ -223,7 +223,7 @@ void TextSourceNode::SendRtt(const android::String8* text) uint8_t* buffer = (uint8_t*)calloc(nChunkSize, sizeof(uint8_t)); - if (buffer == NULL) + if (buffer == nullptr) { IMLOGE0("[SendRtt] allocated data is null"); return; @@ -242,7 +242,7 @@ void TextSourceNode::SendBOM() const uint32_t sizeofBom = 3; uint8_t* buffer = (uint8_t*)calloc(sizeofBom, sizeof(uint8_t)); - if (buffer == NULL) + if (buffer == nullptr) { IMLOGE0("[SendBOM] allocated data is null"); return; diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/IImsMediaThread.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/IImsMediaThread.cpp index ae4ef073..6134121e 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/IImsMediaThread.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/IImsMediaThread.cpp @@ -27,10 +27,10 @@ IImsMediaThread::~IImsMediaThread() {} void* runThread(void* arg) { - if (arg == NULL) + if (arg == nullptr) { IMLOGE0("[runThread] invalid argument"); - return NULL; + return nullptr; } IImsMediaThread* thread = reinterpret_cast<IImsMediaThread*>(arg); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ISocket.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ISocket.cpp index 190a0158..52f8168a 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ISocket.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ISocket.cpp @@ -20,14 +20,14 @@ ISocket* ISocket::GetInstance( uint32_t localPort, const char* peerIpAddress, uint32_t peerPort, eSocketClass eSocket) { - ISocket* pSocket = NULL; + ISocket* pSocket = nullptr; if (eSocket == SOCKET_CLASS_DEFAULT) { pSocket = static_cast<ISocket*>( ImsMediaSocket::GetInstance(localPort, peerIpAddress, peerPort)); - if (pSocket != NULL) + if (pSocket != nullptr) { pSocket->mSocketClass = SOCKET_CLASS_DEFAULT; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaBitReader.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaBitReader.cpp index de1b6c30..35c7148d 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaBitReader.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaBitReader.cpp @@ -20,7 +20,7 @@ ImsMediaBitReader::ImsMediaBitReader() { - mBuffer = NULL; + mBuffer = nullptr; mMaxBufferSize = 0; mBytePos = 0; mBitPos = 0; @@ -45,7 +45,7 @@ uint32_t ImsMediaBitReader::Read(uint32_t nSize) uint32_t value; if (nSize == 0) return 0; - if (mBuffer == NULL || nSize > 24 || mBufferEOF) + if (mBuffer == nullptr || nSize > 24 || mBufferEOF) { IMLOGE2("[Read] nSize[%d], bBufferEOF[%d]", nSize, mBufferEOF); return 0; diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaBitWriter.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaBitWriter.cpp index bc0bf902..cba37f55 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaBitWriter.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaBitWriter.cpp @@ -20,7 +20,7 @@ ImsMediaBitWriter::ImsMediaBitWriter() { - mBuffer = NULL; + mBuffer = nullptr; mMaxBufferSize = 0; mBytePos = 0; mBitPos = 0; @@ -45,7 +45,7 @@ void ImsMediaBitWriter::Write(uint32_t nValue, uint32_t nSize) if (nSize == 0) return; - if (mBuffer == NULL || nSize > 24 || mBufferFull) + if (mBuffer == nullptr || nSize > 24 || mBufferFull) { IMLOGE2("[Write] nSize[%d], BufferFull[%d]", nSize, mBufferFull); return; diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaCondition.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaCondition.cpp index 909290a6..f4661ef9 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaCondition.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaCondition.cpp @@ -24,39 +24,39 @@ ImsMediaCondition::ImsMediaCondition() mMutex = new pthread_mutex_t; mCondition = new pthread_cond_t; - if (mMutex != NULL) + if (mMutex != nullptr) { - pthread_mutex_init(mMutex, NULL); + pthread_mutex_init(mMutex, nullptr); } - if (mCondition != NULL) + if (mCondition != nullptr) { - pthread_cond_init(mCondition, NULL); + pthread_cond_init(mCondition, nullptr); } } ImsMediaCondition::~ImsMediaCondition() { - if (mCondition != NULL) + if (mCondition != nullptr) { pthread_cond_destroy(mCondition); } - if (mMutex != NULL) + if (mMutex != nullptr) { pthread_mutex_destroy(mMutex); } - if (mCondition != NULL) + if (mCondition != nullptr) { delete mCondition; - mCondition = NULL; + mCondition = nullptr; } - if (mMutex != NULL) + if (mMutex != nullptr) { delete mMutex; - mMutex = NULL; + mMutex = nullptr; } } @@ -84,7 +84,7 @@ bool ImsMediaCondition::wait_timeout(int64_t nRelativeTime) // make abs time struct timespec ts; struct timeval tv; - gettimeofday(&tv, (struct timezone*)NULL); + gettimeofday(&tv, (struct timezone*)nullptr); uint64_t nInitTime = (tv.tv_sec * 1000) + (tv.tv_usec / 1000); ts.tv_sec = tv.tv_sec + (nRelativeTime / 1000); long addedUSec = tv.tv_usec + (nRelativeTime % 1000) * 1000L; @@ -113,7 +113,7 @@ bool ImsMediaCondition::wait_timeout(int64_t nRelativeTime) IncCount(&mWaitCount); pthread_mutex_unlock(mMutex); struct timeval tl; - gettimeofday(&tl, (struct timezone*)NULL); + gettimeofday(&tl, (struct timezone*)nullptr); uint64_t nCurrTime = (tl.tv_sec * 1000) + (tl.tv_usec / 1000); if (nCurrTime - nInitTime >= nRelativeTime) @@ -128,7 +128,7 @@ bool ImsMediaCondition::wait_timeout(int64_t nRelativeTime) void ImsMediaCondition::signal() { - if (mCondition == NULL || mMutex == NULL) + if (mCondition == nullptr || mMutex == nullptr) { return; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaDataQueue.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaDataQueue.cpp index 9c2fa26c..29455481 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaDataQueue.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaDataQueue.cpp @@ -26,7 +26,7 @@ ImsMediaDataQueue::~ImsMediaDataQueue() void ImsMediaDataQueue::Add(DataEntry* pEntry) { - if (pEntry != NULL) + if (pEntry != nullptr) { std::lock_guard<std::mutex> guard(mMutex); DataEntry* pbData = new DataEntry(*pEntry); @@ -36,7 +36,7 @@ void ImsMediaDataQueue::Add(DataEntry* pEntry) void ImsMediaDataQueue::InsertAt(uint32_t index, DataEntry* pEntry) { - if (pEntry != NULL) + if (pEntry != nullptr) { std::lock_guard<std::mutex> guard(mMutex); DataEntry* pbData = new DataEntry(*pEntry); @@ -81,7 +81,7 @@ void ImsMediaDataQueue::Clear() bool ImsMediaDataQueue::Get(DataEntry** ppEntry) { - if (ppEntry == NULL) + if (ppEntry == nullptr) { return false; } @@ -96,14 +96,14 @@ bool ImsMediaDataQueue::Get(DataEntry** ppEntry) } else { - *ppEntry = NULL; + *ppEntry = nullptr; return false; } } bool ImsMediaDataQueue::GetLast(DataEntry** ppEntry) { - if (ppEntry == NULL) + if (ppEntry == nullptr) { return false; } @@ -117,14 +117,14 @@ bool ImsMediaDataQueue::GetLast(DataEntry** ppEntry) } else { - *ppEntry = NULL; + *ppEntry = nullptr; return false; } } bool ImsMediaDataQueue::GetAt(uint32_t index, DataEntry** ppEntry) { - if (ppEntry == NULL) + if (ppEntry == nullptr) { return false; } @@ -140,7 +140,7 @@ bool ImsMediaDataQueue::GetAt(uint32_t index, DataEntry** ppEntry) } else { - *ppEntry = NULL; + *ppEntry = nullptr; return false; } } @@ -159,7 +159,7 @@ void ImsMediaDataQueue::SetReadPosFirst() bool ImsMediaDataQueue::GetNext(DataEntry** ppEntry) { - if (ppEntry == NULL) + if (ppEntry == nullptr) { return false; } @@ -173,7 +173,7 @@ bool ImsMediaDataQueue::GetNext(DataEntry** ppEntry) } else { - *ppEntry = NULL; + *ppEntry = nullptr; return false; } } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaEventHandler.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaEventHandler.cpp index 6252c1f8..b3d165ab 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaEventHandler.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaEventHandler.cpp @@ -47,9 +47,9 @@ ImsMediaEventHandler::~ImsMediaEventHandler() void ImsMediaEventHandler::SendEvent(const char* strEventHandlerName, uint32_t event, uint64_t paramA, uint64_t paramB, uint64_t paramC) { - if (strEventHandlerName == NULL) + if (strEventHandlerName == nullptr) { - IMLOGE0("[SendEvent] strEventHandlerName is NULL"); + IMLOGE0("[SendEvent] strEventHandlerName is nullptr"); return; } @@ -58,7 +58,7 @@ void ImsMediaEventHandler::SendEvent(const char* strEventHandlerName, uint32_t e for (auto& i : gListEventHandler) { - if (i != NULL && strcmp(i->getName(), strEventHandlerName) == 0) + if (i != nullptr && strcmp(i->getName(), strEventHandlerName) == 0) { i->AddEvent(event, paramA, paramB, paramC); } @@ -125,5 +125,5 @@ void* ImsMediaEventHandler::run() IMLOGD2("[run] %s exit, %p", mName, this); mConditionExit.signal(); - return NULL; + return nullptr; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaNetworkUtil.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaNetworkUtil.cpp index 9e31e826..9394fff3 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaNetworkUtil.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaNetworkUtil.cpp @@ -66,7 +66,7 @@ static bool GetIpPortFromSockAddr( bool ImsMediaNetworkUtil::getLocalIpPortFromSocket( const int nSocketFD, char* pIPAddress, int len, unsigned int& port) { - if (pIPAddress == NULL) + if (pIPAddress == nullptr) { return false; } @@ -88,7 +88,7 @@ bool ImsMediaNetworkUtil::getLocalIpPortFromSocket( bool ImsMediaNetworkUtil::getRemoteIpPortFromSocket( const int nSocketFD, char* pIPAddress, int len, unsigned int& port) { - if (pIPAddress == NULL) + if (pIPAddress == nullptr) { return false; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaSocket.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaSocket.cpp index 0b92abd9..73ad91a2 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaSocket.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaSocket.cpp @@ -44,7 +44,7 @@ std::mutex ImsMediaSocket::sMutexSocketList; ImsMediaSocket* ImsMediaSocket::GetInstance( uint32_t localPort, const char* peerIpAddress, uint32_t peerPort) { - ImsMediaSocket* pImsMediaSocket = NULL; + ImsMediaSocket* pImsMediaSocket = nullptr; std::lock_guard<std::mutex> guard(sMutexSocketList); for (auto& i : slistSocket) @@ -62,7 +62,7 @@ ImsMediaSocket* ImsMediaSocket::GetInstance( void ImsMediaSocket::ReleaseInstance(ImsMediaSocket* pSocket) { - if (pSocket != NULL && pSocket->mRefCount == 0) + if (pSocket != nullptr && pSocket->mRefCount == 0) { delete pSocket; } @@ -70,7 +70,7 @@ void ImsMediaSocket::ReleaseInstance(ImsMediaSocket* pSocket) ImsMediaSocket::ImsMediaSocket() { - mListener = NULL; + mListener = nullptr; mRefCount = 0; mLocalIPVersion = IPV4; mPeerIPVersion = IPV4; @@ -92,7 +92,7 @@ void ImsMediaSocket::SetLocalEndpoint(const char* ipAddress, const uint32_t port std::strncpy(mLocalIP, ipAddress, strlen(ipAddress)); mLocalPort = port; - if (strstr(mLocalIP, ":") == NULL) + if (strstr(mLocalIP, ":") == nullptr) { mLocalIPVersion = IPV4; } @@ -107,7 +107,7 @@ void ImsMediaSocket::SetPeerEndpoint(const char* ipAddress, const uint32_t port) std::strncpy(mPeerIP, ipAddress, strlen(ipAddress)); mPeerPort = port; - if (strstr(mPeerIP, ":") == NULL) + if (strstr(mPeerIP, ":") == nullptr) { mPeerIPVersion = IPV4; } @@ -164,7 +164,7 @@ void ImsMediaSocket::Listen(ISocketListener* listener) IMLOGD0("[Listen]"); mListener = listener; - if (listener != NULL) + if (listener != nullptr) { // add socket list, run thread sMutexRxSocket.lock(); @@ -216,7 +216,7 @@ int32_t ImsMediaSocket::SendTo(uint8_t* pData, uint32_t nDataSize) struct sockaddr_in stAddr4; struct sockaddr_in6 stAddr6; - struct sockaddr* pstSockAddr = NULL; + struct sockaddr* pstSockAddr = nullptr; socklen_t nSockAddrLen = 0; if (mPeerIPVersion == IPV4) @@ -265,7 +265,7 @@ int32_t ImsMediaSocket::SendTo(uint8_t* pData, uint32_t nDataSize) int32_t ImsMediaSocket::ReceiveFrom(uint8_t* pData, uint32_t nBufferSize) { int32_t len; - struct sockaddr* pstSockAddr = NULL; + struct sockaddr* pstSockAddr = nullptr; socklen_t nSockAddrLen = 0; sockaddr_storage ss; pstSockAddr = reinterpret_cast<sockaddr*>(&ss); @@ -461,7 +461,7 @@ void ImsMediaSocket::ReadDataFromSocket(void* pReadfds) for (auto& rxSocket : slistRxSocket) { - if (rxSocket != NULL) + if (rxSocket != nullptr) { int32_t socketFD = rxSocket->GetSocketFd(); @@ -470,7 +470,7 @@ void ImsMediaSocket::ReadDataFromSocket(void* pReadfds) IMLOGD_PACKET1(IM_PACKET_LOG_SOCKET, "[ReadDataFromSocket] send notify to listener %p", rxSocket->GetListener()); - if (rxSocket->GetListener() != NULL) + if (rxSocket->GetListener() != nullptr) { rxSocket->GetListener()->OnReadDataFromSocket(); } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaTimer.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaTimer.cpp index 4fd45938..287a358d 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaTimer.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaTimer.cpp @@ -84,9 +84,9 @@ static void* ImsMediaTimer_run(void* arg) TimerInstance* pInstance = reinterpret_cast<TimerInstance*>(arg); uint32_t nSleepTime; - if (pInstance == NULL) + if (pInstance == nullptr) { - return NULL; + return nullptr; } if (pInstance->mDuration < 100) @@ -118,7 +118,7 @@ static void* ImsMediaTimer_run(void* arg) break; } - if (gettimeofday(&tp, NULL) != -1) + if (gettimeofday(&tp, nullptr) != -1) { uint32_t nCurrTimeSec, nCurrTimeMSec; uint32_t nTimeDiff; @@ -160,13 +160,13 @@ static void* ImsMediaTimer_run(void* arg) DeleteTimerFromList(pInstance); - if (pInstance != NULL) + if (pInstance != nullptr) { free(pInstance); - pInstance = NULL; + pInstance = nullptr; } - return NULL; + return nullptr; } hTimerHandler ImsMediaTimer::TimerStart( @@ -175,9 +175,9 @@ hTimerHandler ImsMediaTimer::TimerStart( struct timeval tp; TimerInstance* pInstance = reinterpret_cast<TimerInstance*>(malloc(sizeof(TimerInstance))); - if (pInstance == NULL) + if (pInstance == nullptr) { - return NULL; + return nullptr; } pInstance->mTimerCb = pTimerCb; @@ -189,7 +189,7 @@ hTimerHandler ImsMediaTimer::TimerStart( IMLOGD3("[TimerStart] Duratation[%u], bRepeat[%d], pUserData[%x]", pInstance->mDuration, bRepeat, pInstance->mUserData); - if (gettimeofday(&tp, NULL) != -1) + if (gettimeofday(&tp, nullptr) != -1) { pInstance->mStartTimeSec = tp.tv_sec; pInstance->mStartTimeMSec = tp.tv_usec / 1000; @@ -197,7 +197,7 @@ hTimerHandler ImsMediaTimer::TimerStart( else { free(pInstance); - return NULL; + return nullptr; } AddTimerToList(pInstance); @@ -211,7 +211,7 @@ bool ImsMediaTimer::TimerStop(hTimerHandler hTimer, void** ppUserData) { TimerInstance* pInstance = reinterpret_cast<TimerInstance*>(hTimer); - if (pInstance == NULL) + if (pInstance == nullptr) { return false; } @@ -237,7 +237,7 @@ void ImsMediaTimer::GetNtpTime(IMNtpTime* pNtpTime) { struct timeval stAndrodTp; - if (gettimeofday(&stAndrodTp, NULL) != -1) + if (gettimeofday(&stAndrodTp, nullptr) != -1) { // To convert a UNIX timestamp (seconds since 1970) to NTP time, add 2,208,988,800 seconds pNtpTime->ntpHigh32Bits = stAndrodTp.tv_sec + 2208988800UL; @@ -276,14 +276,14 @@ uint32_t ImsMediaTimer::GetRtpTsFromNtpTs(IMNtpTime* initNtpTimestamp, uint32_t uint32_t ImsMediaTimer::GetTimeInMilliSeconds(void) { struct timeval tp; - gettimeofday(&tp, NULL); + gettimeofday(&tp, nullptr); return (tp.tv_sec * 1000) + (tp.tv_usec / 1000); } uint64_t ImsMediaTimer::GetTimeInMicroSeconds(void) { struct timeval tp; - gettimeofday(&tp, NULL); + gettimeofday(&tp, nullptr); return (tp.tv_sec * 1000000) + (tp.tv_usec); } @@ -292,7 +292,7 @@ uint32_t ImsMediaTimer::GenerateRandom(uint32_t nRange) uint32_t rand; struct timeval tp; - gettimeofday(&tp, NULL); + gettimeofday(&tp, nullptr); rand = (tp.tv_sec * 13) + (tp.tv_usec / 1000); if (0 == nRange) diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaTrace.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaTrace.cpp index 7ddede69..0de73ed1 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaTrace.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaTrace.cpp @@ -40,14 +40,14 @@ static uint IM_remove_log = 1; vsnprintf(szBuffer, TRACEMAXSTRING, format, args); \ va_end(args); \ android_printLog(IMLOGTYPE, TAG, "%s", szBuffer); \ - FILE* fp_IM_log = NULL; \ + FILE* fp_IM_log = nullptr; \ if (IM_remove_log) \ { \ remove(IM_LOG_FILE); \ IM_remove_log = 0; \ } \ fp_IM_log = fopen(IM_LOG_FILE, "a+"); \ - if (fp_IM_log != NULL) \ + if (fp_IM_log != nullptr) \ { \ fprintf(fp_IM_log, "%s", szBuffer); \ fclose(fp_IM_log); \ @@ -175,7 +175,7 @@ void ImsMediaTrace::IMLOGD_BINARY(const char* msg, const char* s, int length) char* IM_Strrchr(char* pszSrc, char cChar) { - char* pszDest = NULL; + char* pszDest = nullptr; do { if (*pszSrc == cChar) @@ -194,7 +194,7 @@ char* IM_Strrchr(char* pszSrc, char cChar) char* ImsMediaTrace::IM_StripFileName(char* pcFileName) { - char* pcTemp = NULL; + char* pcTemp = nullptr; pcTemp = IM_Strrchr(pcFileName, '/'); if (pcTemp) diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/ImsMediaVideoUtil.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/ImsMediaVideoUtil.cpp index 596e8e1c..817a1153 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/ImsMediaVideoUtil.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/ImsMediaVideoUtil.cpp @@ -112,7 +112,7 @@ ImsMediaResult ImsMediaVideoUtil::ParseAvcSpropParam(const char* szSpropparam, t uint8_t* pszSpropparam = reinterpret_cast<uint8_t*>(malloc(nSPSConfigSize)); - if (pszSpropparam == NULL) + if (pszSpropparam == nullptr) { pInfo->nProfile = 0; pInfo->nLevel = 0; @@ -258,7 +258,7 @@ ImsMediaResult ImsMediaVideoUtil::ParseHevcSpropParam(const char* szSpropparam, memset(pSPSConfig, 0x00, MAX_CONFIG_LEN); strlcpy(pSPSConfig, szSpropparam, MAX_CONFIG_LEN); - uint8_t* pszSpropparam = NULL; + uint8_t* pszSpropparam = nullptr; if (ImsMediaBinaryFormat::Base00ToBinary(pbSPSConfig, &nSPSConfigSize, MAX_CONFIG_LEN, pSPSConfig, BINARY_FORMAT_BASE64) == false) @@ -272,7 +272,7 @@ ImsMediaResult ImsMediaVideoUtil::ParseHevcSpropParam(const char* szSpropparam, pszSpropparam = reinterpret_cast<uint8_t*>(malloc(nSPSConfigSize)); - if (pszSpropparam == NULL) + if (pszSpropparam == nullptr) { pInfo->nProfile = 0; pInfo->nLevel = 0; @@ -424,7 +424,7 @@ bool ImsMediaVideoUtil::ParseAvcSps(uint8_t* pbBuffer, uint32_t nBufferSize, tCo uint32_t chroma_format_idc = 0; uint8_t* pszSPS = reinterpret_cast<uint8_t*>(malloc(nBufferSize)); - if (pszSPS == NULL) + if (pszSPS == nullptr) { pInfo->nProfile = 0; pInfo->nLevel = 0; @@ -566,7 +566,7 @@ bool ImsMediaVideoUtil::ParseAvcSps(uint8_t* pbBuffer, uint32_t nBufferSize, tCo bool ImsMediaVideoUtil::ParseHevcSps(uint8_t* pbBuffer, uint32_t nBufferSize, tCodecConfig* pInfo) { - if (pbBuffer == NULL || nBufferSize == 0) + if (pbBuffer == nullptr || nBufferSize == 0) { pInfo->nProfile = 0; pInfo->nLevel = 0; @@ -708,15 +708,15 @@ uint8_t* FindAvcStartCode(uint8_t* pData, uint32_t nDataSize, uint32_t* pnSkipSi if (pnSkipSize) *pnSkipSize = nSkipSize; - return NULL; + return nullptr; } char* ImsMediaVideoUtil::GenerateVideoSprop(VideoConfig* pVideoConfig) { - if (pVideoConfig == NULL) + if (pVideoConfig == nullptr) { IMLOGE0("[GenerateVideoSprop] pVideoConfig is null"); - return NULL; + return nullptr; } // Configure Encoder @@ -754,22 +754,22 @@ char* ImsMediaVideoUtil::GenerateVideoSprop(VideoConfig* pVideoConfig) pVideoConfig->getResolutionWidth() * pVideoConfig->getResolutionHeight() * 10); AMediaCodec* pCodec = AMediaCodec_createEncoderByType(kMimeType); - if (pCodec == NULL) + if (pCodec == nullptr) { IMLOGE1("[GenerateVideoSprop] Unable to create encoder. MimeType[%s]", kMimeType); - return NULL; + return nullptr; } - media_status_t err = - AMediaCodec_configure(pCodec, pFormat, NULL, NULL, AMEDIACODEC_CONFIGURE_FLAG_ENCODE); + media_status_t err = AMediaCodec_configure( + pCodec, pFormat, nullptr, nullptr, AMEDIACODEC_CONFIGURE_FLAG_ENCODE); if (err != AMEDIA_OK) { IMLOGE1("[GenerateVideoSprop] Encoder configure error[%d]", err); AMediaCodec_delete(pCodec); - pCodec = NULL; + pCodec = nullptr; AMediaFormat_delete(pFormat); - pFormat = NULL; - return NULL; + pFormat = nullptr; + return nullptr; } err = AMediaCodec_start(pCodec); @@ -777,10 +777,10 @@ char* ImsMediaVideoUtil::GenerateVideoSprop(VideoConfig* pVideoConfig) { IMLOGE1("[GenerateVideoSprop] Encoder start Err[%d]", err); AMediaCodec_delete(pCodec); - pCodec = NULL; + pCodec = nullptr; AMediaFormat_delete(pFormat); - pFormat = NULL; - return NULL; + pFormat = nullptr; + return nullptr; } bool bSpsRead = false, bPpsRead = false; @@ -804,17 +804,17 @@ char* ImsMediaVideoUtil::GenerateVideoSprop(VideoConfig* pVideoConfig) buf += info.offset; buffCapacity = info.size; - while (buf != NULL && buffCapacity > 0) + while (buf != nullptr && buffCapacity > 0) { uint32_t skipLen = 0; uint8_t* tempBufPtr = FindAvcStartCode(buf, buffCapacity, &skipLen); - if (tempBufPtr != NULL) + if (tempBufPtr != nullptr) { buf = tempBufPtr; buffCapacity -= skipLen; } - if (buf == NULL || buffCapacity < START_CODE_PREFIX_LEN) + if (buf == nullptr || buffCapacity < START_CODE_PREFIX_LEN) continue; // Remove start sequence @@ -826,7 +826,7 @@ char* ImsMediaVideoUtil::GenerateVideoSprop(VideoConfig* pVideoConfig) // Extract frame int frameLen = buffCapacity; tempBufPtr = FindAvcStartCode(buf, buffCapacity, &skipLen); - if (tempBufPtr != NULL) + if (tempBufPtr != nullptr) { frameLen = tempBufPtr - buf; } @@ -838,7 +838,7 @@ char* ImsMediaVideoUtil::GenerateVideoSprop(VideoConfig* pVideoConfig) { IMLOGE0("[GenerateVideoSprop] BinaryToBase64 failed"); free(pSpropStr); - pSpropStr = NULL; + pSpropStr = nullptr; AMediaCodec_releaseOutputBuffer(pCodec, index, false); goto JP_Exit_GenerateSprop; } @@ -869,14 +869,14 @@ char* ImsMediaVideoUtil::GenerateVideoSprop(VideoConfig* pVideoConfig) if (--nMaxBufferReads <= 0) { free(pSpropStr); - pSpropStr = NULL; + pSpropStr = nullptr; goto JP_Exit_GenerateSprop; } } JP_Exit_GenerateSprop: // Stop Encoder - if (pCodec != NULL) + if (pCodec != nullptr) { IMLOGD0("[GenerateVideoSprop] Stop encoder"); AMediaCodec_signalEndOfInputStream(pCodec); @@ -884,7 +884,7 @@ JP_Exit_GenerateSprop: AMediaCodec_delete(pCodec); } - if (pFormat != NULL) + if (pFormat != nullptr) { AMediaFormat_delete(pFormat); } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoJitterBuffer.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoJitterBuffer.cpp index 2bf0129e..000f6e66 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoJitterBuffer.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoJitterBuffer.cpp @@ -34,7 +34,7 @@ VideoJitterBuffer::VideoJitterBuffer() : BaseJitterBuffer() { // base member valuable - mCallback = NULL; + mCallback = nullptr; mCodecType = kVideoCodecAvc; mInitJitterBufferSize = 0; mMinJitterBufferSize = 0; @@ -63,18 +63,18 @@ VideoJitterBuffer::VideoJitterBuffer() : mLossDuration = DEFAULT_PACKET_LOSS_MONITORING_TIME; mLossRateThreshold = 0; mCountTimerExpired = 0; - mTimer = NULL; + mTimer = nullptr; } VideoJitterBuffer::~VideoJitterBuffer() { InitLostPktList(); - if (mTimer != NULL) + if (mTimer != nullptr) { IMLOGD0("[~VideoJitterBuffer] stop timer"); - ImsMediaTimer::TimerStop(mTimer, NULL); - mTimer = NULL; + ImsMediaTimer::TimerStop(mTimer, nullptr); + mTimer = nullptr; } } @@ -108,7 +108,7 @@ void VideoJitterBuffer::InitLostPktList() { LostPktEntry* entry = mLostPktList.front(); - if (entry != NULL) + if (entry != nullptr) { delete entry; } @@ -139,7 +139,7 @@ void VideoJitterBuffer::StartTimer(uint32_t time, uint32_t rate) { IMLOGD2("[StartTimer] time[%d], rate[%u]", time, rate); - if (mTimer == NULL) + if (mTimer == nullptr) { IMLOGD0("[StartTimer] timer start"); mTimer = ImsMediaTimer::TimerStart(1000, true, OnTimer, this); @@ -148,16 +148,16 @@ void VideoJitterBuffer::StartTimer(uint32_t time, uint32_t rate) void VideoJitterBuffer::StopTimer() { - if (mTimer != NULL) + if (mTimer != nullptr) { IMLOGD0("[StopTimer] stop timer"); - if (ImsMediaTimer::TimerStop(mTimer, NULL) == false) + if (ImsMediaTimer::TimerStop(mTimer, nullptr) == false) { IMLOGE0("[StopTimer] stop timer error"); } - mTimer = NULL; + mTimer = nullptr; } } @@ -233,7 +233,7 @@ void VideoJitterBuffer::Add(ImsMediaSubType subtype, uint8_t* pbBuffer, uint32_t DataEntry* pEntry; mDataQueue.GetLast(&pEntry); - if (pEntry == NULL) + if (pEntry == nullptr) { return; } @@ -311,7 +311,7 @@ bool VideoJitterBuffer::Get(ImsMediaSubType* subtype, uint8_t** ppData, uint32_t { (void)pnChecker; - DataEntry* pEntry = NULL; + DataEntry* pEntry = nullptr; bool bValidPacket = false; std::lock_guard<std::mutex> guard(mMutex); @@ -426,7 +426,7 @@ bool VideoJitterBuffer::Get(ImsMediaSubType* subtype, uint8_t** ppData, uint32_t DataEntry* pValidEntry; mDataQueue.GetAt(i, &pValidEntry); - if (pValidEntry == NULL) + if (pValidEntry == nullptr) { return false; } @@ -453,7 +453,7 @@ bool VideoJitterBuffer::Get(ImsMediaSubType* subtype, uint8_t** ppData, uint32_t mDataQueue.Get(&pEntry); - if (pEntry == NULL) + if (pEntry == nullptr) return false; if (pEntry->bValid == false) @@ -474,7 +474,7 @@ bool VideoJitterBuffer::Get(ImsMediaSubType* subtype, uint8_t** ppData, uint32_t mDataQueue.Delete(); mDataQueue.Get(&pEntry); // next packet - if (pEntry == NULL) + if (pEntry == nullptr) { break; } @@ -494,7 +494,7 @@ bool VideoJitterBuffer::Get(ImsMediaSubType* subtype, uint8_t** ppData, uint32_t { mDataQueue.Get(&pEntry); - if (pEntry == NULL) + if (pEntry == nullptr) { return false; } @@ -571,7 +571,7 @@ bool VideoJitterBuffer::Get(ImsMediaSubType* subtype, uint8_t** ppData, uint32_t bValidPacket = false; } - if (bValidPacket && pEntry != NULL) + if (bValidPacket && pEntry != nullptr) { if (subtype) *subtype = pEntry->subtype; @@ -600,7 +600,7 @@ bool VideoJitterBuffer::Get(ImsMediaSubType* subtype, uint8_t** ppData, uint32_t if (subtype) *subtype = MEDIASUBTYPE_UNDEFINED; if (ppData) - *ppData = NULL; + *ppData = nullptr; if (pnDataSize) *pnDataSize = 0; if (pnTimestamp) @@ -618,7 +618,7 @@ bool VideoJitterBuffer::Get(ImsMediaSubType* subtype, uint8_t** ppData, uint32_t void VideoJitterBuffer::CheckValidIDR(DataEntry* pIDREntry) { - if (pIDREntry == NULL) + if (pIDREntry == nullptr) { return; } @@ -645,7 +645,7 @@ void VideoJitterBuffer::Delete() std::lock_guard<std::mutex> guard(mMutex); mDataQueue.Get(&pEntry); - if (pEntry == NULL) + if (pEntry == nullptr) { return; } @@ -669,7 +669,7 @@ uint32_t VideoJitterBuffer::GetCount() bool VideoJitterBuffer::CheckHeader(uint8_t* pbBuffer) { - if (pbBuffer == NULL) + if (pbBuffer == nullptr) { return false; } @@ -688,14 +688,14 @@ bool VideoJitterBuffer::CheckHeader(uint8_t* pbBuffer) void VideoJitterBuffer::RemovePacketFromLostList(uint16_t seqNum, bool bRemoveOldPacket) { - LostPktEntry* pEntry = NULL; + LostPktEntry* pEntry = nullptr; std::list<LostPktEntry*>::iterator it = mLostPktList.begin(); while (it != mLostPktList.end()) { pEntry = *it; - if (pEntry == NULL) + if (pEntry == nullptr) { mLostPktList.erase(it++); continue; @@ -800,7 +800,7 @@ void VideoJitterBuffer::CheckPacketLoss(uint16_t seqNum, uint16_t nLastRecvPkt) bool VideoJitterBuffer::UpdateLostPacketList( uint16_t lostSeq, uint16_t* countSecondNack, uint16_t* nPLIPkt, bool* bPLIPkt) { - LostPktEntry* foundLostPacket = NULL; + LostPktEntry* foundLostPacket = nullptr; auto result = std::find_if(mLostPktList.begin(), mLostPktList.end(), [lostSeq, &foundLostPacket](LostPktEntry* entry) { @@ -808,7 +808,7 @@ bool VideoJitterBuffer::UpdateLostPacketList( return (entry->seqNum == lostSeq); }); - if (result != mLostPktList.end() && foundLostPacket != NULL) + if (result != mLostPktList.end() && foundLostPacket != nullptr) { return UpdateNackStatus(foundLostPacket, lostSeq, countSecondNack, nPLIPkt, bPLIPkt); } @@ -920,7 +920,7 @@ void VideoJitterBuffer::OnTimer(hTimerHandler hTimer, void* pUserData) (void)hTimer; VideoJitterBuffer* jitter = reinterpret_cast<VideoJitterBuffer*>(pUserData); - if (jitter != NULL) + if (jitter != nullptr) { jitter->ProcessTimer(); } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoManager.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoManager.cpp index 297aa89d..bec6234f 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoManager.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoManager.cpp @@ -27,7 +27,7 @@ VideoManager::~VideoManager() {} VideoManager* VideoManager::getInstance() { - if (manager == NULL) + if (manager == nullptr) { manager = new VideoManager(); } @@ -174,7 +174,7 @@ void VideoManager::sendMessage(const int sessionId, const android::Parcel& parce { IMLOGE1("[sendMessage] error readFromParcel[%d]", err); delete config; - config = NULL; + config = nullptr; } EventParamOpenSession* param = new EventParamOpenSession(rtpFd, rtcpFd, config); @@ -265,7 +265,7 @@ void VideoManager::RequestHandler::processEvent( { EventParamOpenSession* param = reinterpret_cast<EventParamOpenSession*>(paramA); - if (param != NULL) + if (param != nullptr) { VideoConfig* pConfig = reinterpret_cast<VideoConfig*>(param->mConfig); result = VideoManager::getInstance()->openSession( @@ -284,7 +284,7 @@ void VideoManager::RequestHandler::processEvent( delete param; - if (pConfig != NULL) + if (pConfig != nullptr) { delete pConfig; } @@ -328,7 +328,7 @@ void VideoManager::RequestHandler::processEvent( { MediaQualityThreshold* threshold = reinterpret_cast<MediaQualityThreshold*>(paramA); - if (threshold != NULL) + if (threshold != nullptr) { VideoManager::getInstance()->setMediaQualityThreshold( static_cast<int>(sessionId), threshold); @@ -385,7 +385,7 @@ void VideoManager::ResponseHandler::processEvent( parcel.writeInt32(static_cast<int>(paramA)); // result VideoConfig* config = reinterpret_cast<VideoConfig*>(paramB); - if (config != NULL) + if (config != nullptr) { config->writeToParcel(&parcel); VideoManager::getInstance()->sendResponse(sessionId, parcel); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoSession.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoSession.cpp index 88b74abf..4fdb301c 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoSession.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoSession.cpp @@ -24,18 +24,18 @@ VideoSession::VideoSession() { IMLOGD0("[VideoSession]"); - mGraphRtpTx = NULL; - mGraphRtpRx = NULL; - mGraphRtcp = NULL; - mPreviewSurface = NULL; - mDisplaySurface = NULL; + mGraphRtpTx = nullptr; + mGraphRtpRx = nullptr; + mGraphRtcp = nullptr; + mPreviewSurface = nullptr; + mDisplaySurface = nullptr; } VideoSession::~VideoSession() { IMLOGD0("[~VideoSession]"); - if (mGraphRtpTx != NULL) + if (mGraphRtpTx != nullptr) { if (mGraphRtpTx->getState() == kStreamStateRunning) { @@ -43,10 +43,10 @@ VideoSession::~VideoSession() } delete mGraphRtpTx; - mGraphRtpTx = NULL; + mGraphRtpTx = nullptr; } - if (mGraphRtpRx != NULL) + if (mGraphRtpRx != nullptr) { if (mGraphRtpRx->getState() == kStreamStateRunning) { @@ -54,10 +54,10 @@ VideoSession::~VideoSession() } delete mGraphRtpRx; - mGraphRtpRx = NULL; + mGraphRtpRx = nullptr; } - if (mGraphRtcp != NULL) + if (mGraphRtcp != nullptr) { if (mGraphRtcp->getState() == kStreamStateRunning) { @@ -65,7 +65,7 @@ VideoSession::~VideoSession() } delete mGraphRtcp; - mGraphRtcp = NULL; + mGraphRtcp = nullptr; } } @@ -73,18 +73,18 @@ SessionState VideoSession::getState() { SessionState state = kSessionStateOpened; - if ((mGraphRtpTx != NULL && mGraphRtpTx->getState() == kStreamStateWaitSurface) || - (mGraphRtpRx != NULL && mGraphRtpRx->getState() == kStreamStateWaitSurface)) + if ((mGraphRtpTx != nullptr && mGraphRtpTx->getState() == kStreamStateWaitSurface) || + (mGraphRtpRx != nullptr && mGraphRtpRx->getState() == kStreamStateWaitSurface)) { return kSessionStateSuspended; } - else if ((mGraphRtpTx != NULL && mGraphRtpTx->getState() == kStreamStateRunning) || - (mGraphRtpRx != NULL && mGraphRtpRx->getState() == kStreamStateRunning)) + else if ((mGraphRtpTx != nullptr && mGraphRtpTx->getState() == kStreamStateRunning) || + (mGraphRtpRx != nullptr && mGraphRtpRx->getState() == kStreamStateRunning)) { return kSessionStateActive; } - if (mGraphRtcp != NULL && mGraphRtcp->getState() == kStreamStateRunning) + if (mGraphRtcp != nullptr && mGraphRtcp->getState() == kStreamStateRunning) { return kSessionStateSuspended; } @@ -96,7 +96,7 @@ ImsMediaResult VideoSession::startGraph(RtpConfig* config) { IMLOGI0("[startGraph]"); - if (config == NULL) + if (config == nullptr) { return RESULT_INVALID_PARAM; } @@ -104,7 +104,7 @@ ImsMediaResult VideoSession::startGraph(RtpConfig* config) VideoConfig* pConfig = reinterpret_cast<VideoConfig*>(config); ImsMediaResult ret = RESULT_NOT_READY; - if (mGraphRtpTx != NULL) + if (mGraphRtpTx != nullptr) { ret = mGraphRtpTx->update(config); @@ -114,7 +114,7 @@ ImsMediaResult VideoSession::startGraph(RtpConfig* config) return ret; } - if (mPreviewSurface != NULL) + if (mPreviewSurface != nullptr) { mGraphRtpTx->setSurface(mPreviewSurface); } @@ -145,7 +145,7 @@ ImsMediaResult VideoSession::startGraph(RtpConfig* config) return ret; } - if (mPreviewSurface != NULL) + if (mPreviewSurface != nullptr) { mGraphRtpTx->setSurface(mPreviewSurface); } @@ -158,7 +158,7 @@ ImsMediaResult VideoSession::startGraph(RtpConfig* config) return RESULT_SUCCESS; } - if (mGraphRtpRx != NULL) + if (mGraphRtpRx != nullptr) { mGraphRtpRx->setMediaQualityThreshold(&mThreshold); ret = mGraphRtpRx->update(config); @@ -169,7 +169,7 @@ ImsMediaResult VideoSession::startGraph(RtpConfig* config) return ret; } - if (mDisplaySurface != NULL) + if (mDisplaySurface != nullptr) { mGraphRtpRx->setSurface(mDisplaySurface); } @@ -192,14 +192,14 @@ ImsMediaResult VideoSession::startGraph(RtpConfig* config) return ret; } - if (mDisplaySurface != NULL) + if (mDisplaySurface != nullptr) { mGraphRtpRx->setSurface(mDisplaySurface); } } } - if (mGraphRtcp != NULL) + if (mGraphRtcp != nullptr) { mGraphRtcp->setMediaQualityThreshold(&mThreshold); ret = mGraphRtcp->update(config); @@ -287,14 +287,14 @@ void VideoSession::onEvent(int32_t type, uint64_t param1, uint64_t param2) ImsMediaResult VideoSession::setPreviewSurface(ANativeWindow* surface) { - if (surface == NULL) + if (surface == nullptr) { return RESULT_INVALID_PARAM; } mPreviewSurface = surface; - if (mGraphRtpTx != NULL) + if (mGraphRtpTx != nullptr) { mGraphRtpTx->setSurface(surface); } @@ -304,14 +304,14 @@ ImsMediaResult VideoSession::setPreviewSurface(ANativeWindow* surface) ImsMediaResult VideoSession::setDisplaySurface(ANativeWindow* surface) { - if (surface == NULL) + if (surface == nullptr) { return RESULT_INVALID_PARAM; } mDisplaySurface = surface; - if (mGraphRtpRx != NULL) + if (mGraphRtpRx != nullptr) { mGraphRtpRx->setSurface(surface); } @@ -328,7 +328,7 @@ void VideoSession::SendInternalEvent(int32_t type, uint64_t param1, uint64_t par case kRequestVideoCvoUpdate: case kRequestVideoBitrateChange: case kRequestVideoIdrFrame: - if (mGraphRtpTx != NULL) + if (mGraphRtpTx != nullptr) { if (!mGraphRtpTx->OnEvent(type, param1, param2)) { @@ -340,7 +340,7 @@ void VideoSession::SendInternalEvent(int32_t type, uint64_t param1, uint64_t par case kRequestVideoSendPictureLost: case kRequestVideoSendTmmbr: case kRequestVideoSendTmmbn: - if (mGraphRtcp != NULL) + if (mGraphRtcp != nullptr) { if (!mGraphRtcp->OnEvent(type, param1, param2)) { @@ -349,7 +349,7 @@ void VideoSession::SendInternalEvent(int32_t type, uint64_t param1, uint64_t par } break; case kRequestRoundTripTimeDelayUpdate: - if (mGraphRtpRx != NULL) + if (mGraphRtpRx != nullptr) { if (!mGraphRtpRx->OnEvent(type, param1, param2)) { diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoStreamGraphRtcp.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoStreamGraphRtcp.cpp index da8c5411..28ef246a 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoStreamGraphRtcp.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoStreamGraphRtcp.cpp @@ -34,7 +34,7 @@ ImsMediaResult VideoStreamGraphRtcp::create(RtpConfig* config) { IMLOGI1("[create] state[%d]", mGraphState); - if (config == NULL) + if (config == nullptr) { return RESULT_INVALID_PARAM; } @@ -85,7 +85,7 @@ ImsMediaResult VideoStreamGraphRtcp::update(RtpConfig* config) { IMLOGI1("[update] state[%d]", mGraphState); - if (config == NULL) + if (config == nullptr) { return RESULT_INVALID_PARAM; } @@ -98,7 +98,7 @@ ImsMediaResult VideoStreamGraphRtcp::update(RtpConfig* config) return RESULT_SUCCESS; } - if (mConfig != NULL) + if (mConfig != nullptr) { delete mConfig; } @@ -114,7 +114,7 @@ ImsMediaResult VideoStreamGraphRtcp::update(RtpConfig* config) for (auto& node : mListNodeStarted) { - if (node != NULL) + if (node != nullptr) { IMLOGD1("[update] update node[%s]", node->GetNodeName()); ret = node->UpdateConfig(pConfig); @@ -142,11 +142,11 @@ ImsMediaResult VideoStreamGraphRtcp::update(RtpConfig* config) bool VideoStreamGraphRtcp::setMediaQualityThreshold(MediaQualityThreshold* threshold) { - if (threshold != NULL) + if (threshold != nullptr) { BaseNode* node = findNode(kNodeIdRtcpDecoder); - if (node != NULL) + if (node != nullptr) { RtcpDecoderNode* decoder = reinterpret_cast<RtcpDecoderNode*>(node); decoder->SetInactivityTimerSec(threshold->getRtcpInactivityTimerMillis() / 1000); @@ -173,7 +173,7 @@ bool VideoStreamGraphRtcp::OnEvent(int32_t type, uint64_t param1, uint64_t param BaseNode* node = findNode(kNodeIdRtcpEncoder); InternalRequestEventParam* param = reinterpret_cast<InternalRequestEventParam*>(param1); - if (node != NULL && param != NULL) + if (node != nullptr && param != nullptr) { RtcpEncoderNode* encoder = reinterpret_cast<RtcpEncoderNode*>(node); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoStreamGraphRtpRx.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoStreamGraphRtpRx.cpp index 1a42aa76..bdee438f 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoStreamGraphRtpRx.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoStreamGraphRtpRx.cpp @@ -26,7 +26,7 @@ VideoStreamGraphRtpRx::VideoStreamGraphRtpRx(BaseSessionCallback* callback, int localFd) : VideoStreamGraph(callback, localFd) { - mSurface = NULL; + mSurface = nullptr; } VideoStreamGraphRtpRx::~VideoStreamGraphRtpRx() {} @@ -35,7 +35,7 @@ ImsMediaResult VideoStreamGraphRtpRx::create(RtpConfig* config) { IMLOGI1("[create] state[%d]", mGraphState); - if (config == NULL) + if (config == nullptr) { return RESULT_INVALID_PARAM; } @@ -81,7 +81,7 @@ ImsMediaResult VideoStreamGraphRtpRx::update(RtpConfig* config) { IMLOGI1("[update] state[%d]", mGraphState); - if (config == NULL) + if (config == nullptr) { return RESULT_INVALID_PARAM; } @@ -99,10 +99,10 @@ ImsMediaResult VideoStreamGraphRtpRx::update(RtpConfig* config) setState(StreamState::kStreamStateCreated); } - if (mConfig != NULL) + if (mConfig != nullptr) { delete mConfig; - mConfig = NULL; + mConfig = nullptr; } mConfig = new VideoConfig(pConfig); @@ -123,7 +123,7 @@ ImsMediaResult VideoStreamGraphRtpRx::update(RtpConfig* config) for (auto& node : mListNodeStarted) { - if (node != NULL) + if (node != nullptr) { IMLOGD1("[update] update node[%s]", node->GetNodeName()); ret = node->UpdateConfig(mConfig); @@ -140,7 +140,7 @@ ImsMediaResult VideoStreamGraphRtpRx::update(RtpConfig* config) { for (auto& node : mListNodeToStart) { - if (node != NULL) + if (node != nullptr) { IMLOGD1("[update] update node[%s]", node->GetNodeName()); ret = node->UpdateConfig(mConfig); @@ -168,7 +168,7 @@ ImsMediaResult VideoStreamGraphRtpRx::start() { IMLOGI1("[start] state[%d]", mGraphState); - if (mConfig == NULL) + if (mConfig == nullptr) { return RESULT_INVALID_PARAM; } @@ -183,7 +183,7 @@ ImsMediaResult VideoStreamGraphRtpRx::start() return RESULT_SUCCESS; } - if (mSurface == NULL) + if (mSurface == nullptr) { IMLOGI2("[start] direction[%d], mode[%d], surface is not ready, wait", pConfig->getMediaDirection(), pConfig->getVideoMode()); @@ -206,11 +206,11 @@ ImsMediaResult VideoStreamGraphRtpRx::start() bool VideoStreamGraphRtpRx::setMediaQualityThreshold(MediaQualityThreshold* threshold) { - if (threshold != NULL) + if (threshold != nullptr) { BaseNode* node = findNode(kNodeIdRtpDecoder); - if (node != NULL) + if (node != nullptr) { RtpDecoderNode* decoder = reinterpret_cast<RtpDecoderNode*>(node); decoder->SetInactivityTimerSec(threshold->getRtpInactivityTimerMillis() / 1000); @@ -219,7 +219,7 @@ bool VideoStreamGraphRtpRx::setMediaQualityThreshold(MediaQualityThreshold* thre node = findNode(kNodeIdVideoRenderer); - if (node != NULL) + if (node != nullptr) { IVideoRendererNode* decoder = reinterpret_cast<IVideoRendererNode*>(node); decoder->SetPacketLossParam( @@ -235,13 +235,13 @@ void VideoStreamGraphRtpRx::setSurface(ANativeWindow* surface) { IMLOGD0("[setSurface]"); - if (surface != NULL) + if (surface != nullptr) { mSurface = surface; BaseNode* node = findNode(kNodeIdVideoRenderer); - if (node != NULL) + if (node != nullptr) { IVideoRendererNode* renderer = reinterpret_cast<IVideoRendererNode*>(node); renderer->UpdateSurface(surface); @@ -265,7 +265,7 @@ bool VideoStreamGraphRtpRx::OnEvent(int32_t type, uint64_t param1, uint64_t para { BaseNode* node = findNode(kNodeIdVideoRenderer); - if (node != NULL) + if (node != nullptr) { IVideoRendererNode* pNode = reinterpret_cast<IVideoRendererNode*>(node); pNode->UpdateRoundTripTimeDelay(param1); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoStreamGraphRtpTx.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoStreamGraphRtpTx.cpp index 01796e47..ea3d4654 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoStreamGraphRtpTx.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoStreamGraphRtpTx.cpp @@ -26,7 +26,7 @@ VideoStreamGraphRtpTx::VideoStreamGraphRtpTx(BaseSessionCallback* callback, int localFd) : VideoStreamGraph(callback, localFd) { - mSurface = NULL; + mSurface = nullptr; mVideoMode = -1; } @@ -36,7 +36,7 @@ ImsMediaResult VideoStreamGraphRtpTx::create(RtpConfig* config) { IMLOGI1("[create] state[%d]", mGraphState); - if (config == NULL) + if (config == nullptr) { return RESULT_INVALID_PARAM; } @@ -48,10 +48,10 @@ ImsMediaResult VideoStreamGraphRtpTx::create(RtpConfig* config) return createPreviewMode(pConfig); } - if (mConfig != NULL) + if (mConfig != nullptr) { delete mConfig; - mConfig = NULL; + mConfig = nullptr; } mConfig = new VideoConfig(pConfig); @@ -97,7 +97,7 @@ ImsMediaResult VideoStreamGraphRtpTx::update(RtpConfig* config) { IMLOGI2("[update] current mode[%d], state[%d]", mVideoMode, mGraphState); - if (config == NULL) + if (config == nullptr) { return RESULT_INVALID_PARAM; } @@ -115,10 +115,10 @@ ImsMediaResult VideoStreamGraphRtpTx::update(RtpConfig* config) setState(kStreamStateCreated); } - if (mConfig != NULL) + if (mConfig != nullptr) { delete mConfig; - mConfig = NULL; + mConfig = nullptr; } ImsMediaResult result = RESULT_NOT_READY; @@ -136,7 +136,7 @@ ImsMediaResult VideoStreamGraphRtpTx::update(RtpConfig* config) /** delete nodes */ deleteNodes(); - mSurface = NULL; + mSurface = nullptr; /** create nodes */ result = create(pConfig); @@ -159,7 +159,7 @@ ImsMediaResult VideoStreamGraphRtpTx::update(RtpConfig* config) return stop(); } - if (pConfig->getVideoMode() != VideoConfig::VIDEO_MODE_PAUSE_IMAGE && mSurface == NULL) + if (pConfig->getVideoMode() != VideoConfig::VIDEO_MODE_PAUSE_IMAGE && mSurface == nullptr) { IMLOGI2("[update] direction[%d], mode[%d], surface is not ready, wait", pConfig->getMediaDirection(), pConfig->getVideoMode()); @@ -196,7 +196,7 @@ ImsMediaResult VideoStreamGraphRtpTx::start() { IMLOGI2("[start] current mode[%d], state[%d]", mVideoMode, mGraphState); - if (mConfig == NULL) + if (mConfig == nullptr) { return RESULT_INVALID_PARAM; } @@ -212,7 +212,7 @@ ImsMediaResult VideoStreamGraphRtpTx::start() return RESULT_SUCCESS; } - if (pConfig->getVideoMode() != VideoConfig::VIDEO_MODE_PAUSE_IMAGE && mSurface == NULL) + if (pConfig->getVideoMode() != VideoConfig::VIDEO_MODE_PAUSE_IMAGE && mSurface == nullptr) { IMLOGI2("[start] direction[%d], mode[%d], surface is not ready, wait", pConfig->getMediaDirection(), pConfig->getVideoMode()); @@ -238,13 +238,13 @@ void VideoStreamGraphRtpTx::setSurface(ANativeWindow* surface) { IMLOGI1("[setSurface] state[%d]", mGraphState); - if (surface != NULL) + if (surface != nullptr) { mSurface = surface; BaseNode* node = findNode(kNodeIdVideoSource); - if (node != NULL) + if (node != nullptr) { IVideoSourceNode* source = reinterpret_cast<IVideoSourceNode*>(node); source->UpdateSurface(surface); @@ -264,15 +264,15 @@ void VideoStreamGraphRtpTx::setSurface(ANativeWindow* surface) ImsMediaResult VideoStreamGraphRtpTx::createPreviewMode(RtpConfig* config) { - if (config == NULL) + if (config == nullptr) { return RESULT_INVALID_PARAM; } - if (mConfig != NULL) + if (mConfig != nullptr) { delete mConfig; - mConfig = NULL; + mConfig = nullptr; } IMLOGI0("[createPreviewMode]"); @@ -299,7 +299,7 @@ ImsMediaResult VideoStreamGraphRtpTx::updateNodes(RtpConfig* config) for (auto& node : mListNodeStarted) { - if (node != NULL) + if (node != nullptr) { IMLOGD1("[updateNodes] update node[%s]", node->GetNodeName()); result = node->UpdateConfig(config); @@ -319,7 +319,7 @@ ImsMediaResult VideoStreamGraphRtpTx::updateNodes(RtpConfig* config) { for (auto& node : mListNodeToStart) { - if (node != NULL) + if (node != nullptr) { IMLOGD1("[updateNodes] update node[%s]", node->GetNodeName()); result = node->UpdateConfig(config); @@ -347,7 +347,7 @@ bool VideoStreamGraphRtpTx::OnEvent(int32_t type, uint64_t param1, uint64_t para { BaseNode* node = findNode(kNodeIdRtpEncoder); - if (node != NULL) + if (node != nullptr) { RtpEncoderNode* pNode = reinterpret_cast<RtpEncoderNode*>(node); return pNode->SetCvoExtension(param1, param2); @@ -361,7 +361,7 @@ bool VideoStreamGraphRtpTx::OnEvent(int32_t type, uint64_t param1, uint64_t para { BaseNode* node = findNode(kNodeIdVideoSource); - if (node != NULL) + if (node != nullptr) { IVideoSourceNode* pNode = reinterpret_cast<IVideoSourceNode*>(node); pNode->OnEvent(type, param1, param2); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/android/ImsMediaCamera.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/android/ImsMediaCamera.cpp index e1cfe771..d2fa1e8b 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/android/ImsMediaCamera.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/android/ImsMediaCamera.cpp @@ -85,9 +85,9 @@ ImsMediaCamera* ImsMediaCamera::getInstance() } ImsMediaCamera::ImsMediaCamera() : - mManager(NULL), - mSessionOutputContainer(NULL), - mCaptureSession(NULL), + mManager(nullptr), + mSessionOutputContainer(nullptr), + mCaptureSession(nullptr), mCaptureSessionState(CaptureSessionState::kStateMax), mExposureTime(0), mSensitivity(0), @@ -112,7 +112,7 @@ void ImsMediaCamera::Initialize() gCameraIds.clear(); mManager = ACameraManager_create(); - if (mManager == NULL) + if (mManager == nullptr) { IMLOGD0("[Initialize] manager is not created"); return; @@ -147,7 +147,7 @@ void ImsMediaCamera::DeInitialize() } ACameraManager_delete(mManager); - mManager = NULL; + mManager = nullptr; } gCameraIds.clear(); @@ -170,7 +170,7 @@ void ImsMediaCamera::DeInitialize() } ACameraManager_delete(mManager); - mManager = NULL; + mManager = nullptr; } gCameraIds.clear(); @@ -180,7 +180,7 @@ bool ImsMediaCamera::OpenCamera() { IMLOGD1("[OpenCamera] active camera[%s]", mActiveCameraId.c_str()); - if (mManager == NULL) + if (mManager == nullptr) { return false; } @@ -280,7 +280,7 @@ void ImsMediaCamera::SetCameraConfig(int32_t cameraId, int32_t cameraZoom, int32 bool ImsMediaCamera::CreateSession(ANativeWindow* preview, ANativeWindow* recording) { - if (preview == NULL) + if (preview == nullptr) { return false; } @@ -293,7 +293,7 @@ bool ImsMediaCamera::CreateSession(ANativeWindow* preview, ANativeWindow* record mCaptureRequest.outputNativeWindows.push_back(preview); - if (recording != NULL) + if (recording != nullptr) { mCaptureRequest.outputNativeWindows.push_back(recording); } @@ -302,8 +302,8 @@ bool ImsMediaCamera::CreateSession(ANativeWindow* preview, ANativeWindow* record mCaptureRequest.targets.resize(mCaptureRequest.outputNativeWindows.size()); // Create output from this app's ANativeWindow, and add into output container - recording == NULL ? mCaptureRequest.requestTemplate = TEMPLATE_PREVIEW - : mCaptureRequest.requestTemplate = TEMPLATE_RECORD; + recording == nullptr ? mCaptureRequest.requestTemplate = TEMPLATE_PREVIEW + : mCaptureRequest.requestTemplate = TEMPLATE_RECORD; camera_status_t status = ACaptureSessionOutputContainer_create(&mSessionOutputContainer); @@ -315,7 +315,7 @@ bool ImsMediaCamera::CreateSession(ANativeWindow* preview, ANativeWindow* record for (int idxTarget = 0; idxTarget < mCaptureRequest.outputNativeWindows.size(); idxTarget++) { - if (mCaptureRequest.outputNativeWindows[idxTarget] == NULL) + if (mCaptureRequest.outputNativeWindows[idxTarget] == nullptr) continue; IMLOGD0("[CreateSession] acquire window"); @@ -366,7 +366,7 @@ bool ImsMediaCamera::CreateSession(ANativeWindow* preview, ANativeWindow* record if (status != ACAMERA_OK) { IMLOGE1("[CreateSession] create capture session, error[%s]", GetErrorStr(status)); - mCaptureSession = NULL; + mCaptureSession = nullptr; return false; } @@ -386,18 +386,18 @@ bool ImsMediaCamera::DeleteSession() IMLOGD0("[DeleteSession]"); camera_status_t status; - if (mCaptureSession != NULL) + if (mCaptureSession != nullptr) { IMLOGD0("[DeleteSession] session close"); gCondition.reset(); ACameraCaptureSession_close(mCaptureSession); gCondition.wait_timeout(MAX_WAIT_CAMERA); - mCaptureSession = NULL; + mCaptureSession = nullptr; } for (int idxTarget = 0; idxTarget < mCaptureRequest.outputNativeWindows.size(); idxTarget++) { - if (mCaptureRequest.outputNativeWindows[idxTarget] == NULL) + if (mCaptureRequest.outputNativeWindows[idxTarget] == nullptr) { continue; } @@ -424,7 +424,7 @@ bool ImsMediaCamera::DeleteSession() ANativeWindow_release(mCaptureRequest.outputNativeWindows[idxTarget]); } - if (mCaptureRequest.request != NULL) + if (mCaptureRequest.request != nullptr) { IMLOGD0("[DeleteSession] free request"); ACaptureRequest_free(mCaptureRequest.request); @@ -434,7 +434,7 @@ bool ImsMediaCamera::DeleteSession() mCaptureRequest.sessionOutputs.resize(0); mCaptureRequest.targets.resize(0); - if (mSessionOutputContainer != NULL) + if (mSessionOutputContainer != nullptr) { IMLOGD0("[DeleteSession] free container"); ACaptureSessionOutputContainer_free(mSessionOutputContainer); @@ -452,7 +452,7 @@ bool ImsMediaCamera::StartSession(bool bRecording) gCondition.reset(); status = ACameraCaptureSession_setRepeatingRequest( - mCaptureSession, NULL, 1, &mCaptureRequest.request, NULL); + mCaptureSession, nullptr, 1, &mCaptureRequest.request, nullptr); if (status != ACAMERA_OK) { @@ -489,9 +489,9 @@ bool ImsMediaCamera::StopSession() */ void OnCameraAvailable(void* context, const char* id) { - IMLOGD1("[OnCameraAvailable] id[%s]", id == NULL ? "NULL" : id); + IMLOGD1("[OnCameraAvailable] id[%s]", id == nullptr ? "nullptr" : id); - if (context != NULL) + if (context != nullptr) { reinterpret_cast<ImsMediaCamera*>(context)->OnCameraStatusChanged(id, true); } @@ -499,9 +499,9 @@ void OnCameraAvailable(void* context, const char* id) void OnCameraUnavailable(void* context, const char* id) { - IMLOGD1("[OnCameraUnavailable] id[%s]", id == NULL ? "NULL" : id); + IMLOGD1("[OnCameraUnavailable] id[%s]", id == nullptr ? "nullptr" : id); - if (context != NULL) + if (context != nullptr) { reinterpret_cast<ImsMediaCamera*>(context)->OnCameraStatusChanged(id, false); } @@ -509,9 +509,10 @@ void OnCameraUnavailable(void* context, const char* id) void ImsMediaCamera::OnCameraStatusChanged(const char* id, bool available) { - IMLOGD2("[OnCameraStatusChanged] id[%s], available[%d]", id == NULL ? "NULL" : id, available); + IMLOGD2("[OnCameraStatusChanged] id[%s], available[%d]", id == nullptr ? "nullptr" : id, + available); - if (id != NULL && mManager != NULL && !gCameraIds.empty()) + if (id != nullptr && mManager != nullptr && !gCameraIds.empty()) { if (gCameraIds.find(std::string(id)) != gCameraIds.end()) { @@ -542,7 +543,7 @@ void OnDeviceStateChanges(void* context, ACameraDevice* dev) { IMLOGW0("[OnDeviceStateChanges]"); - if (context != NULL) + if (context != nullptr) { reinterpret_cast<ImsMediaCamera*>(context)->OnDeviceState(dev); } @@ -552,7 +553,7 @@ void OnDeviceErrorChanges(void* context, ACameraDevice* dev, int err) { IMLOGW0("[OnDeviceErrorChanges]"); - if (context != NULL) + if (context != nullptr) { reinterpret_cast<ImsMediaCamera*>(context)->OnDeviceError(dev, err); } @@ -647,7 +648,7 @@ void ImsMediaCamera::OnSessionState(ACameraCaptureSession* session, CaptureSessi { IMLOGD0("[OnSessionState]"); - if (mCaptureSession == NULL) + if (mCaptureSession == nullptr) { IMLOGW0("[OnSessionState] CaptureSession closed"); return; @@ -655,7 +656,7 @@ void ImsMediaCamera::OnSessionState(ACameraCaptureSession* session, CaptureSessi if (!session || session != mCaptureSession) { - IMLOGW1("[OnSessionState] CaptureSession is %s", (session ? "NOT our session" : "NULL")); + IMLOGW1("[OnSessionState] CaptureSession is %s", (session ? "NOT our session" : "nullptr")); return; } @@ -673,12 +674,12 @@ void ImsMediaCamera::OnSessionState(ACameraCaptureSession* session, CaptureSessi void ImsMediaCamera::EnumerateCamera() { - if (mManager == NULL) + if (mManager == nullptr) { return; } - ACameraIdList* cameraIds = NULL; + ACameraIdList* cameraIds = nullptr; auto ret = ACameraManager_getCameraIdList(mManager, &cameraIds); if (ret != ACAMERA_OK) @@ -693,7 +694,7 @@ void ImsMediaCamera::EnumerateCamera() ACameraManager_getCameraCharacteristics(mManager, id, &metadataObj); int32_t count = 0; - const uint32_t* tags = NULL; + const uint32_t* tags = nullptr; ACameraMetadata_getAllTags(metadataObj, &count, &tags); for (int tagIdx = 0; tagIdx < count; ++tagIdx) @@ -706,7 +707,7 @@ void ImsMediaCamera::EnumerateCamera() cam.mFacing = static_cast<acamera_metadata_enum_android_lens_facing_t>( lensInfo.data.u8[0]); cam.mOwner = false; - cam.mDevice = NULL; + cam.mDevice = nullptr; gCameraIds[cam.mId] = cam; IMLOGD2("[EnumerateCamera] cameraId[%s], facing[%d]", cam.mId.c_str(), cam.mFacing); } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/android/ImsMediaPauseImageSource.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/android/ImsMediaPauseImageSource.cpp index 1d91a426..29a472aa 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/android/ImsMediaPauseImageSource.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/android/ImsMediaPauseImageSource.cpp @@ -45,7 +45,7 @@ extern AAssetManager* gpAssetManager; ImsMediaPauseImageSource::ImsMediaPauseImageSource() { - mYuvImageBuffer = NULL; + mYuvImageBuffer = nullptr; mBufferSize = 0; } @@ -56,10 +56,10 @@ ImsMediaPauseImageSource::~ImsMediaPauseImageSource() void ImsMediaPauseImageSource::Uninitialize() { - if (mYuvImageBuffer != NULL) + if (mYuvImageBuffer != nullptr) { free(mYuvImageBuffer); - mYuvImageBuffer = NULL; + mYuvImageBuffer = nullptr; } } @@ -71,7 +71,7 @@ bool ImsMediaPauseImageSource::Initialize(int width, int height) // Decode JPEG image and save in YUV buffer. AAsset* asset = getImageAsset(); - if (asset == NULL) + if (asset == nullptr) { IMLOGE0("[ImsMediaPauseImageSource] Failed to open pause image"); return false; @@ -129,9 +129,9 @@ bool ImsMediaPauseImageSource::Initialize(int width, int height) size_t ImsMediaPauseImageSource::GetYuvImage(uint8_t* buffer, size_t len) { - if (buffer == NULL) + if (buffer == nullptr) { - IMLOGE0("[ImsMediaPauseImageSource] GetYuvImage. buffer == NULL"); + IMLOGE0("[ImsMediaPauseImageSource] GetYuvImage. buffer == nullptr"); return 0; } @@ -148,10 +148,10 @@ size_t ImsMediaPauseImageSource::GetYuvImage(uint8_t* buffer, size_t len) AAsset* ImsMediaPauseImageSource::getImageAsset() { IMLOGD0("[ImsMediaPauseImageSource] getImageFileFd"); - if (gpAssetManager == NULL) + if (gpAssetManager == nullptr) { - IMLOGE0("[ImsMediaPauseImageSource] AssetManager is NULL"); - return NULL; + IMLOGE0("[ImsMediaPauseImageSource] AssetManager is nullptr"); + return nullptr; } const char* filePath = getImageFilePath(); @@ -197,7 +197,7 @@ const char* ImsMediaPauseImageSource::getImageFilePath() IMLOGE2("Resolution [%dx%d] pause image is not available", mWidth, mHeight); } - return NULL; + return nullptr; } int8_t* ImsMediaPauseImageSource::ConvertRgbaToYuv(int8_t* pixels, int width, int height) diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/android/ImsMediaVideoRenderer.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/android/ImsMediaVideoRenderer.cpp index aba76314..a4fe774d 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/android/ImsMediaVideoRenderer.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/android/ImsMediaVideoRenderer.cpp @@ -25,10 +25,10 @@ ImsMediaVideoRenderer::ImsMediaVideoRenderer() { - mCallback = NULL; - mWindow = NULL; - mCodec = NULL; - mFormat = NULL; + mCallback = nullptr; + mWindow = nullptr; + mCodec = nullptr; + mFormat = nullptr; mCodecType = -1; mWidth = 0; mHeight = 0; @@ -99,25 +99,25 @@ bool ImsMediaVideoRenderer::Start() AMediaFormat_setInt32(mFormat, AMEDIAFORMAT_KEY_ROTATION, mFarOrientationDegree); mCodec = AMediaCodec_createDecoderByType(kMimeType); - if (mCodec == NULL) + if (mCodec == nullptr) { IMLOGE0("[Start] Unable to create decoder"); return false; } - if (mWindow != NULL) + if (mWindow != nullptr) { ANativeWindow_acquire(mWindow); } - media_status_t err = AMediaCodec_configure(mCodec, mFormat, mWindow, NULL, 0); + media_status_t err = AMediaCodec_configure(mCodec, mFormat, mWindow, nullptr, 0); if (err != AMEDIA_OK) { IMLOGE1("[Start] configure error[%d]", err); AMediaCodec_delete(mCodec); - mCodec = NULL; + mCodec = nullptr; AMediaFormat_delete(mFormat); - mFormat = NULL; + mFormat = nullptr; return false; } @@ -126,9 +126,9 @@ bool ImsMediaVideoRenderer::Start() { IMLOGE1("[Start] codec start[%d]", err); AMediaCodec_delete(mCodec); - mCodec = NULL; + mCodec = nullptr; AMediaFormat_delete(mFormat); - mFormat = NULL; + mFormat = nullptr; return false; } @@ -148,30 +148,30 @@ void ImsMediaVideoRenderer::Stop() mMutex.unlock(); mConditionExit.wait_timeout(MAX_WAIT_RESTART); - if (mCodec != NULL) + if (mCodec != nullptr) { AMediaCodec_signalEndOfInputStream(mCodec); AMediaCodec_stop(mCodec); AMediaCodec_delete(mCodec); - mCodec = NULL; + mCodec = nullptr; } - if (mWindow != NULL) + if (mWindow != nullptr) { ANativeWindow_release(mWindow); } - if (mFormat != NULL) + if (mFormat != nullptr) { AMediaFormat_delete(mFormat); - mFormat = NULL; + mFormat = nullptr; } } void ImsMediaVideoRenderer::OnDataFrame( uint8_t* buffer, uint32_t size, uint32_t timestamp, const bool isConfigFrame) { - if (size == 0 || buffer == NULL) + if (size == 0 || buffer == nullptr) { return; } @@ -179,7 +179,7 @@ void ImsMediaVideoRenderer::OnDataFrame( IMLOGD_PACKET2(IM_PACKET_LOG_VIDEO, "[OnDataFrame] frame size[%u], list[%d]", size, mFrameDatas.size()); std::lock_guard<std::mutex> guard(mMutex); - if (mCodec == NULL) + if (mCodec == nullptr) { return; } @@ -214,7 +214,7 @@ void ImsMediaVideoRenderer::processBuffers() { size_t bufferSize = 0; uint8_t* inputBuffer = AMediaCodec_getInputBuffer(mCodec, index, &bufferSize); - if (inputBuffer != NULL) + if (inputBuffer != nullptr) { FrameData* frame = mFrameDatas.front(); memcpy(inputBuffer, frame->data, frame->size); @@ -262,7 +262,7 @@ void ImsMediaVideoRenderer::processBuffers() } else if (index == AMEDIACODEC_INFO_OUTPUT_FORMAT_CHANGED) { - if (mFormat != NULL) + if (mFormat != nullptr) { AMediaFormat_delete(mFormat); } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/android/ImsMediaVideoSource.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/android/ImsMediaVideoSource.cpp index 8bda9434..ce4bc83d 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/android/ImsMediaVideoSource.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/android/ImsMediaVideoSource.cpp @@ -26,13 +26,13 @@ ImsMediaVideoSource::ImsMediaVideoSource() { - mCamera = NULL; - mWindow = NULL; - mCodec = NULL; - mFormat = NULL; - mRecordingSurface = NULL; - mImageReaderSurface = NULL; - mImageReader = NULL; + mCamera = nullptr; + mWindow = nullptr; + mCodec = nullptr; + mFormat = nullptr; + mRecordingSurface = nullptr; + mImageReaderSurface = nullptr; + mImageReader = nullptr; mCodecType = -1; mVideoMode = -1; mCodecProfile = 0; @@ -117,7 +117,7 @@ void ImsMediaVideoSource::SetDeviceOrientation(const uint32_t degree) int32_t sensorOrientation = 0; int32_t rotateDegree = 0; - if (mCamera != NULL) + if (mCamera != nullptr) { mCamera->GetSensorOrientation(mCameraId, &facing, &sensorOrientation); IMLOGD2("[SetDeviceOrientation] camera facing[%d], sensorOrientation[%d]", facing, @@ -151,7 +151,7 @@ void ImsMediaVideoSource::SetDeviceOrientation(const uint32_t degree) } } - if (mListener != NULL) + if (mListener != nullptr) { mListener->OnEvent(kVideoSourceEventUpdateOrientation, facing, rotateDegree); } @@ -164,7 +164,7 @@ void ImsMediaVideoSource::SetDeviceOrientation(const uint32_t degree) bool ImsMediaVideoSource::Start() { IMLOGD1("[Start], VideoMode[%d]", mVideoMode); - mRecordingSurface = NULL; + mRecordingSurface = nullptr; if (mVideoMode == kVideoModeRecording || mVideoMode == kVideoModePauseImage) { @@ -195,22 +195,22 @@ bool ImsMediaVideoSource::Start() mCodec = AMediaCodec_createEncoderByType(kMimeType); - if (mCodec == NULL) + if (mCodec == nullptr) { IMLOGE0("[Start] Unable to create encoder"); return false; } media_status_t err = AMediaCodec_configure( - mCodec, mFormat, NULL, NULL, AMEDIACODEC_CONFIGURE_FLAG_ENCODE); + mCodec, mFormat, nullptr, nullptr, AMEDIACODEC_CONFIGURE_FLAG_ENCODE); if (err != AMEDIA_OK) { IMLOGE1("[Start] configure error[%d]", err); AMediaCodec_delete(mCodec); - mCodec = NULL; + mCodec = nullptr; AMediaFormat_delete(mFormat); - mFormat = NULL; + mFormat = nullptr; return false; } @@ -222,9 +222,9 @@ bool ImsMediaVideoSource::Start() { IMLOGE1("[Start] create input surface error[%d]", err); AMediaCodec_delete(mCodec); - mCodec = NULL; + mCodec = nullptr; AMediaFormat_delete(mFormat); - mFormat = NULL; + mFormat = nullptr; return false; } } @@ -232,7 +232,7 @@ bool ImsMediaVideoSource::Start() { mImageReaderSurface = CreateImageReader(mWidth, mHeight); - if (mImageReaderSurface == NULL) + if (mImageReaderSurface == nullptr) { IMLOGE0("[Start] create image reader failed"); return false; @@ -245,9 +245,9 @@ bool ImsMediaVideoSource::Start() { IMLOGE1("[Start] codec start[%d]", err); AMediaCodec_delete(mCodec); - mCodec = NULL; + mCodec = nullptr; AMediaFormat_delete(mFormat); - mFormat = NULL; + mFormat = nullptr; return false; } } @@ -262,9 +262,9 @@ bool ImsMediaVideoSource::Start() { IMLOGE0("[Start] error open camera"); AMediaCodec_delete(mCodec); - mCodec = NULL; + mCodec = nullptr; AMediaFormat_delete(mFormat); - mFormat = NULL; + mFormat = nullptr; return false; } @@ -274,9 +274,9 @@ bool ImsMediaVideoSource::Start() { IMLOGE0("[Start] error create camera session"); AMediaCodec_delete(mCodec); - mCodec = NULL; + mCodec = nullptr; AMediaFormat_delete(mFormat); - mFormat = NULL; + mFormat = nullptr; mCamera->DeleteSession(); mCamera->DeInitialize(); return false; @@ -286,9 +286,9 @@ bool ImsMediaVideoSource::Start() { IMLOGE0("[Start] error camera start"); AMediaCodec_delete(mCodec); - mCodec = NULL; + mCodec = nullptr; AMediaFormat_delete(mFormat); - mFormat = NULL; + mFormat = nullptr; return false; } } @@ -298,7 +298,7 @@ bool ImsMediaVideoSource::Start() } // start encoder output thread - if (mCodec != NULL) + if (mCodec != nullptr) { mStopped = false; std::thread t1(&ImsMediaVideoSource::processOutputBuffer, this); @@ -318,47 +318,47 @@ void ImsMediaVideoSource::Stop() mStopped = true; mMutex.unlock(); - if (mCamera != NULL) + if (mCamera != nullptr) { mCamera->StopSession(); } IMLOGD0("[Stop] deinitialize camera"); - if (mCamera != NULL) + if (mCamera != nullptr) { mCamera->DeleteSession(); mCamera->DeInitialize(); - mCamera = NULL; + mCamera = nullptr; } - if (mCodec != NULL) + if (mCodec != nullptr) { AMediaCodec_signalEndOfInputStream(mCodec); AMediaCodec_stop(mCodec); - if (mRecordingSurface != NULL) + if (mRecordingSurface != nullptr) { ANativeWindow_release(mRecordingSurface); - mRecordingSurface = NULL; + mRecordingSurface = nullptr; } AMediaCodec_delete(mCodec); - mCodec = NULL; + mCodec = nullptr; } - if (mFormat != NULL) + if (mFormat != nullptr) { AMediaFormat_delete(mFormat); - mFormat = NULL; + mFormat = nullptr; } - if (mImageReader != NULL) + if (mImageReader != nullptr) { std::lock_guard<std::mutex> guard(mImageReaderMutex); AImageReader_delete(mImageReader); - mImageReader = NULL; - mImageReaderSurface = NULL; + mImageReader = nullptr; + mImageReaderSurface = nullptr; } mPauseImageSource.Uninitialize(); @@ -374,7 +374,7 @@ void ImsMediaVideoSource::onCameraFrame(AImage* pImage) { std::lock_guard<std::mutex> guard(mImageReaderMutex); - if (mImageReader == NULL || pImage == NULL) + if (mImageReader == nullptr || pImage == nullptr) { return; } @@ -545,9 +545,9 @@ void ImsMediaVideoSource::processOutputBuffer() size_t buffCapacity; uint8_t* buf = AMediaCodec_getOutputBuffer(mCodec, index, &buffCapacity); - if (buf != NULL && buffCapacity > 0) + if (buf != nullptr && buffCapacity > 0) { - if (mListener != NULL) + if (mListener != nullptr) { mListener->OnUplinkEvent( buf + info.offset, info.size, info.presentationTimeUs, info.flags); @@ -566,7 +566,7 @@ void ImsMediaVideoSource::processOutputBuffer() } else if (index == AMEDIACODEC_INFO_OUTPUT_FORMAT_CHANGED) { - if (mFormat != NULL) + if (mFormat != nullptr) { AMediaFormat_delete(mFormat); } @@ -600,7 +600,7 @@ void ImsMediaVideoSource::processOutputBuffer() static void ImageCallback(void* context, AImageReader* reader) { - if (context == NULL) + if (context == nullptr) { return; } @@ -631,7 +631,7 @@ ANativeWindow* ImsMediaVideoSource::CreateImageReader(int width, int height) if (status != AMEDIA_OK) { - return NULL; + return nullptr; } AImageReader_ImageListener listener{ diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/nodes/IVideoRendererNode.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/nodes/IVideoRendererNode.cpp index ee906c57..88713fd1 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/nodes/IVideoRendererNode.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/nodes/IVideoRendererNode.cpp @@ -40,7 +40,7 @@ IVideoRendererNode::IVideoRendererNode(BaseSessionCallback* callback) : mJitterBuffer->SetSessionCallback(mCallback); } - mWindow = NULL; + mWindow = nullptr; mCondition.reset(); mCodecType = DEFAULT_UNDEFINED; mWidth = 0; @@ -108,7 +108,7 @@ void IVideoRendererNode::Stop() mVideoRenderer->Stop(); } - if (mJitterBuffer != NULL) + if (mJitterBuffer != nullptr) { VideoJitterBuffer* jitter = reinterpret_cast<VideoJitterBuffer*>(mJitterBuffer); jitter->StopTimer(); @@ -129,7 +129,7 @@ bool IVideoRendererNode::IsSourceNode() void IVideoRendererNode::SetConfig(void* config) { - if (config == NULL) + if (config == nullptr) { return; } @@ -146,7 +146,7 @@ void IVideoRendererNode::SetConfig(void* config) bool IVideoRendererNode::IsSameConfig(void* config) { - if (config == NULL) + if (config == nullptr) { return true; } @@ -162,7 +162,7 @@ bool IVideoRendererNode::IsSameConfig(void* config) void IVideoRendererNode::ProcessData() { std::lock_guard<std::mutex> guard(mMutex); - uint8_t* pData = NULL; + uint8_t* pData = nullptr; uint32_t nDataSize = 0; uint32_t nTimeStamp = 0; bool bMark = false; @@ -294,7 +294,7 @@ void IVideoRendererNode::ProcessData() IMLOGD0("[ProcessData] notify first frame"); mFirstFrame = true; - if (mCallback != NULL) + if (mCallback != nullptr) { mCallback->SendEvent(kImsMediaEventFirstPacketReceived); } @@ -354,7 +354,7 @@ void IVideoRendererNode::UpdateRoundTripTimeDelay(int32_t delay) { IMLOGD1("[UpdateRoundTripTimeDelay] delay[%d]", delay); - if (mJitterBuffer != NULL) + if (mJitterBuffer != nullptr) { VideoJitterBuffer* jitter = reinterpret_cast<VideoJitterBuffer*>(mJitterBuffer); @@ -644,7 +644,7 @@ void IVideoRendererNode::SaveConfigFrame(uint8_t* pbBuffer, uint32_t nBufferSize // save if (bSPSString || bPPSString) { - uint8_t* pConfigData = NULL; + uint8_t* pConfigData = nullptr; uint32_t nConfigIndex = 0; if (eMode == kConfigSps) @@ -726,7 +726,7 @@ void IVideoRendererNode::SaveConfigFrame(uint8_t* pbBuffer, uint32_t nBufferSize // save if (bVPSString || bSPSString || bPPSString) { - uint8_t* pConfigData = NULL; + uint8_t* pConfigData = nullptr; uint32_t nConfigIndex = 0; if (eMode == kConfigVps) @@ -838,11 +838,11 @@ void IVideoRendererNode::QueueConfigFrame(uint32_t timestamp) for (int32_t i = 0; i < nNumOfConfigString; i++) { - uint8_t* pConfigData = NULL; + uint8_t* pConfigData = nullptr; uint32_t nConfigLen = mConfigLen[i]; pConfigData = mConfigBuffer[i]; - if (nConfigLen == 0 || mVideoRenderer == NULL) + if (nConfigLen == 0 || mVideoRenderer == nullptr) { continue; } @@ -853,7 +853,7 @@ void IVideoRendererNode::QueueConfigFrame(uint32_t timestamp) void IVideoRendererNode::NotifyPeerDimensionChanged() { - if (mCallback == NULL) + if (mCallback == nullptr) { return; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/nodes/IVideoSourceNode.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/nodes/IVideoSourceNode.cpp index 6a4362a4..65b429e2 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/nodes/IVideoSourceNode.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/nodes/IVideoSourceNode.cpp @@ -44,7 +44,7 @@ IVideoSourceNode::IVideoSourceNode(BaseSessionCallback* callback) : mIntraInterval = 1; mImagePath = ""; mDeviceOrientation = 0; - mWindow = NULL; + mWindow = nullptr; } IVideoSourceNode::~IVideoSourceNode() {} @@ -71,7 +71,7 @@ ImsMediaResult IVideoSourceNode::Start() { mVideoSource->SetCameraConfig(mCameraId, mCameraZoom); - if (mWindow == NULL) + if (mWindow == nullptr) { IMLOGE0("[Start] surface is not ready"); return RESULT_NOT_READY; @@ -122,7 +122,7 @@ bool IVideoSourceNode::IsSourceNode() void IVideoSourceNode::SetConfig(void* config) { - if (config == NULL) + if (config == nullptr) { return; } @@ -155,7 +155,7 @@ void IVideoSourceNode::SetConfig(void* config) bool IVideoSourceNode::IsSameConfig(void* config) { - if (config == NULL) + if (config == nullptr) { return true; } @@ -177,7 +177,7 @@ ImsMediaResult IVideoSourceNode::UpdateConfig(void* config) { IMLOGD1("[UpdateConfig] current mode[%d]", mVideoMode); - if (config == NULL) + if (config == nullptr) { return RESULT_INVALID_PARAM; } @@ -239,7 +239,7 @@ ImsMediaResult IVideoSourceNode::UpdateConfig(void* config) void IVideoSourceNode::ProcessData() { std::lock_guard<std::mutex> guard(mMutex); - uint8_t* data = NULL; + uint8_t* data = nullptr; uint32_t dataSize = 0; uint32_t timestamp = 0; bool mark = false; @@ -284,25 +284,25 @@ void IVideoSourceNode::OnEvent(int32_t type, int32_t param1, int32_t param2) switch (type) { case kVideoSourceEventUpdateOrientation: - if (mCallback != NULL) + if (mCallback != nullptr) { mCallback->SendEvent(kRequestVideoCvoUpdate, param1, param2); } break; case kVideoSourceEventCameraError: - if (mCallback != NULL) + if (mCallback != nullptr) { mCallback->SendEvent(kImsMediaEventNotifyError, param1, param2); } break; case kRequestVideoBitrateChange: - if (mVideoSource != NULL) + if (mVideoSource != nullptr) { mVideoSource->changeBitrate(param1); } break; case kRequestVideoIdrFrame: - if (mVideoSource != NULL) + if (mVideoSource != nullptr) { mVideoSource->requestIdrFrame(); } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/nodes/VideoRtpPayloadDecoderNode.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/nodes/VideoRtpPayloadDecoderNode.cpp index fdd7724a..fb0689d1 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/nodes/VideoRtpPayloadDecoderNode.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/nodes/VideoRtpPayloadDecoderNode.cpp @@ -30,7 +30,7 @@ VideoRtpPayloadDecoderNode::VideoRtpPayloadDecoderNode(BaseSessionCallback* call { mCodecType = 0; mPayloadMode = 0; - mBuffer = NULL; + mBuffer = nullptr; mSbitfirstByte = 0; } @@ -47,7 +47,7 @@ ImsMediaResult VideoRtpPayloadDecoderNode::Start() mBuffer = reinterpret_cast<uint8_t*>(malloc(MAX_RTP_PAYLOAD_BUFFER_SIZE * sizeof(uint8_t))); - if (mBuffer == NULL) + if (mBuffer == nullptr) { return RESULT_NO_MEMORY; } @@ -58,10 +58,10 @@ ImsMediaResult VideoRtpPayloadDecoderNode::Start() void VideoRtpPayloadDecoderNode::Stop() { - if (mBuffer != NULL) + if (mBuffer != nullptr) { free(mBuffer); - mBuffer = NULL; + mBuffer = nullptr; } mNodeState = kNodeStateStopped; @@ -79,7 +79,7 @@ bool VideoRtpPayloadDecoderNode::IsSourceNode() void VideoRtpPayloadDecoderNode::SetConfig(void* config) { - if (config == NULL) + if (config == nullptr) { return; } @@ -91,7 +91,7 @@ void VideoRtpPayloadDecoderNode::SetConfig(void* config) bool VideoRtpPayloadDecoderNode::IsSameConfig(void* config) { - if (config == NULL) + if (config == nullptr) { return false; } @@ -107,7 +107,7 @@ void VideoRtpPayloadDecoderNode::OnDataFromFrontNode(ImsMediaSubType subtype, ui { if (subtype == MEDIASUBTYPE_REFRESHED) { - SendDataToRearNode(subtype, NULL, nDataSize, 0, 0, 0, MEDIASUBTYPE_UNDEFINED); + SendDataToRearNode(subtype, nullptr, nDataSize, 0, 0, 0, MEDIASUBTYPE_UNDEFINED); return; } @@ -130,7 +130,7 @@ void VideoRtpPayloadDecoderNode::OnDataFromFrontNode(ImsMediaSubType subtype, ui void VideoRtpPayloadDecoderNode::DecodeAvc(ImsMediaSubType subtype, uint8_t* pData, uint32_t nDataSize, uint32_t nTimeStamp, bool bMark, uint32_t nSeqNum) { - if (pData == NULL || nDataSize == 0 || mBuffer == NULL) + if (pData == nullptr || nDataSize == 0 || mBuffer == nullptr) { return; } @@ -288,13 +288,13 @@ void VideoRtpPayloadDecoderNode::DecodeHevc(ImsMediaSubType subtype, uint8_t* pD return; } - if (pData == NULL || nDataSize == 0) + if (pData == nullptr || nDataSize == 0) { IMLOGE1("[DecodeHevc] INVALID Data, Size[%d]", nDataSize); return; } - if (mBuffer == NULL) + if (mBuffer == nullptr) { return; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/nodes/VideoRtpPayloadEncoderNode.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/nodes/VideoRtpPayloadEncoderNode.cpp index 14b60bf4..6ec6a3cd 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/nodes/VideoRtpPayloadEncoderNode.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/nodes/VideoRtpPayloadEncoderNode.cpp @@ -38,7 +38,7 @@ VideoRtpPayloadEncoderNode::VideoRtpPayloadEncoderNode(BaseSessionCallback* call mCodecType = VideoConfig::CODEC_AVC; mPayloadMode = kRtpPyaloadHeaderModeNonInterleaved; mPrevMark = false; - mBuffer = NULL; + mBuffer = nullptr; memset(mVPS, 0, sizeof(mVPS)); memset(mSPS, 0, sizeof(mSPS)); memset(mPPS, 0, sizeof(mPPS)); @@ -69,7 +69,7 @@ ImsMediaResult VideoRtpPayloadEncoderNode::Start() mBuffer = reinterpret_cast<uint8_t*>(malloc(MAX_RTP_PAYLOAD_BUFFER_SIZE * sizeof(uint8_t))); - if (mBuffer == NULL) + if (mBuffer == nullptr) { return RESULT_NO_MEMORY; } @@ -80,10 +80,10 @@ ImsMediaResult VideoRtpPayloadEncoderNode::Start() void VideoRtpPayloadEncoderNode::Stop() { - if (mBuffer != NULL) + if (mBuffer != nullptr) { free(mBuffer); - mBuffer = NULL; + mBuffer = nullptr; } mNodeState = kNodeStateStopped; @@ -101,7 +101,7 @@ bool VideoRtpPayloadEncoderNode::IsSourceNode() void VideoRtpPayloadEncoderNode::SetConfig(void* config) { - if (config == NULL) + if (config == nullptr) { return; } @@ -114,7 +114,7 @@ void VideoRtpPayloadEncoderNode::SetConfig(void* config) bool VideoRtpPayloadEncoderNode::IsSameConfig(void* config) { - if (config == NULL) + if (config == nullptr) { return false; } @@ -176,7 +176,7 @@ uint8_t* VideoRtpPayloadEncoderNode::FindAvcStartCode( if (pnSkipSize) *pnSkipSize = nSkipSize; - return NULL; + return nullptr; } // [HEVC] return buffer position of h.265 start code @@ -207,7 +207,7 @@ uint8_t* VideoRtpPayloadEncoderNode::FindHevcStartCode( if (pnSkipSize) *pnSkipSize = nSkipSize; - return NULL; + return nullptr; } void VideoRtpPayloadEncoderNode::EncodeAvc( @@ -232,7 +232,7 @@ void VideoRtpPayloadEncoderNode::EncodeAvc( pStartCodePos = FindAvcStartCode(pCurDataPos, nDataSize, &nSkipSize); - if (pStartCodePos == NULL) + if (pStartCodePos == nullptr) { return; } @@ -247,7 +247,7 @@ void VideoRtpPayloadEncoderNode::EncodeAvc( // extract nal unit pStartCodePos = FindAvcStartCode(pCurDataPos + 1, nDataSize - 1); - if (pStartCodePos == NULL) + if (pStartCodePos == nullptr) { nCurDataSize = nDataSize; } @@ -320,7 +320,7 @@ void VideoRtpPayloadEncoderNode::EncodeAvcNALUnit( return; } - if (mBuffer == NULL) + if (mBuffer == nullptr) { return; } @@ -459,7 +459,7 @@ void VideoRtpPayloadEncoderNode::EncodeHevc( pStartCodePos = FindHevcStartCode(pCurDataPos, nDataSize, &nSkipSize); - if (pStartCodePos == NULL) + if (pStartCodePos == nullptr) { return; } @@ -475,7 +475,7 @@ void VideoRtpPayloadEncoderNode::EncodeHevc( // NAL unit header is 2 bytes on HEVC. pStartCodePos = FindHevcStartCode(pCurDataPos + 2, nDataSize - 2); - if (pStartCodePos == NULL) + if (pStartCodePos == nullptr) { break; } @@ -553,7 +553,7 @@ void VideoRtpPayloadEncoderNode::EncodeHevcNALUnit( pData[0], pData[1], pData[2], pData[3], nDataSize, nTimestamp, bMark, nNalUnitType); } - if (mBuffer == NULL) + if (mBuffer == nullptr) { return; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/jni/MediaManagerFactory.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/jni/MediaManagerFactory.cpp index bec2dd21..89b1b941 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/jni/MediaManagerFactory.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/jni/MediaManagerFactory.cpp @@ -21,7 +21,7 @@ BaseManager* MediaManagerFactory::getInterface(int mediatype) { - BaseManager* pManager = NULL; + BaseManager* pManager = nullptr; switch ((IMS_MEDIA_TYPE)mediatype) { @@ -35,7 +35,7 @@ BaseManager* MediaManagerFactory::getInterface(int mediatype) pManager = TextManager::getInstance(); break; default: - return NULL; + return nullptr; } return pManager; diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/jni/libimsmediajni.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/jni/libimsmediajni.cpp index 96553747..bd9a7f24 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/jni/libimsmediajni.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/jni/libimsmediajni.cpp @@ -32,10 +32,10 @@ static const char* gClassPath = "com/android/telephony/imsmedia/JNIImsMediaService"; -static JavaVM* gJVM = NULL; -static jclass gClass_JNIImsMediaService = NULL; -static jmethodID gMethod_sendData2Java = NULL; -AAssetManager* gpAssetManager = NULL; +static JavaVM* gJVM = nullptr; +static jclass gClass_JNIImsMediaService = nullptr; +static jmethodID gMethod_sendData2Java = nullptr; +AAssetManager* gpAssetManager = nullptr; JavaVM* GetJavaVM() { @@ -46,7 +46,7 @@ static int SendData2Java(int sessionId, const android::Parcel& objParcel) { JNIEnv* env; - if ((gClass_JNIImsMediaService == NULL) || (gMethod_sendData2Java == NULL)) + if ((gClass_JNIImsMediaService == nullptr) || (gMethod_sendData2Java == nullptr)) { ALOGE(0, "SendData2Java: Method is null", 0, 0, 0); return 0; @@ -54,16 +54,16 @@ static int SendData2Java(int sessionId, const android::Parcel& objParcel) JavaVM* jvm = GetJavaVM(); - if (jvm->AttachCurrentThread(&env, NULL) != JNI_OK) + if (jvm->AttachCurrentThread(&env, nullptr) != JNI_OK) { ALOGE(0, "SendData2Java: AttachCurrentThread fail", 0, 0, 0); return 0; } jbyteArray baData = env->NewByteArray(objParcel.dataSize()); - jbyte* pBuffer = env->GetByteArrayElements(baData, NULL); + jbyte* pBuffer = env->GetByteArrayElements(baData, nullptr); - if (pBuffer != NULL) + if (pBuffer != nullptr) { memcpy(pBuffer, objParcel.data(), objParcel.dataSize()); env->ReleaseByteArrayElements(baData, pBuffer, 0); @@ -80,9 +80,9 @@ static jlong JNIImsMediaService_getInterface( JNIEnv* /* env */, jobject /* object */, jint mediatype) { ALOGD("JNIImsMediaService_getInterface: type[%d]", mediatype); - BaseManager* manager = NULL; + BaseManager* manager = nullptr; manager = MediaManagerFactory::getInterface(mediatype); - if (manager != NULL) + if (manager != nullptr) { manager->setCallback(SendData2Java); } @@ -95,7 +95,7 @@ static void JNIImsMediaService_sendMessage( { BaseManager* manager = reinterpret_cast<BaseManager*>(nativeObj); android::Parcel parcel; - jbyte* pBuff = env->GetByteArrayElements(baData, NULL); + jbyte* pBuff = env->GetByteArrayElements(baData, nullptr); int nBuffSize = env->GetArrayLength(baData); parcel.setData(reinterpret_cast<const uint8_t*>(pBuff), nBuffSize); parcel.setDataPosition(0); @@ -113,7 +113,7 @@ static void JNIImsMediaService_setPreviewSurface( { VideoManager* manager = reinterpret_cast<VideoManager*>(nativeObj); - if (manager != NULL) + if (manager != nullptr) { manager->setPreviewSurface(sessionId, ANativeWindow_fromSurface(env, surface)); } @@ -124,7 +124,7 @@ static void JNIImsMediaService_setDisplaySurface( { VideoManager* manager = reinterpret_cast<VideoManager*>(nativeObj); - if (manager != NULL) + if (manager != nullptr) { manager->setDisplaySurface(sessionId, ANativeWindow_fromSurface(env, surface)); } @@ -133,7 +133,7 @@ static void JNIImsMediaService_setDisplaySurface( static jstring JNIImsMediaUtil_generateSPROP(JNIEnv* env, jobject, jbyteArray baData) { android::Parcel parcel; - jbyte* pBuff = env->GetByteArrayElements(baData, NULL); + jbyte* pBuff = env->GetByteArrayElements(baData, nullptr); int nBuffSize = env->GetArrayLength(baData); parcel.setData(reinterpret_cast<const uint8_t*>(pBuff), nBuffSize); parcel.setDataPosition(0); @@ -145,8 +145,8 @@ static jstring JNIImsMediaUtil_generateSPROP(JNIEnv* env, jobject, jbyteArray ba videoConfig.getCodecLevel()); char* sprop = ImsMediaVideoUtil::GenerateVideoSprop(&videoConfig); - jstring str = NULL; - if (sprop != NULL) + jstring str = nullptr; + if (sprop != nullptr) { str = env->NewStringUTF(sprop); free(sprop); @@ -185,7 +185,7 @@ jint ImsMediaServiceJni_OnLoad(JavaVM* vm, JNIEnv* env) jclass _jclassImsMediaService = env->FindClass(gClassPath); - if (_jclassImsMediaService == NULL) + if (_jclassImsMediaService == nullptr) { ALOGE("ImsMediaServiceJni_OnLoad :: FindClass failed"); return -1; @@ -193,7 +193,7 @@ jint ImsMediaServiceJni_OnLoad(JavaVM* vm, JNIEnv* env) gClass_JNIImsMediaService = reinterpret_cast<jclass>(env->NewGlobalRef(_jclassImsMediaService)); - if (gClass_JNIImsMediaService == NULL) + if (gClass_JNIImsMediaService == nullptr) { ALOGE("ImsMediaServiceJni_OnLoad :: FindClass failed2"); return -1; @@ -208,7 +208,7 @@ jint ImsMediaServiceJni_OnLoad(JavaVM* vm, JNIEnv* env) gMethod_sendData2Java = env->GetStaticMethodID(gClass_JNIImsMediaService, "sendData2Java", "(I[B)I"); - if (gMethod_sendData2Java == NULL) + if (gMethod_sendData2Java == nullptr) { ALOGE("ImsMediaServiceJni_OnLoad: GetStaticMethodID failed"); return -1; diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/libimsmedia.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/libimsmedia.cpp index 3851137d..c8ed9bd8 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/libimsmedia.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/libimsmedia.cpp @@ -31,7 +31,7 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved) ALOGD("JNI_OnLoad::JNI_OnLoad"); - JNIEnv* env = NULL; + JNIEnv* env = nullptr; if (vm->GetEnv((void**)&env, IMS_MEDIA_JNI_VERSION) != JNI_OK) { @@ -39,7 +39,7 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved) return (-1); } - assert(env != NULL); + assert(env != nullptr); if (ImsMediaServiceJni_OnLoad(vm, env) < 0) { diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/RtpImpl.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/RtpImpl.cpp index bd6689c2..07e8a45d 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/RtpImpl.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/RtpImpl.cpp @@ -22,7 +22,7 @@ RtpImpl::RtpImpl() { - m_pvAppdata = RTP_NULL; + m_pvAppdata = nullptr; } RtpImpl::~RtpImpl() {} @@ -60,7 +60,7 @@ eRtp_Bool RtpImpl::rtcpPacketSendInd(IN RtpBuffer* pobjRtcpBuf, IN RtpSession* p RTP_TRACE_MESSAGE("rtcpPacketSendInd", 0, 0); RtpServiceListener* pobjRtpServiceListener = reinterpret_cast<RtpServiceListener*>(getAppdata()); - if (pobjRtpServiceListener == RTP_NULL || pobjRtcpBuf == RTP_NULL || pobjRtpSession == RTP_NULL) + if (pobjRtpServiceListener == nullptr || pobjRtcpBuf == nullptr || pobjRtpSession == nullptr) { RTP_TRACE_ERROR("RTCP send failed. No listeners are set", 0, 0); return eRTP_FALSE; @@ -71,7 +71,7 @@ eRtp_Bool RtpImpl::rtcpPacketSendInd(IN RtpBuffer* pobjRtcpBuf, IN RtpSession* p -1) { RTP_TRACE_ERROR("Send RTCP: IRTPSession returned Error", 0, 0); - pobjRtcpBuf->setBufferInfo(RTP_ZERO, RTP_NULL); + pobjRtcpBuf->setBufferInfo(RTP_ZERO, nullptr); return eRTP_FALSE; } @@ -81,7 +81,7 @@ eRtp_Bool RtpImpl::rtcpPacketSendInd(IN RtpBuffer* pobjRtcpBuf, IN RtpSession* p eRtp_Bool RtpImpl::rtcpAppPayloadReqInd( OUT RtpDt_UInt16& pusSubType, OUT RtpDt_UInt32& uiName, OUT RtpBuffer* pobjPayload) { - if (pobjPayload == RTP_NULL) + if (pobjPayload == nullptr) { return eRTP_FALSE; } @@ -94,7 +94,7 @@ eRtp_Bool RtpImpl::rtcpAppPayloadReqInd( eRtp_Bool RtpImpl::getRtpHdrExtInfo(OUT RtpBuffer* pobjExtHdrInfo) { - if (pobjExtHdrInfo == RTP_NULL) + if (pobjExtHdrInfo == nullptr) { return eRTP_FALSE; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/RtpService.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/RtpService.cpp index ec672043..e133766b 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/RtpService.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/RtpService.cpp @@ -21,7 +21,7 @@ #include <RtpTrace.h> #include <RtpError.h> -RtpStack* g_pobjRtpStack = RTP_NULL; +RtpStack* g_pobjRtpStack = nullptr; RtpDt_Void addSdesItem( OUT RtcpConfigInfo* pobjRtcpCfgInfo, IN RtpDt_UChar* sdesName, IN RtpDt_UInt32 uiLength) @@ -58,7 +58,7 @@ RtpDt_Void populateReceiveRtpIndInfo( else { pstRtpIndMsg->bExtension = eRTP_FALSE; - pstRtpIndMsg->extensionData = RTP_NULL; + pstRtpIndMsg->extensionData = 0; } // End Header length // play the payload @@ -69,7 +69,7 @@ RtpDt_Void populateReceiveRtpIndInfo( if (!pobjRtpPayload) { pstRtpIndMsg->wMsgBodyLen = 0; - pstRtpIndMsg->pMsgBody = NULL; + pstRtpIndMsg->pMsgBody = nullptr; return; } @@ -84,7 +84,7 @@ eRtp_Bool populateRcvdReportFromStk( { // application supports one RR RtcpReportBlock* pobjRepBlkElm = pobjRepBlkList.front(); - if (pobjRepBlkElm == RTP_NULL) + if (pobjRepBlkElm == nullptr) { return eRTP_FALSE; } @@ -107,7 +107,7 @@ eRtp_Bool populateRcvdReportFromStk( pstRcvdReport->lsr); RTP_TRACE_MESSAGE( - "Received RR info : [DELAY SINCE LSR = %u] ", pstRcvdReport->delayLsr, RTP_NULL); + "Received RR info : [DELAY SINCE LSR = %u] ", pstRcvdReport->delayLsr, nullptr); } else { @@ -132,7 +132,7 @@ eRtp_Bool populateRcvdRrInfoFromStk( } // application supports one RR RtcpRrPacket* pobjRrPkt = pobjRrList.front(); - if (pobjRrPkt == RTP_NULL) + if (pobjRrPkt == nullptr) { return eRTP_FALSE; } @@ -151,7 +151,7 @@ eRtp_Bool populateRcvdSrInfoFromStk( } // get SR packet data RtcpSrPacket* pobjSrPkt = pobjSrList.front(); - if (pobjSrPkt == RTP_NULL) + if (pobjSrPkt == nullptr) { return eRTP_FALSE; } @@ -166,7 +166,7 @@ eRtp_Bool populateRcvdSrInfoFromStk( pstSrInfo->ntpTimestampMsw, pstSrInfo->ntpTimestampLsw); RTP_TRACE_MESSAGE( - "Received SR info : [RTP timestamp = %u] ", pstSrInfo->rtpTimestamp, RTP_NULL); + "Received SR info : [RTP timestamp = %u] ", pstSrInfo->rtpTimestamp, nullptr); RTP_TRACE_MESSAGE("Received SR info : [SEND PKT COUNT = %u] [SEND OCTET COUNT = %u]", pstSrInfo->sendPktCount, pstSrInfo->sendOctCount); @@ -181,13 +181,13 @@ eRtp_Bool populateRcvdSrInfoFromStk( eRtp_Bool populateRcvdFbInfoFromStk( IN RtcpFbPacket* m_pobjRtcpFbPkt, OUT tRtpSvcIndSt_ReceiveRtcpFeedbackInd* stFbRtcpMsg) { - if (m_pobjRtcpFbPkt != RTP_NULL) + if (m_pobjRtcpFbPkt != nullptr) { stFbRtcpMsg->wPayloadType = m_pobjRtcpFbPkt->getRtcpHdrInfo()->getPacketType(); stFbRtcpMsg->wFmt = m_pobjRtcpFbPkt->getRtcpHdrInfo()->getReceptionReportCount(); stFbRtcpMsg->dwMediaSsrc = m_pobjRtcpFbPkt->getMediaSsrc(); stFbRtcpMsg->wMsgLen = m_pobjRtcpFbPkt->getRtcpHdrInfo()->getLength(); - if (m_pobjRtcpFbPkt->getFCI() != RTP_NULL) + if (m_pobjRtcpFbPkt->getFCI() != nullptr) { stFbRtcpMsg->pMsg = m_pobjRtcpFbPkt->getFCI()->getBuffer(); } @@ -228,7 +228,7 @@ RtpBuffer* GetCVOXHdr(IN tRtpSvc_SendRtpPacketParm* pstRtpParam) } else { - pobjXHdr->setBufferInfo(0, RTP_NULL); + pobjXHdr->setBufferInfo(0, nullptr); } return pobjXHdr; @@ -244,16 +244,16 @@ RtpDt_UInt16 GetCVOXHdrLen(eRtp_Bool bEnableCVO) GLOBAL eRtp_Bool IMS_RtpSvc_Initialize() { - if (g_pobjRtpStack == RTP_NULL) + if (g_pobjRtpStack == nullptr) { g_pobjRtpStack = new RtpStack(); - if (g_pobjRtpStack == RTP_NULL) + if (g_pobjRtpStack == nullptr) { return eRTP_FALSE; } RtpStackProfile* pobjStackProfile = new RtpStackProfile(); - if (pobjStackProfile == RTP_NULL) + if (pobjStackProfile == nullptr) { return eRTP_FALSE; } @@ -270,7 +270,7 @@ GLOBAL eRtp_Bool IMS_RtpSvc_Deinitialize() if (g_pobjRtpStack) { delete g_pobjRtpStack; - g_pobjRtpStack = RTP_NULL; + g_pobjRtpStack = nullptr; } return eRTP_TRUE; @@ -279,13 +279,13 @@ GLOBAL eRtp_Bool IMS_RtpSvc_Deinitialize() GLOBAL eRtp_Bool IMS_RtpSvc_CreateSession(IN RtpDt_Char* szLocalIP, IN RtpDt_UInt32 port, IN RtpDt_Void* pAppData, OUT RtpDt_UInt32* puSsrc, OUT RTPSESSIONID* hRtpSession) { - if (g_pobjRtpStack == RTP_NULL || szLocalIP == RTP_NULL) + if (g_pobjRtpStack == nullptr || szLocalIP == nullptr) { return eRTP_FALSE; } RtpSession* pobjRtpSession = g_pobjRtpStack->createRtpSession(); - if (pobjRtpSession == RTP_NULL) + if (pobjRtpSession == nullptr) { return eRTP_FALSE; } @@ -304,7 +304,7 @@ GLOBAL eRtp_Bool IMS_RtpSvc_CreateSession(IN RtpDt_Char* szLocalIP, IN RtpDt_UIn *hRtpSession = reinterpret_cast<RtpDt_Void*>(pobjRtpSession); RtpImpl* pobjRtpImpl = new RtpImpl(); - if (pobjRtpImpl == RTP_NULL) + if (pobjRtpImpl == nullptr) { return eRTP_FALSE; } @@ -336,14 +336,14 @@ GLOBAL eRtp_Bool IMS_RtpSvc_SetPayload(IN RTPSESSIONID hRtpSession, } RtpPayloadInfo* pobjlPayloadInfo = new RtpPayloadInfo(payloadType, pstPayloadInfo[0].samplingRate, nNumOfPayloadParam); - if (pobjlPayloadInfo == RTP_NULL) + if (pobjlPayloadInfo == nullptr) { return eRTP_FALSE; } RtpSession* pobjRtpSession = reinterpret_cast<RtpSession*>(hRtpSession); - if (g_pobjRtpStack == RTP_NULL || + if (g_pobjRtpStack == nullptr || g_pobjRtpStack->isValidRtpSession(pobjRtpSession) == eRTP_FAILURE) { delete pobjlPayloadInfo; @@ -363,7 +363,7 @@ GLOBAL eRtp_Bool IMS_RtpSvc_SetPayload(IN RTPSESSIONID hRtpSession, GLOBAL eRtp_Bool IMS_RtpSvc_SetRTCPInterval(IN RTPSESSIONID hRtpSession, IN RtpDt_UInt32 nInterval) { - if (g_pobjRtpStack == RTP_NULL || + if (g_pobjRtpStack == nullptr || g_pobjRtpStack->isValidRtpSession(reinterpret_cast<RtpSession*>(hRtpSession)) == eRTP_FAILURE) return eRTP_FALSE; @@ -376,7 +376,7 @@ GLOBAL eRtp_Bool IMS_RtpSvc_DeleteSession(IN RTPSESSIONID hRtpSession) { RtpSession* pobjRtpSession = reinterpret_cast<RtpSession*>(hRtpSession); - if (g_pobjRtpStack == RTP_NULL || + if (g_pobjRtpStack == nullptr || g_pobjRtpStack->isValidRtpSession(pobjRtpSession) == eRTP_FAILURE) return eRTP_FALSE; @@ -396,7 +396,7 @@ GLOBAL eRtp_Bool IMS_RtpSvc_SendRtpPacket(IN RtpServiceListener* pobjRtpServiceL { RtpSession* pobjRtpSession = reinterpret_cast<RtpSession*>(hRtpSession); - if (g_pobjRtpStack == RTP_NULL || + if (g_pobjRtpStack == nullptr || g_pobjRtpStack->isValidRtpSession(pobjRtpSession) == eRTP_FAILURE) return eRTP_FALSE; @@ -406,7 +406,7 @@ GLOBAL eRtp_Bool IMS_RtpSvc_SendRtpPacket(IN RtpServiceListener* pobjRtpServiceL } RtpBuffer* pobjRtpPayload = new RtpBuffer(); - if (pobjRtpPayload == RTP_NULL) + if (pobjRtpPayload == nullptr) { RTP_TRACE_WARNING( "IMS_RtpSvc_SendRtpPacket pobjRtpPayload - Malloc failed", RTP_ZERO, RTP_ZERO); @@ -414,7 +414,7 @@ GLOBAL eRtp_Bool IMS_RtpSvc_SendRtpPacket(IN RtpServiceListener* pobjRtpServiceL } RtpBuffer* pobjRtpBuf = new RtpBuffer(); - if (pobjRtpBuf == RTP_NULL) + if (pobjRtpBuf == nullptr) { delete pobjRtpPayload; RTP_TRACE_MESSAGE( @@ -438,7 +438,7 @@ GLOBAL eRtp_Bool IMS_RtpSvc_SendRtpPacket(IN RtpServiceListener* pobjRtpServiceL GetCVOXHdr(pstRtpParam), pobjRtpBuf); // 3. de-init and free the temp variable both in success and failure case - pobjRtpPayload->setBufferInfo(RTP_ZERO, RTP_NULL); + pobjRtpPayload->setBufferInfo(RTP_ZERO, nullptr); delete pobjRtpPayload; if (eRtpCreateStat != RTP_SUCCESS) @@ -477,7 +477,7 @@ GLOBAL eRtp_Bool IMS_RtpSvc_ProcRtpPacket(IN RtpServiceListener* pvIRtpSession, tRtpSvc_IndicationFromStack stackInd = RTPSVC_RECEIVE_RTP_IND; RtpSession* pobjRtpSession = reinterpret_cast<RtpSession*>(hRtpSession); - if (g_pobjRtpStack == RTP_NULL || + if (g_pobjRtpStack == nullptr || g_pobjRtpStack->isValidRtpSession(pobjRtpSession) == eRTP_FAILURE) { return eRTP_FALSE; @@ -489,7 +489,7 @@ GLOBAL eRtp_Bool IMS_RtpSvc_ProcRtpPacket(IN RtpServiceListener* pvIRtpSession, } RtpPacket* pobjRtpPkt = new RtpPacket(); - if (pobjRtpPkt == RTP_NULL) + if (pobjRtpPkt == nullptr) { RTP_TRACE_WARNING( "IMS_RtpSvc_ProcRtpPacket pobjRtpPkt - Malloc failed", RTP_ZERO, RTP_ZERO); @@ -504,8 +504,8 @@ GLOBAL eRtp_Bool IMS_RtpSvc_ProcRtpPacket(IN RtpServiceListener* pvIRtpSession, eRTP_STATUS_CODE eStatus = pobjRtpSession->processRcvdRtpPkt(&objRmtAddr, uiPeerPort, &objRtpBuf, pobjRtpPkt); - objRtpBuf.setBufferInfo(RTP_ZERO, RTP_NULL); - objRmtAddr.setBufferInfo(RTP_ZERO, RTP_NULL); + objRtpBuf.setBufferInfo(RTP_ZERO, nullptr); + objRmtAddr.setBufferInfo(RTP_ZERO, nullptr); if (eStatus != RTP_SUCCESS) { if (eStatus == RTP_OWN_SSRC_COLLISION) @@ -539,7 +539,7 @@ GLOBAL eRtp_Bool IMS_RtpSvc_SessionEnableRTP(IN RTPSESSIONID rtpSessionId) { RtpSession* pobjRtpSession = reinterpret_cast<RtpSession*>(rtpSessionId); - if (g_pobjRtpStack == RTP_NULL || + if (g_pobjRtpStack == nullptr || g_pobjRtpStack->isValidRtpSession(pobjRtpSession) == eRTP_FAILURE) return eRTP_FALSE; @@ -553,7 +553,7 @@ GLOBAL eRtp_Bool IMS_RtpSvc_SessionDisableRTP(IN RTPSESSIONID rtpSessionId) { RtpSession* pobjRtpSession = reinterpret_cast<RtpSession*>(rtpSessionId); - if (g_pobjRtpStack == RTP_NULL || + if (g_pobjRtpStack == nullptr || g_pobjRtpStack->isValidRtpSession(pobjRtpSession) == eRTP_FAILURE) return eRTP_FALSE; @@ -568,7 +568,7 @@ GLOBAL eRtp_Bool IMS_RtpSvc_SessionEnableRTCP( { RtpSession* pobjRtpSession = reinterpret_cast<RtpSession*>(hRtpSession); - if (g_pobjRtpStack == RTP_NULL || + if (g_pobjRtpStack == nullptr || g_pobjRtpStack->isValidRtpSession(pobjRtpSession) == eRTP_FAILURE) return eRTP_FALSE; @@ -585,7 +585,7 @@ GLOBAL eRtp_Bool IMS_RtpSvc_SessionDisableRTCP(IN RTPSESSIONID hRtpSession) RtpSession* pobjRtpSession = reinterpret_cast<RtpSession*>(hRtpSession); eRTP_STATUS_CODE eRtcpStatus = RTP_SUCCESS; - if (g_pobjRtpStack == RTP_NULL || + if (g_pobjRtpStack == nullptr || g_pobjRtpStack->isValidRtpSession(pobjRtpSession) == eRTP_FAILURE) return eRTP_FALSE; @@ -602,7 +602,7 @@ GLOBAL eRtp_Bool IMS_RtpSvc_SendRtcpByePacket(IN RTPSESSIONID hRtpSession) { RtpSession* pobjRtpSession = reinterpret_cast<RtpSession*>(hRtpSession); - if (g_pobjRtpStack == RTP_NULL || + if (g_pobjRtpStack == nullptr || g_pobjRtpStack->isValidRtpSession(pobjRtpSession) == eRTP_FAILURE) return eRTP_FALSE; @@ -615,7 +615,7 @@ GLOBAL eRtp_Bool IMS_RtpSvc_SendRtcpRtpFbPacket(IN RTPSESSIONID hRtpSession, IN RtpDt_UInt32 uiMediaSsrc) { RtpSession* pobjRtpSession = reinterpret_cast<RtpSession*>(hRtpSession); - if (g_pobjRtpStack == RTP_NULL || + if (g_pobjRtpStack == nullptr || g_pobjRtpStack->isValidRtpSession(pobjRtpSession) == eRTP_FAILURE) return eRTP_FALSE; @@ -629,7 +629,7 @@ GLOBAL eRtp_Bool IMS_RtpSvc_SendRtcpPayloadFbPacket(IN RTPSESSIONID hRtpSession, IN RtpDt_UInt32 uiMediaSsrc) { RtpSession* pobjRtpSession = reinterpret_cast<RtpSession*>(hRtpSession); - if (g_pobjRtpStack == RTP_NULL || + if (g_pobjRtpStack == nullptr || g_pobjRtpStack->isValidRtpSession(pobjRtpSession) == eRTP_FAILURE) return eRTP_FALSE; @@ -646,11 +646,11 @@ GLOBAL eRtp_Bool IMS_RtpSvc_ProcRtcpPacket(IN RtpServiceListener* pobjRtpService RtpSession* pobjRtpSession = reinterpret_cast<RtpSession*>(hRtpSession); - if (g_pobjRtpStack == RTP_NULL || + if (g_pobjRtpStack == nullptr || g_pobjRtpStack->isValidRtpSession(pobjRtpSession) == eRTP_FAILURE) return eRTP_FALSE; - if (pMsg == RTP_NULL || uiMsgLength == RTP_ZERO || pcIpAddr == RTP_NULL) + if (pMsg == nullptr || uiMsgLength == RTP_ZERO || pcIpAddr == nullptr) { return eRTP_FALSE; } @@ -669,10 +669,10 @@ GLOBAL eRtp_Bool IMS_RtpSvc_ProcRtcpPacket(IN RtpServiceListener* pobjRtpService pobjRtpSession->processRcvdRtcpPkt(&objRmtAddr, uiRtcpPort, &objRtcpBuf, &objRtcpPkt); // clean the data - objRtcpBuf.setBufferInfo(RTP_ZERO, RTP_NULL); - objRmtAddr.setBufferInfo(RTP_ZERO, RTP_NULL); + objRtcpBuf.setBufferInfo(RTP_ZERO, nullptr); + objRmtAddr.setBufferInfo(RTP_ZERO, nullptr); RtpBuffer objRtpPayload; - objRtpPayload.setBufferInfo(RTP_ZERO, RTP_NULL); + objRtpPayload.setBufferInfo(RTP_ZERO, nullptr); if (eProcRtcpSta != RTP_SUCCESS) { @@ -719,7 +719,7 @@ GLOBAL eRtp_Bool IMS_RtpSvc_ProcRtcpPacket(IN RtpServiceListener* pobjRtpService for (auto& pobjFbPkt : pobjFbList) { // get Fb packet data - if (pobjFbPkt == RTP_NULL) + if (pobjFbPkt == nullptr) { return eRTP_FALSE; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpAppPacket.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpAppPacket.cpp index 18f0fc50..e3ee5e42 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpAppPacket.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpAppPacket.cpp @@ -19,17 +19,17 @@ RtcpAppPacket::RtcpAppPacket() : m_uiName(RTP_ZERO), - m_pAppData(RTP_NULL) + m_pAppData(nullptr) { } RtcpAppPacket::~RtcpAppPacket() { // m_pAppData - if (m_pAppData != RTP_NULL) + if (m_pAppData != nullptr) { delete m_pAppData; - m_pAppData = RTP_NULL; + m_pAppData = nullptr; } } @@ -75,7 +75,7 @@ eRTP_STATUS_CODE RtcpAppPacket::decodeAppPacket(IN RtpDt_UChar* pucAppBuf, IN Rt usTmpAppLen = usTmpAppLen - RTP_WORD_SIZE; if (usTmpAppLen > 0) { - RtpDt_UChar* pucTmpBuf = RTP_NULL; + RtpDt_UChar* pucTmpBuf = nullptr; m_pAppData = new RtpBuffer(); pucTmpBuf = new RtpDt_UChar[usTmpAppLen]; @@ -102,7 +102,7 @@ eRTP_STATUS_CODE RtcpAppPacket::formAppPacket(OUT RtpBuffer* pobjRtcpPktBuf) uiCurPos = uiCurPos + RTP_WORD_SIZE; // m_pAppData - if (m_pAppData != RTP_NULL) + if (m_pAppData != nullptr) { memcpy(pucBuffer, m_pAppData->getBuffer(), m_pAppData->getLength()); uiCurPos = uiCurPos + m_pAppData->getLength(); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpByePacket.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpByePacket.cpp index fc161683..0920f81c 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpByePacket.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpByePacket.cpp @@ -19,7 +19,7 @@ RtcpByePacket::RtcpByePacket() : m_uiSsrcList(std::list<RtpDt_UInt32*>()), - m_pReason(RTP_NULL) + m_pReason(nullptr) { } // Constructor @@ -32,10 +32,10 @@ RtcpByePacket::~RtcpByePacket() } m_uiSsrcList.clear(); - if (m_pReason != RTP_NULL) + if (m_pReason != nullptr) { delete m_pReason; - m_pReason = RTP_NULL; + m_pReason = nullptr; } } // Destructor @@ -70,9 +70,9 @@ eRTP_STATUS_CODE RtcpByePacket::decodeByePacket(IN RtpDt_UChar* pucByeBuf, IN Rt // m_uiSsrcList while (ucSsrcCnt > RTP_ONE && usByeLen >= RTP_WORD_SIZE) { - RtpDt_UInt32* puiRcvdSsrc = RTP_NULL; + RtpDt_UInt32* puiRcvdSsrc = nullptr; puiRcvdSsrc = new RtpDt_UInt32(); - if (puiRcvdSsrc == RTP_NULL) + if (puiRcvdSsrc == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); return RTP_MEMORY_FAIL; @@ -95,14 +95,14 @@ eRTP_STATUS_CODE RtcpByePacket::decodeByePacket(IN RtpDt_UChar* pucByeBuf, IN Rt if (uiByte4Data > RTP_ZERO) { RtpDt_UChar* pucReason = new RtpDt_UChar[uiByte4Data]; - if (pucReason == RTP_NULL) + if (pucReason == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); return RTP_MEMORY_FAIL; } m_pReason = new RtpBuffer(); - if (m_pReason == RTP_NULL) + if (m_pReason == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); delete[] pucReason; @@ -133,7 +133,7 @@ eRTP_STATUS_CODE RtcpByePacket::formByePacket(OUT RtpBuffer* pobjRtcpPktBuf) } // m_pReason - if (m_pReason != RTP_NULL) + if (m_pReason != nullptr) { // length *(reinterpret_cast<RtpDt_UChar*>(pucBuffer)) = (RtpDt_UChar)m_pReason->getLength(); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpChunk.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpChunk.cpp index e2cdcbdc..12f5e9e4 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpChunk.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpChunk.cpp @@ -28,7 +28,7 @@ RtcpChunk::~RtcpChunk() // delete all tRTCP_SDES_ITEM objects from SdesItemList for (const auto& pstSdesItem : m_stSdesItemList) { - if (pstSdesItem->pValue != RTP_NULL) + if (pstSdesItem->pValue != nullptr) { delete[] pstSdesItem->pValue; } @@ -62,7 +62,7 @@ eRTP_STATUS_CODE RtcpChunk::decodeRtcpChunk(IN RtpDt_UChar* pucChunkBuf, while (uiSdesItemCnt > RTP_ZERO) { tRTCP_SDES_ITEM* pstSdesItem = new tRTCP_SDES_ITEM(); - if (pstSdesItem == RTP_NULL) + if (pstSdesItem == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); return RTP_MEMORY_FAIL; @@ -88,7 +88,7 @@ eRTP_STATUS_CODE RtcpChunk::decodeRtcpChunk(IN RtpDt_UChar* pucChunkBuf, // value RtpDt_UChar* pcSdesBuf = new RtpDt_UChar[pstSdesItem->ucLength]; - if (pcSdesBuf == RTP_NULL) + if (pcSdesBuf == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); delete pstSdesItem; diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpConfigInfo.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpConfigInfo.cpp index 251f37c6..acb44366 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpConfigInfo.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpConfigInfo.cpp @@ -25,7 +25,7 @@ RtcpConfigInfo::RtcpConfigInfo() : { for (RtpDt_UInt32 uiCount = RTP_ZERO; uiCount < RTP_MAX_SDES_TYPE; uiCount++) { - m_arrSdesInfo[uiCount].pValue = RTP_NULL; + m_arrSdesInfo[uiCount].pValue = nullptr; m_arrSdesInfo[uiCount].ucType = RTP_ZERO; m_arrSdesInfo[uiCount].ucLength = RTP_ZERO; } @@ -35,10 +35,10 @@ RtcpConfigInfo::~RtcpConfigInfo() { for (RtpDt_UInt32 uiCount = RTP_ZERO; uiCount < RTP_MAX_SDES_TYPE; uiCount++) { - if (m_arrSdesInfo[uiCount].pValue != RTP_NULL) + if (m_arrSdesInfo[uiCount].pValue != nullptr) { delete[] m_arrSdesInfo[uiCount].pValue; - m_arrSdesInfo[uiCount].pValue = RTP_NULL; + m_arrSdesInfo[uiCount].pValue = nullptr; m_arrSdesInfo[uiCount].ucLength = 0; } } @@ -69,7 +69,7 @@ RtpDt_UInt32 RtcpConfigInfo::estimateSdesPktSize() RtpDt_UInt32 uiSdesPktSize = RTP_WORD_SIZE; for (RtpDt_UInt32 uiCount = RTP_ZERO; uiCount < RTP_MAX_SDES_TYPE; uiCount++) { - if (m_arrSdesInfo[uiCount].pValue != RTP_NULL) + if (m_arrSdesInfo[uiCount].pValue != nullptr) { uiSdesPktSize += m_arrSdesInfo[uiCount].ucLength; uiSdesPktSize += RTP_TWO; @@ -86,7 +86,7 @@ RtpDt_UInt32 RtcpConfigInfo::estimateSdesPktSize() eRtp_Bool RtcpConfigInfo::addRtcpSdesItem(IN tRTCP_SDES_ITEM* pstSdesItem, IN RtpDt_UInt32 uiIndex) { - if (pstSdesItem == RTP_NULL) + if (pstSdesItem == nullptr) { return eRTP_FAILURE; } @@ -95,12 +95,12 @@ eRtp_Bool RtcpConfigInfo::addRtcpSdesItem(IN tRTCP_SDES_ITEM* pstSdesItem, IN Rt if (pstSdesItem->ucLength > RTP_ZERO) { RtpDt_UChar* pcBuffer = new RtpDt_UChar[pstSdesItem->ucLength]; - if (pcBuffer == RTP_NULL) + if (pcBuffer == nullptr) { return eRTP_FALSE; } memcpy(pcBuffer, pstSdesItem->pValue, pstSdesItem->ucLength); - if (m_arrSdesInfo[uiIndex].pValue != RTP_NULL) + if (m_arrSdesInfo[uiIndex].pValue != nullptr) { delete[] m_arrSdesInfo[uiIndex].pValue; } @@ -140,7 +140,7 @@ RtpDt_Void RtcpConfigInfo::setSdesItemCount(IN RtpDt_UInt32 uiSdesItemCnt) tRTCP_SDES_ITEM* RtcpConfigInfo::getRtcpSdesItem(IN RtpDt_UInt32 uiIndex) { if (uiIndex >= RTP_MAX_SDES_TYPE) - return RTP_NULL; + return nullptr; return &m_arrSdesInfo[uiIndex]; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpFbPacket.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpFbPacket.cpp index ff7c4968..a115b678 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpFbPacket.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpFbPacket.cpp @@ -19,7 +19,7 @@ #include <string.h> RtcpFbPacket::RtcpFbPacket() : - m_pFCI(RTP_NULL) + m_pFCI(nullptr) { } @@ -28,7 +28,7 @@ RtcpFbPacket::~RtcpFbPacket() if (m_pFCI) { delete (m_pFCI); - m_pFCI = RTP_NULL; + m_pFCI = nullptr; } } @@ -95,7 +95,7 @@ eRTP_STATUS_CODE RtcpFbPacket::decodeRtcpFbPacket( if (usRtcpFbLen > 0) { RtpBuffer* pFCI = new RtpBuffer(usRtcpFbLen, reinterpret_cast<RtpDt_UChar*>(pucRtcpFbBuf)); - if (pFCI == RTP_NULL) + if (pFCI == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); return RTP_MEMORY_FAIL; diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpPacket.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpPacket.cpp index b1ec0f57..b67fde10 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpPacket.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpPacket.cpp @@ -23,10 +23,10 @@ RtcpPacket::RtcpPacket() : m_objSrPktList(std::list<RtcpSrPacket*>()), m_objRrPktList(std::list<RtcpRrPacket*>()), m_objFbPktList(std::list<RtcpFbPacket*>()), - m_pobjSdesPkt(RTP_NULL), - m_pobjByePkt(RTP_NULL), - m_pobjAppPkt(RTP_NULL), - m_pobjRtcpXrPkt(RTP_NULL) + m_pobjSdesPkt(nullptr), + m_pobjByePkt(nullptr), + m_pobjAppPkt(nullptr), + m_pobjRtcpXrPkt(nullptr) { } // Constructor @@ -54,26 +54,26 @@ RtcpPacket::~RtcpPacket() } m_objFbPktList.clear(); - if (m_pobjSdesPkt != RTP_NULL) + if (m_pobjSdesPkt != nullptr) { delete m_pobjSdesPkt; - m_pobjSdesPkt = RTP_NULL; + m_pobjSdesPkt = nullptr; } - if (m_pobjByePkt != RTP_NULL) + if (m_pobjByePkt != nullptr) { delete m_pobjByePkt; - m_pobjByePkt = RTP_NULL; + m_pobjByePkt = nullptr; } - if (m_pobjAppPkt != RTP_NULL) + if (m_pobjAppPkt != nullptr) { delete m_pobjAppPkt; - m_pobjAppPkt = RTP_NULL; + m_pobjAppPkt = nullptr; } - if (m_pobjRtcpXrPkt != RTP_NULL) + if (m_pobjRtcpXrPkt != nullptr) { delete m_pobjRtcpXrPkt; - m_pobjRtcpXrPkt = RTP_NULL; + m_pobjRtcpXrPkt = nullptr; } } // Destructor @@ -129,7 +129,7 @@ RtpDt_Void RtcpPacket::setAppPktData(IN RtcpAppPacket* pobjAppData) eRTP_STATUS_CODE RtcpPacket::addSrPacketData(IN RtcpSrPacket* pobjSrPkt) { - if (pobjSrPkt == RTP_NULL) + if (pobjSrPkt == nullptr) { return RTP_FAILURE; } @@ -139,7 +139,7 @@ eRTP_STATUS_CODE RtcpPacket::addSrPacketData(IN RtcpSrPacket* pobjSrPkt) eRTP_STATUS_CODE RtcpPacket::addRrPacketData(IN RtcpRrPacket* pobjRrPkt) { - if (pobjRrPkt == RTP_NULL) + if (pobjRrPkt == nullptr) { return RTP_FAILURE; } @@ -149,7 +149,7 @@ eRTP_STATUS_CODE RtcpPacket::addRrPacketData(IN RtcpRrPacket* pobjRrPkt) eRTP_STATUS_CODE RtcpPacket::addFbPacketData(IN RtcpFbPacket* pobjFbPkt) { - if (pobjFbPkt == RTP_NULL) + if (pobjFbPkt == nullptr) { return RTP_FAILURE; } @@ -176,7 +176,7 @@ eRTP_STATUS_CODE RtcpPacket::decodeRtcpPacket(IN RtpBuffer* pobjRtcpPktBuf, eRtp_Bool bFbPkt = eRTP_FALSE; eRtp_Bool bOtherPkt = eRTP_FALSE; - if (pobjRtcpPktBuf == NULL || pobjRtcpPktBuf->getBuffer() == NULL || + if (pobjRtcpPktBuf == nullptr || pobjRtcpPktBuf->getBuffer() == nullptr || pobjRtcpPktBuf->getLength() < RTP_WORD_SIZE) return RTP_INVALID_PARAMS; @@ -235,7 +235,7 @@ eRTP_STATUS_CODE RtcpPacket::decodeRtcpPacket(IN RtpBuffer* pobjRtcpPktBuf, { RTP_TRACE_MESSAGE("[DecodeRtcpPacket] Decoding RTCP_SR", 0, 0); RtcpSrPacket* pobjSrPkt = new RtcpSrPacket(); - if (pobjSrPkt == RTP_NULL) + if (pobjSrPkt == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); return RTP_MEMORY_FAIL; @@ -251,7 +251,7 @@ eRTP_STATUS_CODE RtcpPacket::decodeRtcpPacket(IN RtpBuffer* pobjRtcpPktBuf, RTP_TRACE_MESSAGE("[DecodeRtcpPacket] Decoding RTCP_RR", 0, 0); RtpDt_UInt16 uiRrPktLen = usPktLen; RtcpRrPacket* pobjRrPkt = new RtcpRrPacket(); - if (pobjRrPkt == RTP_NULL) + if (pobjRrPkt == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); return RTP_MEMORY_FAIL; @@ -266,7 +266,7 @@ eRTP_STATUS_CODE RtcpPacket::decodeRtcpPacket(IN RtpBuffer* pobjRtcpPktBuf, { RTP_TRACE_MESSAGE("[DecodeRtcpPacket] Decoding RTCP_SDES", 0, 0); m_pobjSdesPkt = new RtcpSdesPacket(); - if (m_pobjSdesPkt == RTP_NULL) + if (m_pobjSdesPkt == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); return RTP_MEMORY_FAIL; @@ -280,7 +280,7 @@ eRTP_STATUS_CODE RtcpPacket::decodeRtcpPacket(IN RtpBuffer* pobjRtcpPktBuf, { RTP_TRACE_MESSAGE("[DecodeRtcpPacket] Decoding RTCP_BYE", 0, 0); m_pobjByePkt = new RtcpByePacket(); - if (m_pobjByePkt == RTP_NULL) + if (m_pobjByePkt == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); return RTP_MEMORY_FAIL; @@ -294,7 +294,7 @@ eRTP_STATUS_CODE RtcpPacket::decodeRtcpPacket(IN RtpBuffer* pobjRtcpPktBuf, { RTP_TRACE_MESSAGE("[DecodeRtcpPacket] Decoding RTCP_APP", 0, 0); m_pobjAppPkt = new RtcpAppPacket(); - if (m_pobjAppPkt == RTP_NULL) + if (m_pobjAppPkt == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); return RTP_MEMORY_FAIL; @@ -309,7 +309,7 @@ eRTP_STATUS_CODE RtcpPacket::decodeRtcpPacket(IN RtpBuffer* pobjRtcpPktBuf, { RTP_TRACE_MESSAGE("[DecodeRtcpPacket] Decoding RTCP_RTPFB", 0, 0); RtcpFbPacket* pobjFbPkt = new RtcpFbPacket(); - if (pobjFbPkt == RTP_NULL) + if (pobjFbPkt == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); return RTP_MEMORY_FAIL; @@ -358,13 +358,13 @@ eRTP_STATUS_CODE RtcpPacket::formRtcpPacket(OUT RtpBuffer* pobjRtcpPktBuf) pobjRtcpPktBuf->setLength(RTP_ZERO); - if ((usSrSize == RTP_ZERO) && (usRrSize == RTP_ZERO) && (m_pobjByePkt == RTP_NULL)) + if ((usSrSize == RTP_ZERO) && (usRrSize == RTP_ZERO) && (m_pobjByePkt == nullptr)) { RTP_TRACE_WARNING("[formRtcpPacket] m_pobjSrPkt is NULL", RTP_ZERO, RTP_ZERO); return RTP_FAILURE; } - if ((m_pobjByePkt == RTP_NULL) && (m_pobjSdesPkt == RTP_NULL) && (m_pobjAppPkt == RTP_NULL) && + if ((m_pobjByePkt == nullptr) && (m_pobjSdesPkt == nullptr) && (m_pobjAppPkt == nullptr) && (usFbSize == RTP_ZERO)) { RTP_TRACE_WARNING("[formRtcpPacket] Not present 2nd pkt in Comp pkt", RTP_ZERO, RTP_ZERO); @@ -395,7 +395,7 @@ eRTP_STATUS_CODE RtcpPacket::formRtcpPacket(OUT RtpBuffer* pobjRtcpPktBuf) } } - if (m_pobjSdesPkt != RTP_NULL) + if (m_pobjSdesPkt != nullptr) { eEncodeRes = m_pobjSdesPkt->formSdesPacket(pobjRtcpPktBuf); if (eEncodeRes != RTP_SUCCESS) @@ -405,7 +405,7 @@ eRTP_STATUS_CODE RtcpPacket::formRtcpPacket(OUT RtpBuffer* pobjRtcpPktBuf) } } - if (m_pobjAppPkt != RTP_NULL) + if (m_pobjAppPkt != nullptr) { eEncodeRes = m_pobjAppPkt->formAppPacket(pobjRtcpPktBuf); if (eEncodeRes != RTP_SUCCESS) @@ -414,7 +414,7 @@ eRTP_STATUS_CODE RtcpPacket::formRtcpPacket(OUT RtpBuffer* pobjRtcpPktBuf) return eEncodeRes; } } - if (m_pobjByePkt != RTP_NULL) + if (m_pobjByePkt != nullptr) { eEncodeRes = m_pobjByePkt->formByePacket(pobjRtcpPktBuf); if (eEncodeRes != RTP_SUCCESS) @@ -435,7 +435,7 @@ eRTP_STATUS_CODE RtcpPacket::formRtcpPacket(OUT RtpBuffer* pobjRtcpPktBuf) } } - if (m_pobjRtcpXrPkt != RTP_NULL) + if (m_pobjRtcpXrPkt != nullptr) { eEncodeRes = m_pobjRtcpXrPkt->formRtcpXrPacket(pobjRtcpPktBuf); if (eEncodeRes != RTP_SUCCESS) diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpRrPacket.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpRrPacket.cpp index 1b76f1f7..d41c584c 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpRrPacket.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpRrPacket.cpp @@ -20,7 +20,7 @@ RtcpRrPacket::RtcpRrPacket() : m_objReportBlkList(std::list<RtcpReportBlock*>()), - m_pobjExt(RTP_NULL) + m_pobjExt(nullptr) { } @@ -33,10 +33,10 @@ RtcpRrPacket::~RtcpRrPacket() } m_objReportBlkList.clear(); - if (m_pobjExt != RTP_NULL) + if (m_pobjExt != nullptr) { delete m_pobjExt; - m_pobjExt = RTP_NULL; + m_pobjExt = nullptr; } } @@ -77,7 +77,7 @@ eRTP_STATUS_CODE RtcpRrPacket::decodeRrPacket( while (usRepBlkLen >= RTP_24) { RtcpReportBlock* pobjRptBlk = new RtcpReportBlock(); - if (pobjRptBlk == RTP_NULL) + if (pobjRptBlk == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); return RTP_MEMORY_FAIL; @@ -92,14 +92,14 @@ eRTP_STATUS_CODE RtcpRrPacket::decodeRrPacket( if (usProfExtLen > RTP_ZERO) { RtpDt_UChar* pcProfExtBuf = new RtpDt_UChar[usProfExtLen]; - if (pcProfExtBuf == RTP_NULL) + if (pcProfExtBuf == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); return RTP_MEMORY_FAIL; } m_pobjExt = new RtpBuffer(); - if (m_pobjExt == RTP_NULL) + if (m_pobjExt == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); delete[] pcProfExtBuf; @@ -132,7 +132,7 @@ eRTP_STATUS_CODE RtcpRrPacket::formRrPacket(OUT RtpBuffer* pobjRtcpPktBuf, IN eR RtpDt_UInt32 uiCurPos = pobjRtcpPktBuf->getLength(); #ifdef ENABLE_RTCPEXT - if (m_pobjExt != RTP_NULL) + if (m_pobjExt != nullptr) { RtpDt_UChar* pucExtHdr = m_pobjExt->getBuffer(); RtpDt_UInt32 uiExtHdrLen = m_pobjExt->getLength(); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpSdesPacket.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpSdesPacket.cpp index 1edc5a33..736247b4 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpSdesPacket.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpSdesPacket.cpp @@ -54,7 +54,7 @@ eRTP_STATUS_CODE RtcpSdesPacket::decodeSdesPacket( while ((unSourceCount > RTP_ZERO) && (usSdesLen > RTP_ZERO)) { RtcpChunk* pobjRtcpChunk = new RtcpChunk(); - if (pobjRtcpChunk == RTP_NULL) + if (pobjRtcpChunk == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); return RTP_MEMORY_FAIL; @@ -132,7 +132,7 @@ eRTP_STATUS_CODE RtcpSdesPacket::formSdesPacket(OUT RtpBuffer* pobjRtcpPktBuf) m_objRtcpHdr.formPartialRtcpHeader(pobjRtcpPktBuf); RTP_TRACE_MESSAGE( - "formSdesPacket, [SDES packet length] : %d]", m_objRtcpHdr.getLength(), RTP_NULL); + "formSdesPacket, [SDES packet length] : %d]", m_objRtcpHdr.getLength(), nullptr); // set the actual position of the RTCP compound packet pobjRtcpPktBuf->setLength(uiCurPos); diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpSrPacket.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpSrPacket.cpp index 9ee5c4e4..3dd1c99c 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpSrPacket.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpSrPacket.cpp @@ -211,7 +211,7 @@ eRTP_STATUS_CODE RtcpSrPacket::decodeSrPacket( */ - if (pucSrPktBuf == NULL || usSrPktLen < RTCP_SR_PACKET_LENGTH) + if (pucSrPktBuf == nullptr || usSrPktLen < RTCP_SR_PACKET_LENGTH) return RTP_FAILURE; // NTP timestamp most significant word diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpXrPacket.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpXrPacket.cpp index b46b89fe..c8a789f4 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpXrPacket.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtcpXrPacket.cpp @@ -23,7 +23,7 @@ (ptr)[(*(p_offset))++] = ((value) >> 8) & 0x00ff, (ptr)[(*(p_offset))++] = ((value)&0x00ff) RtcpXrPacket::RtcpXrPacket() : - m_reportBlk(RTP_NULL) + m_reportBlk(nullptr) { } @@ -32,7 +32,7 @@ RtcpXrPacket::~RtcpXrPacket() if (m_reportBlk) { delete (m_reportBlk); - m_reportBlk = RTP_NULL; + m_reportBlk = nullptr; } } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtpPacket.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtpPacket.cpp index 7267ae50..7ee0e408 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtpPacket.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtpPacket.cpp @@ -18,8 +18,8 @@ #include <RtpTrace.h> RtpPacket::RtpPacket() : - m_pobjExt(RTP_NULL), - m_pobjRtpPayload(RTP_NULL) + m_pobjExt(nullptr), + m_pobjRtpPayload(nullptr) #ifdef ENABLE_PADDING , m_ucPadLen(RTP_ZERO) @@ -29,16 +29,16 @@ RtpPacket::RtpPacket() : RtpPacket::~RtpPacket() { - if (m_pobjExt != RTP_NULL) + if (m_pobjExt != nullptr) { delete m_pobjExt; - m_pobjExt = RTP_NULL; + m_pobjExt = nullptr; } - if (m_pobjRtpPayload != RTP_NULL) + if (m_pobjRtpPayload != nullptr) { delete m_pobjRtpPayload; - m_pobjRtpPayload = RTP_NULL; + m_pobjRtpPayload = nullptr; } } @@ -84,7 +84,7 @@ eRtp_Bool RtpPacket::formPacket(IN RtpBuffer* pobjRtpPktBuf) pcRtpBuf = pcRtpBuf + uiRtpBufPos; // extension header - if (m_pobjExt != RTP_NULL) + if (m_pobjExt != nullptr) { const RtpDt_UChar* pRtpUtlBuf = m_pobjExt->getBuffer(); uiRtpUtlBufLen = m_pobjExt->getLength(); @@ -94,7 +94,7 @@ eRtp_Bool RtpPacket::formPacket(IN RtpBuffer* pobjRtpPktBuf) } // rtp packet - if (m_pobjRtpPayload != RTP_NULL) + if (m_pobjRtpPayload != nullptr) { const RtpDt_UChar* pRtpUtlBuf = m_pobjRtpPayload->getBuffer(); uiRtpUtlBufLen = m_pobjRtpPayload->getLength(); @@ -151,7 +151,7 @@ eRtp_Bool RtpPacket::decodePacket(IN RtpBuffer* pobjRtpPktBuf) { RTP_TRACE_MESSAGE("[XHdr] Extension Header detected", 0, 0); m_pobjExt = new RtpBuffer(); - if (m_pobjExt == RTP_NULL) + if (m_pobjExt == nullptr) { return eRTP_FAILURE; } @@ -173,7 +173,7 @@ eRtp_Bool RtpPacket::decodePacket(IN RtpBuffer* pobjRtpPktBuf) } RtpDt_UChar* pRtpExtData = new RtpDt_UChar[uXHdrLen]; - if (pRtpExtData == RTP_NULL) + if (pRtpExtData == nullptr) { return eRTP_FAILURE; } @@ -211,13 +211,13 @@ eRtp_Bool RtpPacket::decodePacket(IN RtpBuffer* pobjRtpPktBuf) } m_pobjRtpPayload = new RtpBuffer(); - if (m_pobjRtpPayload == RTP_NULL) + if (m_pobjRtpPayload == nullptr) { return eRTP_FAILURE; } - RtpDt_UChar* pRtpUtlBuf = RTP_NULL; + RtpDt_UChar* pRtpUtlBuf = nullptr; pRtpUtlBuf = new RtpDt_UChar[uiRtpUtlBufLen]; - if (pRtpUtlBuf == RTP_NULL) + if (pRtpUtlBuf == nullptr) { return eRTP_FAILURE; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtpReceiverInfo.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtpReceiverInfo.cpp index b162a712..55f7af05 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtpReceiverInfo.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtpReceiverInfo.cpp @@ -24,7 +24,7 @@ RtpReceiverInfo::RtpReceiverInfo() : m_bSender(eRTP_FALSE), m_uiTotalRcvdRtpPkts(RTP_ZERO), m_uiTotalRcvdRtpOcts(RTP_ZERO), - m_pobjIpAddr(RTP_NULL), + m_pobjIpAddr(nullptr), m_usPort(RTP_ZERO), m_bIsCsrcFlag(eRTP_FALSE), m_prevRtpTimestamp(RTP_ZERO), @@ -44,10 +44,10 @@ RtpReceiverInfo::RtpReceiverInfo() : RtpReceiverInfo::~RtpReceiverInfo() { - if (m_pobjIpAddr != RTP_NULL) + if (m_pobjIpAddr != nullptr) { delete m_pobjIpAddr; - m_pobjIpAddr = RTP_NULL; + m_pobjIpAddr = nullptr; } } @@ -271,7 +271,7 @@ eRTP_STATUS_CODE RtpReceiverInfo::setIpAddr(IN RtpBuffer* pobjIpAddr) RtpDt_UChar* pBuffer = pobjIpAddr->getBuffer(); RtpDt_UInt32 uiLength = pobjIpAddr->getLength(); m_pobjIpAddr = new RtpBuffer(uiLength, pBuffer); - if (m_pobjIpAddr == RTP_NULL) + if (m_pobjIpAddr == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); return RTP_MEMORY_FAIL; diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtpSession.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtpSession.cpp index 971931c3..d7c09bcb 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtpSession.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtpSession.cpp @@ -28,20 +28,20 @@ extern RtpDt_Void Rtp_RtcpTimerCb(IN RtpDt_Void* pvTimerId, IN RtpDt_Void* pvData); RtpSession::RtpSession() : - m_pobjTransAddr(RTP_NULL), + m_pobjTransAddr(nullptr), m_usRtpPort(RTP_ZERO), m_usRtcpPort(RTP_ZERO), - m_pobjRtpStack(RTP_NULL), + m_pobjRtpStack(nullptr), m_usExtHdrLen(RTP_ZERO), - m_pobjRtcpCfgInfo(RTP_NULL), + m_pobjRtcpCfgInfo(nullptr), m_bEnableRTP(eRTP_FALSE), m_bEnableRTCP(eRTP_FALSE), m_bEnableRTCPBye(eRTP_FALSE), m_usRTCPTimerVal(RTP_ZERO), m_usSeqNum(RTP_ZERO), m_usSeqNumCycles(RTP_ZERO), - m_pobjPayloadInfo(RTP_NULL), - m_pobjAppInterface(RTP_NULL), + m_pobjPayloadInfo(nullptr), + m_pobjAppInterface(nullptr), m_uiSsrc(RTP_ZERO), m_uiSessionMtu(RTP_DEF_MTU_SIZE), m_uiRtpSendPktCount(RTP_ZERO), @@ -49,7 +49,7 @@ RtpSession::RtpSession() : m_uiRtcpSendPktCount(RTP_ZERO), m_uiRtcpSendOctCount(RTP_ZERO), m_bSelfCollisionByeSent(eRTP_FAILURE), - m_pTimerId(RTP_NULL), + m_pTimerId(nullptr), m_bRtcpSendPkt(eRTP_FALSE), m_bSndRtcpByePkt(eRTP_FALSE), m_lastRTTDelay(RTP_ZERO), @@ -59,25 +59,25 @@ RtpSession::RtpSession() : m_pobjRtcpCfgInfo = new RtcpConfigInfo(); m_pobjRtpRcvrInfoList = new std::list<RtpReceiverInfo*>(); m_pobjPayloadInfo = new RtpPayloadInfo(); - m_pobjUtlRcvrList = RTP_NULL; - m_stRtcpXr.m_pBlockBuffer = RTP_NULL; + m_pobjUtlRcvrList = nullptr; + m_stRtcpXr.m_pBlockBuffer = nullptr; } RtpSession::RtpSession(IN RtpStack* pobjStack) : - m_pobjTransAddr(RTP_NULL), + m_pobjTransAddr(nullptr), m_usRtpPort(RTP_ZERO), m_usRtcpPort(RTP_ZERO), m_pobjRtpStack(pobjStack), m_usExtHdrLen(RTP_ZERO), - m_pobjRtcpCfgInfo(RTP_NULL), + m_pobjRtcpCfgInfo(nullptr), m_bEnableRTP(eRTP_FALSE), m_bEnableRTCP(eRTP_FALSE), m_bEnableRTCPBye(eRTP_FALSE), m_usRTCPTimerVal(RTP_ZERO), m_usSeqNum(RTP_ZERO), m_usSeqNumCycles(RTP_ZERO), - m_pobjPayloadInfo(RTP_NULL), - m_pobjAppInterface(RTP_NULL), + m_pobjPayloadInfo(nullptr), + m_pobjAppInterface(nullptr), m_uiSsrc(RTP_ZERO), m_uiSessionMtu(RTP_DEF_MTU_SIZE), m_uiRtpSendPktCount(RTP_ZERO), @@ -85,7 +85,7 @@ RtpSession::RtpSession(IN RtpStack* pobjStack) : m_uiRtcpSendPktCount(RTP_ZERO), m_uiRtcpSendOctCount(RTP_ZERO), m_bSelfCollisionByeSent(eRTP_FAILURE), - m_pTimerId(RTP_NULL), + m_pTimerId(nullptr), m_bRtcpSendPkt(eRTP_FALSE), m_bSndRtcpByePkt(eRTP_FALSE), m_lastRTTDelay(RTP_ZERO), @@ -95,34 +95,34 @@ RtpSession::RtpSession(IN RtpStack* pobjStack) : m_pobjRtcpCfgInfo = new RtcpConfigInfo(); m_pobjPayloadInfo = new RtpPayloadInfo(); m_pobjRtpRcvrInfoList = new std::list<RtpReceiverInfo*>(); - m_pobjUtlRcvrList = RTP_NULL; - m_stRtcpXr.m_pBlockBuffer = RTP_NULL; + m_pobjUtlRcvrList = nullptr; + m_stRtcpXr.m_pBlockBuffer = nullptr; } RtpSession::~RtpSession() { std::lock_guard<std::mutex> guard(m_objRtpSessionLock); - if (m_pobjTransAddr != RTP_NULL) + if (m_pobjTransAddr != nullptr) { delete m_pobjTransAddr; - m_pobjTransAddr = RTP_NULL; + m_pobjTransAddr = nullptr; } - m_pobjRtpStack = RTP_NULL; - if (m_pobjRtcpCfgInfo != RTP_NULL) + m_pobjRtpStack = nullptr; + if (m_pobjRtcpCfgInfo != nullptr) { delete m_pobjRtcpCfgInfo; - m_pobjRtcpCfgInfo = RTP_NULL; + m_pobjRtcpCfgInfo = nullptr; } - if (m_pobjPayloadInfo != RTP_NULL) + if (m_pobjPayloadInfo != nullptr) { delete m_pobjPayloadInfo; - m_pobjPayloadInfo = RTP_NULL; + m_pobjPayloadInfo = nullptr; } - if (m_pTimerId != RTP_NULL) + if (m_pTimerId != nullptr) { } @@ -132,7 +132,7 @@ RtpSession::~RtpSession() for (RtpDt_UInt32 uiCount = RTP_ZERO; uiCount < usSize; uiCount++) { - RtpReceiverInfo* pobjRcvrElm = RTP_NULL; + RtpReceiverInfo* pobjRcvrElm = nullptr; // get the member information pobjRcvrElm = m_pobjRtpRcvrInfoList->front(); m_pobjRtpRcvrInfoList->pop_front(); @@ -141,8 +141,8 @@ RtpSession::~RtpSession() delete m_pobjRtpRcvrInfoList; delete m_pobjAppInterface; - m_pobjRtpRcvrInfoList = RTP_NULL; - m_pobjAppInterface = RTP_NULL; + m_pobjRtpRcvrInfoList = nullptr; + m_pobjAppInterface = nullptr; } RtpDt_UInt16 RtpSession::getExtHdrLen() @@ -172,7 +172,7 @@ RtpDt_UInt16 RtpSession::getRtpPort() RtpDt_Void RtpSession::setRtpTransAddr(IN RtpBuffer* pobjDestTransAddr) { - if (m_pobjTransAddr != RTP_NULL) + if (m_pobjTransAddr != nullptr) delete m_pobjTransAddr; m_pobjTransAddr = pobjDestTransAddr; @@ -185,7 +185,7 @@ RtpBuffer* RtpSession::getRtpTransAddr() eRtp_Bool RtpSession::compareRtpSessions(IN RtpSession* pobjSession) { - if (pobjSession == RTP_NULL) + if (pobjSession == nullptr) { RTP_TRACE_WARNING("compareRtpSessions, Input param is Null.", RTP_ZERO, RTP_ZERO); return eRTP_FAILURE; @@ -196,21 +196,21 @@ eRtp_Bool RtpSession::compareRtpSessions(IN RtpSession* pobjSession) if (m_usRtpPort == pobjSession->getRtpPort()) { RtpBuffer* objRtpBuff = pobjSession->getRtpTransAddr(); - if (m_pobjTransAddr == RTP_NULL && objRtpBuff == RTP_NULL) + if (m_pobjTransAddr == nullptr && objRtpBuff == nullptr) { return eRTP_SUCCESS; } - RtpDt_UChar* pcTranAddr1 = RTP_NULL; - if (m_pobjTransAddr != RTP_NULL) + RtpDt_UChar* pcTranAddr1 = nullptr; + if (m_pobjTransAddr != nullptr) { pcTranAddr1 = m_pobjTransAddr->getBuffer(); } - RtpDt_UChar* pcTranAddr2 = RTP_NULL; - if (objRtpBuff != RTP_NULL) + RtpDt_UChar* pcTranAddr2 = nullptr; + if (objRtpBuff != nullptr) { pcTranAddr2 = objRtpBuff->getBuffer(); } - if (pcTranAddr1 == RTP_NULL || pcTranAddr2 == RTP_NULL) + if (pcTranAddr1 == nullptr || pcTranAddr2 == nullptr) { return eRTP_FAILURE; } @@ -228,7 +228,7 @@ RtpDt_Void Rtp_RtcpTimerCb(IN RtpDt_Void* pvTimerId, IN RtpDt_Void* pvData) { RtpSessionManager* pobjActSesDb = RtpSessionManager::getInstance(); RtpSession* pobjRtpSession = static_cast<RtpSession*>(pvData); - if (pobjRtpSession == RTP_NULL) + if (pobjRtpSession == nullptr) { RTP_TRACE_WARNING("Rtp_RtcpTimerCb, pvTimerId is NULL.", RTP_ZERO, RTP_ZERO); return; @@ -255,14 +255,14 @@ RtpDt_UInt32 RtpSession::estimateRtcpPktSize() uiEstRtcpSize = RTP_DEF_BYE_PKT_SIZE; uiEstRtcpSize += m_pobjRtcpCfgInfo->getByeReasonSize(); - RTP_TRACE_MESSAGE("estimateRtcpPktSize, [Bye packet size : %d]", uiEstRtcpSize, RTP_NULL); + RTP_TRACE_MESSAGE("estimateRtcpPktSize, [Bye packet size : %d]", uiEstRtcpSize, nullptr); } else if (uiSdesItems > RTP_ZERO) { RtpDt_UInt32 uiSdesPktSize = RTP_WORD_SIZE; uiSdesPktSize = uiSdesPktSize + m_pobjRtcpCfgInfo->estimateSdesPktSize(); - RTP_TRACE_MESSAGE("estimateRtcpPktSize, [uiSdesPktSize : %d]", uiSdesPktSize, RTP_NULL); + RTP_TRACE_MESSAGE("estimateRtcpPktSize, [uiSdesPktSize : %d]", uiSdesPktSize, nullptr); uiEstRtcpSize += uiSdesPktSize; } @@ -272,7 +272,7 @@ RtpDt_UInt32 RtpSession::estimateRtcpPktSize() uiEstRtcpSize += RTP_DEF_APP_PKT_SIZE; uiEstRtcpSize += m_pobjRtcpCfgInfo->getAppDepDataSize(); - RTP_TRACE_MESSAGE("estimateRtcpPktSize, [after app pkt size: %d]", uiEstRtcpSize, RTP_NULL); + RTP_TRACE_MESSAGE("estimateRtcpPktSize, [after app pkt size: %d]", uiEstRtcpSize, nullptr); } return uiEstRtcpSize; @@ -286,7 +286,7 @@ eRTP_STATUS_CODE RtpSession::formSrList(IN RtpDt_UInt32 uiSndrCount, OUT RtcpPac while (uiSndrCount > RTP_MAX_RECEP_REP_CNT) { RtcpSrPacket* pobjSrPkt = new RtcpSrPacket(); - if (pobjSrPkt == RTP_NULL) + if (pobjSrPkt == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); return RTP_MEMORY_FAIL; @@ -308,7 +308,7 @@ eRTP_STATUS_CODE RtpSession::formSrList(IN RtpDt_UInt32 uiSndrCount, OUT RtcpPac if ((uiSndrCount > RTP_ZERO) || (uiTmpFlg == RTP_ZERO)) { RtcpSrPacket* pobjSrPkt = new RtcpSrPacket(); - if (pobjSrPkt == RTP_NULL) + if (pobjSrPkt == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); return RTP_MEMORY_FAIL; @@ -336,7 +336,7 @@ eRTP_STATUS_CODE RtpSession::formRrList(IN RtpDt_UInt32 uiSndrCount, OUT RtcpPac while (uiSndrCount > RTP_MAX_RECEP_REP_CNT) { RtcpRrPacket* pobjRrPkt = new RtcpRrPacket(); - if (pobjRrPkt == RTP_NULL) + if (pobjRrPkt == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); return RTP_MEMORY_FAIL; @@ -360,7 +360,7 @@ eRTP_STATUS_CODE RtpSession::formRrList(IN RtpDt_UInt32 uiSndrCount, OUT RtcpPac if ((uiSndrCount > RTP_ZERO) || (uiTmpFlg == RTP_ZERO)) { RtcpRrPacket* pobjRrPkt = new RtcpRrPacket(); - if (pobjRrPkt == RTP_NULL) + if (pobjRrPkt == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); return RTP_MEMORY_FAIL; @@ -581,7 +581,7 @@ eRTP_STATUS_CODE RtpSession::rtpSendRtcpPacket(IN_OUT RtcpPacket* objRtcpPkt) { RtpBuffer* pRtcpBuf = new RtpBuffer(); - if (pRtcpBuf == RTP_NULL) + if (pRtcpBuf == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); m_pobjAppInterface->rtcpTimerHdlErrorInd(RTP_MEMORY_FAIL); @@ -590,7 +590,7 @@ eRTP_STATUS_CODE RtpSession::rtpSendRtcpPacket(IN_OUT RtcpPacket* objRtcpPkt) RtpDt_UChar* pcBuff = new RtpDt_UChar[RTP_DEF_MTU_SIZE]; - if (pcBuff == RTP_NULL) + if (pcBuff == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); delete pRtcpBuf; @@ -623,10 +623,10 @@ eRTP_STATUS_CODE RtpSession::rtpSendRtcpPacket(IN_OUT RtcpPacket* objRtcpPkt) m_objTimerInfo.updateAvgRtcpSize(pRtcpBuf->getLength()); delete pRtcpBuf; - if (m_stRtcpXr.m_pBlockBuffer != RTP_NULL) + if (m_stRtcpXr.m_pBlockBuffer != nullptr) { delete m_stRtcpXr.m_pBlockBuffer; - m_stRtcpXr.m_pBlockBuffer = RTP_NULL; + m_stRtcpXr.m_pBlockBuffer = nullptr; } return RTP_SUCCESS; @@ -649,7 +649,7 @@ RtpDt_Void RtpSession::rtcpTimerExpiry(IN RtpDt_Void* pvTimerId) if (m_pTimerId == pvTimerId) { - m_pTimerId = RTP_NULL; + m_pTimerId = nullptr; } RtpDt_UInt16 usMembers = m_pobjRtpRcvrInfoList->size(); @@ -674,7 +674,7 @@ RtpDt_Void RtpSession::rtcpTimerExpiry(IN RtpDt_Void* pvTimerId) m_objTimerInfo.setTn(uiTempTn); RtpDt_UInt32 uiTimerVal = RTP_ZERO; - RtpDt_Void* pvData = RTP_NULL; + RtpDt_Void* pvData = nullptr; if ((m_bSelfCollisionByeSent != eRTP_TRUE) || (m_bSndRtcpByePkt != eRTP_TRUE)) { @@ -693,7 +693,7 @@ RtpDt_Void RtpSession::rtcpTimerExpiry(IN RtpDt_Void* pvTimerId) eRtp_Bool bTSres = eRTP_FALSE; bTSres = m_pobjAppInterface->RtpStopTimer(m_pTimerId, &pvData); - m_pTimerId = RTP_NULL; + m_pTimerId = nullptr; if (bTSres == eRTP_FALSE) { return; @@ -702,7 +702,7 @@ RtpDt_Void RtpSession::rtcpTimerExpiry(IN RtpDt_Void* pvTimerId) { RtpDt_Void* pvSTRes = m_pobjAppInterface->RtpStartTimer( uiTimerVal, eRTP_FALSE, m_pfnTimerCb, reinterpret_cast<RtpDt_Void*>(this)); - if (pvSTRes == RTP_NULL) + if (pvSTRes == nullptr) { return; } @@ -756,11 +756,11 @@ RtpDt_Void RtpSession::rtcpTimerExpiry(IN RtpDt_Void* pvTimerId) // uiTimerVal = (RtpDt_UInt32)dTempT; // Reschedule the next report for time tn - if (m_pTimerId != RTP_NULL) + if (m_pTimerId != nullptr) { eRtp_Bool bTSres = eRTP_FALSE; bTSres = m_pobjAppInterface->RtpStopTimer(m_pTimerId, &pvData); - m_pTimerId = RTP_NULL; + m_pTimerId = nullptr; if (bTSres == eRTP_FALSE) { return; @@ -769,12 +769,12 @@ RtpDt_Void RtpSession::rtcpTimerExpiry(IN RtpDt_Void* pvTimerId) if (m_bEnableRTCP == eRTP_TRUE) { - RtpDt_Void* pvSTRes = RTP_NULL; + RtpDt_Void* pvSTRes = nullptr; pvSTRes = m_pobjAppInterface->RtpStartTimer( uiTimerVal, eRTP_FALSE, m_pfnTimerCb, reinterpret_cast<RtpDt_Void*>(this)); - if (pvSTRes == RTP_NULL) + if (pvSTRes == nullptr) { return; } @@ -863,7 +863,7 @@ eRTP_STATUS_CODE RtpSession::populateReportPacket( std::list<RtpReceiverInfo*>* pobjTmpRcvrList = m_pobjRtpRcvrInfoList; m_pobjUtlRcvrList = new std::list<RtpReceiverInfo*>(); - if (m_pobjUtlRcvrList == RTP_NULL) + if (m_pobjUtlRcvrList == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); return RTP_MEMORY_FAIL; @@ -879,12 +879,12 @@ eRTP_STATUS_CODE RtpSession::populateReportPacket( if ((pobjRcvrElm->isSender() == eRTP_TRUE) && (uiTmpRecpCount <= uiRecepCount)) { RtcpReportBlock* pobjRepBlk = new RtcpReportBlock(); - if (pobjRepBlk == RTP_NULL) + if (pobjRepBlk == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); cleanUtlReceiverList(); delete m_pobjUtlRcvrList; - m_pobjUtlRcvrList = RTP_NULL; + m_pobjUtlRcvrList = nullptr; return RTP_MEMORY_FAIL; } pobjRcvrElm->populateReportBlock(pobjRepBlk); @@ -923,7 +923,7 @@ eRTP_STATUS_CODE RtpSession::populateReportPacket( if (m_usExtHdrLen > RTP_ZERO) { RtpBuffer* pobjExtHdrInfo = new RtpBuffer(); - if (pobjExtHdrInfo == RTP_NULL) + if (pobjExtHdrInfo == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); return RTP_MEMORY_FAIL; @@ -942,7 +942,7 @@ eRTP_STATUS_CODE RtpSession::populateReportPacket( eRTP_STATUS_CODE RtpSession::populateByePacket(IN_OUT RtcpPacket* pobjRtcpPkt) { RtcpByePacket* pobjByePkt = new RtcpByePacket(); - if (pobjByePkt == RTP_NULL) + if (pobjByePkt == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); return RTP_MEMORY_FAIL; @@ -959,13 +959,13 @@ eRTP_STATUS_CODE RtpSession::populateByePacket(IN_OUT RtcpPacket* pobjRtcpPkt) eRTP_STATUS_CODE RtpSession::populateAppPacket(IN_OUT RtcpPacket* pobjRtcpPkt) { RtcpAppPacket* pobjAppPkt = new RtcpAppPacket(); - if (pobjAppPkt == RTP_NULL) + if (pobjAppPkt == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); return RTP_MEMORY_FAIL; } RtpBuffer* pobjPayload = new RtpBuffer(); - if (pobjPayload == RTP_NULL) + if (pobjPayload == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); delete pobjAppPkt; @@ -1026,20 +1026,20 @@ eRTP_STATUS_CODE RtpSession::populateRtcpFbPacket(IN_OUT RtcpPacket* pobjRtcpPkt eRTP_STATUS_CODE RtpSession::constructSdesPkt(IN_OUT RtcpPacket* pobjRtcpPkt) { - if (m_pobjRtcpCfgInfo == RTP_NULL || pobjRtcpPkt == RTP_NULL) + if (m_pobjRtcpCfgInfo == nullptr || pobjRtcpPkt == nullptr) return RTP_FAILURE; RtpDt_UInt32 uiSdesItems = m_pobjRtcpCfgInfo->getSdesItemCount(); RtcpSdesPacket* pobjSdesPkt = new RtcpSdesPacket(); - if (pobjSdesPkt == RTP_NULL) + if (pobjSdesPkt == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); return RTP_MEMORY_FAIL; } RtcpChunk* pobjChunk = new RtcpChunk(); - if (pobjChunk == RTP_NULL) + if (pobjChunk == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); delete pobjSdesPkt; @@ -1047,7 +1047,7 @@ eRTP_STATUS_CODE RtpSession::constructSdesPkt(IN_OUT RtcpPacket* pobjRtcpPkt) } RtcpHeader* pRtcpHdr = pobjSdesPkt->getRtcpHdrInfo(); - if (pRtcpHdr == RTP_NULL) + if (pRtcpHdr == nullptr) { RTP_TRACE_ERROR("Failed to retrieve Rtcp Header Info", RTP_ZERO, RTP_ZERO); delete pobjSdesPkt; @@ -1071,16 +1071,16 @@ eRTP_STATUS_CODE RtpSession::constructSdesPkt(IN_OUT RtcpPacket* pobjRtcpPkt) { tRTCP_SDES_ITEM* pstSdesItem = m_pobjRtcpCfgInfo->getRtcpSdesItem(uiCount); - if (pstSdesItem && pstSdesItem->pValue != RTP_NULL) + if (pstSdesItem && pstSdesItem->pValue != nullptr) { tRTCP_SDES_ITEM* pstTmpSdesItem = new tRTCP_SDES_ITEM(); - if (pstTmpSdesItem == RTP_NULL) + if (pstTmpSdesItem == nullptr) { return RTP_MEMORY_FAIL; } RtpDt_UChar* pucSdesBuf = new RtpDt_UChar[pstSdesItem->ucLength]; - if (pucSdesBuf == RTP_NULL) + if (pucSdesBuf == nullptr) { delete pstTmpSdesItem; return RTP_MEMORY_FAIL; @@ -1117,7 +1117,7 @@ eRtp_Bool RtpSession::isRtpEnabled() eRTP_STATUS_CODE RtpSession::enableRtcp(eRtp_Bool enableRTCPBye) { RtpStackProfile* pobjRtpProfile = m_pobjRtpStack->getStackProfile(); - if (pobjRtpProfile == RTP_NULL) + if (pobjRtpProfile == nullptr) return RTP_FAILURE; // timer value shall be in milli seconds @@ -1140,28 +1140,28 @@ eRTP_STATUS_CODE RtpSession::enableRtcp(eRtp_Bool enableRTCPBye) RtpSessionManager* pobjActSesDb = RtpSessionManager::getInstance(); pobjActSesDb->addRtpSession(reinterpret_cast<RtpDt_Void*>(this)); - RtpDt_Void* pvData = RTP_NULL; + RtpDt_Void* pvData = nullptr; - if (m_pTimerId != RTP_NULL && m_pobjAppInterface != RTP_NULL) + if (m_pTimerId != nullptr && m_pobjAppInterface != nullptr) { eRtp_Bool bTSres = eRTP_FALSE; bTSres = m_pobjAppInterface->RtpStopTimer(m_pTimerId, &pvData); - m_pTimerId = RTP_NULL; + m_pTimerId = nullptr; if (bTSres == eRTP_FALSE) { RTP_TRACE_WARNING("enableRtcp, Stop timer is returned NULL value.", RTP_ZERO, RTP_ZERO); return RTP_TIMER_PROC_ERR; } } - RtpDt_Void* pvSTRes = RTP_NULL; + RtpDt_Void* pvSTRes = nullptr; - if (m_pobjAppInterface != RTP_NULL) + if (m_pobjAppInterface != nullptr) { m_pfnTimerCb = Rtp_RtcpTimerCb; // start RTCP timer with default value pvSTRes = m_pobjAppInterface->RtpStartTimer( uiTimerVal, eRTP_FALSE, m_pfnTimerCb, reinterpret_cast<RtpDt_Void*>(this)); - if (pvSTRes == RTP_NULL) + if (pvSTRes == nullptr) { RTP_TRACE_WARNING( "enableRtcp, start timer is returned NULL value.", RTP_ZERO, RTP_ZERO); @@ -1185,17 +1185,17 @@ eRTP_STATUS_CODE RtpSession::enableRtcp(eRtp_Bool enableRTCPBye) eRTP_STATUS_CODE RtpSession::disableRtcp() { - RtpDt_Void* pvData = RTP_NULL; + RtpDt_Void* pvData = nullptr; RtpSessionManager* pobjActSesDb = RtpSessionManager::getInstance(); pobjActSesDb->removeRtpSession(this); m_bEnableRTCP = eRTP_FALSE; m_bEnableRTCPBye = eRTP_FALSE; - if (m_pTimerId != RTP_NULL && m_pobjAppInterface != RTP_NULL) + if (m_pTimerId != nullptr && m_pobjAppInterface != nullptr) { m_pobjAppInterface->RtpStopTimer(m_pTimerId, &pvData); - m_pTimerId = RTP_NULL; + m_pTimerId = nullptr; } m_objTimerInfo.cleanUp(); @@ -1207,9 +1207,9 @@ eRTP_STATUS_CODE RtpSession::initSession( IN IRtpAppInterface* pobjAppInterface, IN RtcpConfigInfo* pobjRtcpConfigInfo) { // set m_pobjAppInterface - if (pobjAppInterface != RTP_NULL) + if (pobjAppInterface != nullptr) { - if (m_pobjAppInterface != RTP_NULL) + if (m_pobjAppInterface != nullptr) delete m_pobjAppInterface; m_pobjAppInterface = pobjAppInterface; @@ -1222,9 +1222,9 @@ eRTP_STATUS_CODE RtpSession::initSession( } // set pobjRtcpConfigInfo - if (pobjRtcpConfigInfo != RTP_NULL) + if (pobjRtcpConfigInfo != nullptr) { - if (m_pobjRtcpCfgInfo != RTP_NULL) + if (m_pobjRtcpCfgInfo != nullptr) delete m_pobjRtcpCfgInfo; m_pobjRtcpCfgInfo = pobjRtcpConfigInfo; @@ -1243,9 +1243,9 @@ eRTP_STATUS_CODE RtpSession::setPayload( { // set RTP payload information - if (pstPayloadInfo != RTP_NULL) + if (pstPayloadInfo != nullptr) { - if (m_pobjPayloadInfo == RTP_NULL) + if (m_pobjPayloadInfo == nullptr) { RTP_TRACE_ERROR("setPayload, m_pobjPayloadInfo is NULL.", RTP_ZERO, RTP_ZERO); return RTP_INVALID_PARAMS; @@ -1279,17 +1279,17 @@ eRTP_STATUS_CODE RtpSession::setRTCPTimerValue(IN RtpDt_UInt16 usRTCPTimerVal) eRTP_STATUS_CODE RtpSession::deleteRtpSession() { - RtpDt_Void* pvData = RTP_NULL; + RtpDt_Void* pvData = nullptr; std::lock_guard<std::mutex> guard(m_objRtpSessionLock); RtpSessionManager* pobjActSesDb = RtpSessionManager::getInstance(); pobjActSesDb->removeRtpSession(this); - if (m_pTimerId != RTP_NULL) + if (m_pTimerId != nullptr) { m_pobjAppInterface->RtpStopTimer(m_pTimerId, &pvData); - m_pTimerId = RTP_NULL; + m_pTimerId = nullptr; } for (auto& pobjRcvrElm : *m_pobjRtpRcvrInfoList) @@ -1321,16 +1321,16 @@ eRTP_STATUS_CODE RtpSession::chkRcvdSsrcStatus( RtpReceiverInfo* RtpSession::checkSsrcCollisionOnRcv(IN RtpBuffer* pobjRtpAddr, IN RtpDt_UInt16 usPort, IN RtpDt_UInt32 uiRcvdSsrc, OUT eRTP_STATUS_CODE& eResult) { - if (m_pobjRtpRcvrInfoList == RTP_NULL) + if (m_pobjRtpRcvrInfoList == nullptr) { eResult = RTP_INVALID_PARAMS; - return RTP_NULL; + return nullptr; } for (auto& pobjRcvInfo : *m_pobjRtpRcvrInfoList) { RtpDt_UInt32 uiTmpSsrc = RTP_ZERO; - if (pobjRcvInfo == RTP_NULL) + if (pobjRcvInfo == nullptr) break; uiTmpSsrc = pobjRcvInfo->getSsrc(); @@ -1356,10 +1356,10 @@ RtpReceiverInfo* RtpSession::checkSsrcCollisionOnRcv(IN RtpBuffer* pobjRtpAddr, return pobjRcvInfo; } - if (pcDestAddr == RTP_NULL || pcRcvDestAddr == RTP_NULL) + if (pcDestAddr == nullptr || pcRcvDestAddr == nullptr) { eResult = RTP_INVALID_PARAMS; - return RTP_NULL; + return nullptr; } if (memcmp(pcDestAddr, pcRcvDestAddr, uiRcvDestAddrLen) != RTP_ZERO) @@ -1374,7 +1374,7 @@ RtpReceiverInfo* RtpSession::checkSsrcCollisionOnRcv(IN RtpBuffer* pobjRtpAddr, } eResult = RTP_NEW_SSRC_RCVD; - return RTP_NULL; + return nullptr; } // checkSsrcCollisionOnRcv eRtp_Bool RtpSession::findEntryInCsrcList( @@ -1394,7 +1394,7 @@ eRtp_Bool RtpSession::findEntryInRcvrList(IN RtpDt_UInt32 uiSsrc) { for (auto& pobjRcvInfo : *m_pobjRtpRcvrInfoList) { - if (pobjRcvInfo != RTP_NULL && pobjRcvInfo->getSsrc() == uiSsrc) + if (pobjRcvInfo != nullptr && pobjRcvInfo->getSsrc() == uiSsrc) { return eRTP_TRUE; } @@ -1417,9 +1417,9 @@ eRTP_STATUS_CODE RtpSession::processCsrcList( bRcvrStatus = findEntryInRcvrList(csrc); if (bRcvrStatus == eRTP_FALSE) { - RtpReceiverInfo* pobjRcvInfo = RTP_NULL; + RtpReceiverInfo* pobjRcvInfo = nullptr; pobjRcvInfo = new RtpReceiverInfo(); - if (pobjRcvInfo == RTP_NULL) + if (pobjRcvInfo == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); return RTP_MEMORY_FAIL; @@ -1448,7 +1448,7 @@ eRTP_STATUS_CODE RtpSession::processRcvdRtpPkt(IN RtpBuffer* pobjRtpAddr, IN Rtp std::lock_guard<std::mutex> guard(m_objRtpSessionLock); // validation - if ((pobjRTPPacket == RTP_NULL) || (pobjRtpPkt == RTP_NULL) || (pobjRtpAddr == RTP_NULL)) + if ((pobjRTPPacket == nullptr) || (pobjRtpPkt == nullptr) || (pobjRtpAddr == nullptr)) { RTP_TRACE_WARNING( "processRcvdRtpPkt, pobjRTPPacket || pobjRtpPkt is NULL.", RTP_ZERO, RTP_ZERO); @@ -1531,7 +1531,7 @@ eRTP_STATUS_CODE RtpSession::processRcvdRtpPkt(IN RtpBuffer* pobjRtpAddr, IN Rtp return eRcvdResult; } - if (eRcvdResult != RTP_NEW_SSRC_RCVD && pobjRcvInfo == RTP_NULL) + if (eRcvdResult != RTP_NEW_SSRC_RCVD && pobjRcvInfo == nullptr) { RTP_TRACE_WARNING( "processRcvdRtpPkt -eRcvdResult == RTP_INVALID_PARAMS. pobjRcvInfo is NULL)", @@ -1544,7 +1544,7 @@ eRTP_STATUS_CODE RtpSession::processRcvdRtpPkt(IN RtpBuffer* pobjRtpAddr, IN Rtp { // add entry into the list. pobjRcvInfo = new RtpReceiverInfo(); - if (pobjRcvInfo == RTP_NULL) + if (pobjRcvInfo == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); return RTP_MEMORY_FAIL; @@ -1598,7 +1598,7 @@ eRTP_STATUS_CODE RtpSession::processRcvdRtpPkt(IN RtpBuffer* pobjRtpAddr, IN Rtp // process CSRC list processCsrcList(pobjRtpHeader, ucCsrcCount); - if (pobjRcvInfo == RTP_NULL) + if (pobjRcvInfo == nullptr) return RTP_SUCCESS; // calculate interarrival jitter @@ -1725,11 +1725,11 @@ eRTP_STATUS_CODE RtpSession::createRtpPacket(IN RtpBuffer* pobjPayload, IN eRtp_ uiRtpLength += pobjXHdr->getLength(); RtpDt_UChar* pucRtpBuffer = new RtpDt_UChar[uiRtpLength]; - if (pucRtpBuffer == RTP_NULL) + if (pucRtpBuffer == nullptr) { RTP_TRACE_WARNING("createRtpPacket, error in allocating memory ", RTP_ZERO, RTP_ZERO); // set rtp payload as NULL in RtpPacket - objRtpPacket.setRtpPayload(RTP_NULL); + objRtpPacket.setRtpPayload(nullptr); return RTP_MEMORY_FAIL; } memset(pucRtpBuffer, RTP_ZERO, uiRtpLength); @@ -1750,7 +1750,7 @@ eRTP_STATUS_CODE RtpSession::createRtpPacket(IN RtpBuffer* pobjPayload, IN eRtp_ bPackRes = objRtpPacket.formPacket(pRtpPkt); // set pobjPayload to NULL in both success and failure case - objRtpPacket.setRtpPayload(RTP_NULL); + objRtpPacket.setRtpPayload(nullptr); if (bPackRes != eRTP_TRUE) { @@ -1785,9 +1785,9 @@ RtpReceiverInfo* RtpSession::processRtcpPkt( { // add entry into the list. pobjRcvInfo = new RtpReceiverInfo(); - if (pobjRcvInfo == RTP_NULL) + if (pobjRcvInfo == nullptr) { - return RTP_NULL; + return nullptr; } // populate pobjRcvInfo object // ip address @@ -1803,7 +1803,7 @@ RtpReceiverInfo* RtpSession::processRtcpPkt( else if (eRcvdResult != RTP_INVALID_PARAMS) { // m_bSender should be FALSE for RTCP - /* if(pobjRcvInfo != NULL) + /* if(pobjRcvInfo != nullptr) { pobjRcvInfo->setSenderFlag(eRTP_FALSE); } @@ -1850,10 +1850,10 @@ eRTP_STATUS_CODE RtpSession::processByePacket( } else { - RtpDt_UInt32* puiSsrc = RTP_NULL; + RtpDt_UInt32* puiSsrc = nullptr; // get element from list puiSsrc = (*listIterator); - if (puiSsrc != RTP_NULL) + if (puiSsrc != nullptr) { delEntryFromRcvrList(puiSsrc); } @@ -1867,7 +1867,7 @@ eRTP_STATUS_CODE RtpSession::processByePacket( bByeResult = m_objTimerInfo.updateByePktInfo(usRcvrNum); if ((bByeResult == eRTP_TRUE) && (m_bEnableRTCP == eRTP_TRUE) && - (m_pobjAppInterface != RTP_NULL)) + (m_pobjAppInterface != nullptr)) { // Reschedule the next report for time tn RtpDt_UInt32 uiTempTn = m_objTimerInfo.getTn(); @@ -1900,13 +1900,13 @@ eRTP_STATUS_CODE RtpSession::processByePacket( } RTP_TRACE_MESSAGE("processByePacket [uiTimerVal : %u]", uiTimerVal, RTP_ZERO); - RtpDt_Void* pvData = RTP_NULL; + RtpDt_Void* pvData = nullptr; eRtp_Bool bTSres = eRTP_FALSE; - if (m_pTimerId != RTP_NULL) + if (m_pTimerId != nullptr) { bTSres = m_pobjAppInterface->RtpStopTimer(m_pTimerId, &pvData); - m_pTimerId = RTP_NULL; + m_pTimerId = nullptr; if (bTSres == eRTP_FALSE) { return RTP_TIMER_PROC_ERR; @@ -1914,7 +1914,7 @@ eRTP_STATUS_CODE RtpSession::processByePacket( } RtpDt_Void* pvSTRes = m_pobjAppInterface->RtpStartTimer(uiTimerVal, eRTP_FALSE, m_pfnTimerCb, this); - if (pvSTRes == RTP_NULL) + if (pvSTRes == nullptr) { return RTP_TIMER_PROC_ERR; } @@ -1941,7 +1941,7 @@ eRTP_STATUS_CODE RtpSession::processRcvdRtcpPkt(IN RtpBuffer* pobjRtcpAddr, IN R } // validity checking - if (pobjRtcpAddr == RTP_NULL || pobjRTCPBuf == RTP_NULL || pobjRtcpPkt == RTP_NULL) + if (pobjRtcpAddr == nullptr || pobjRTCPBuf == nullptr || pobjRtcpPkt == nullptr) { RTP_TRACE_ERROR("[ProcessRcvdRtcpPkt] Invalid params. pobjRtcpAddr[%x] pobjRTCPBuf[%x]", pobjRtcpAddr, pobjRTCPBuf); @@ -1983,7 +1983,7 @@ eRTP_STATUS_CODE RtpSession::processRcvdRtcpPkt(IN RtpBuffer* pobjRtcpAddr, IN R if (pobjReportBlkList.size() > RTP_ZERO) { RtcpReportBlock* pobjReportBlk = pobjReportBlkList.front(); - if (pobjReportBlk != RTP_NULL) + if (pobjReportBlk != nullptr) { calculateAndSetRTTD( currentTime, pobjReportBlk->getLastSR(), pobjReportBlk->getDelayLastSR()); @@ -1992,7 +1992,7 @@ eRTP_STATUS_CODE RtpSession::processRcvdRtcpPkt(IN RtpBuffer* pobjRtcpAddr, IN R // decrement rtcp port by one usPort = usPort - RTP_ONE; RtpReceiverInfo* pobjRcvInfo = processRtcpPkt(uiRcvdSsrc, pobjRtcpAddr, usPort); - if (pobjRcvInfo != RTP_NULL) + if (pobjRcvInfo != nullptr) { stNtpTs = {RTP_ZERO, RTP_ZERO}; pobjRcvInfo->setpreSrTimestamp(pobjSrPkt->getNtpTime()); @@ -2014,7 +2014,7 @@ eRTP_STATUS_CODE RtpSession::processRcvdRtcpPkt(IN RtpBuffer* pobjRtcpAddr, IN R if (pobjReportBlkList.size() > RTP_ZERO) { RtcpReportBlock* pobjReportBlk = pobjReportBlkList.front(); - if (pobjReportBlk != RTP_NULL) + if (pobjReportBlk != nullptr) { calculateAndSetRTTD( currentTime, pobjReportBlk->getLastSR(), pobjReportBlk->getDelayLastSR()); @@ -2031,7 +2031,7 @@ eRTP_STATUS_CODE RtpSession::processRcvdRtcpPkt(IN RtpBuffer* pobjRtcpAddr, IN R // RTCP SDES packet RtcpSdesPacket* pobjSdesPkt = pobjRtcpPkt->getSdesPacket(); - if (pobjSdesPkt != RTP_NULL) + if (pobjSdesPkt != nullptr) { // sdes processSdesPacket(pobjSdesPkt); @@ -2039,7 +2039,7 @@ eRTP_STATUS_CODE RtpSession::processRcvdRtcpPkt(IN RtpBuffer* pobjRtcpAddr, IN R // RTCP BYE packet RtcpByePacket* pobjByePkt = pobjRtcpPkt->getByePacket(); - if (pobjByePkt != RTP_NULL) + if (pobjByePkt != nullptr) { // bye processByePacket(pobjByePkt, pobjRtcpAddr, usPort); @@ -2155,7 +2155,7 @@ RtpDt_Double RtpSession::rtcp_interval(IN RtpDt_UInt16 usMembers) if (usMembers == RTP_ZERO) { - RTP_TRACE_MESSAGE("rtcp_interval usmebers is equal to 0", RTP_NULL, RTP_NULL); + RTP_TRACE_MESSAGE("rtcp_interval usmebers is equal to 0", nullptr, nullptr); ulTimerVal = dDefTimerVal; return ulTimerVal; } @@ -2230,7 +2230,7 @@ RtpDt_Double RtpSession::rtcp_interval(IN RtpDt_UInt16 usMembers) if (ulTimerVal < 0) { ulTimerVal = RTP_INIT_TRUE_T_MIN; - RTP_TRACE_MESSAGE("Generated a negative timer value. using Default", RTP_NULL, RTP_NULL); + RTP_TRACE_MESSAGE("Generated a negative timer value. using Default", nullptr, nullptr); } return ulTimerVal; } // rtcp_interval @@ -2241,7 +2241,7 @@ RtpDt_UInt32 RtpSession::getSenderCount() for (auto& pobjRcvrElm : *m_pobjRtpRcvrInfoList) { // get key material element from list. - if (pobjRcvrElm != RTP_NULL && pobjRcvrElm->isSender() == eRTP_TRUE && + if (pobjRcvrElm != nullptr && pobjRcvrElm->isSender() == eRTP_TRUE && pobjRcvrElm->getTotalRcvdRtpPkts() != 0) { uiSenderCnt = uiSenderCnt + RTP_ONE; @@ -2261,20 +2261,20 @@ RtpDt_Void RtpSession::calculateAndSetRTTD( { m_lastRTTDelay = (currentTime - lsr - dlsr); } - RTP_TRACE_MESSAGE("calculateAndSetRTTD = %d", m_lastRTTDelay, RTP_NULL); + RTP_TRACE_MESSAGE("calculateAndSetRTTD = %d", m_lastRTTDelay, nullptr); } eRTP_STATUS_CODE RtpSession::populateRtcpXrPacket(IN_OUT RtcpPacket* pobjRtcpPkt) { // create RtcpXrPacket RtcpXrPacket* pobjRtcpXrPacket = new RtcpXrPacket(); - if (pobjRtcpXrPacket == RTP_NULL) + if (pobjRtcpXrPacket == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); return RTP_FAILURE; } // set extended report block data RtpBuffer* pobjPayload = new RtpBuffer(m_stRtcpXr.nlength, m_stRtcpXr.m_pBlockBuffer); - if (pobjPayload == RTP_NULL) + if (pobjPayload == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); delete pobjRtcpXrPacket; @@ -2304,7 +2304,7 @@ eRTP_STATUS_CODE RtpSession::sendRtcpXrPacket( { // set timestamp m_stRtcpXr.m_pBlockBuffer = new RtpDt_UChar[nblockLength]; - if (m_stRtcpXr.m_pBlockBuffer == RTP_NULL) + if (m_stRtcpXr.m_pBlockBuffer == nullptr) { RTP_TRACE_ERROR("[Memory Error] new returned NULL.", RTP_ZERO, RTP_ZERO); return RTP_FAILURE; diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtpSessionManager.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtpSessionManager.cpp index 4b3fb383..920c5daa 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtpSessionManager.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtpSessionManager.cpp @@ -16,7 +16,7 @@ #include <RtpSessionManager.h> -RtpSessionManager* RtpSessionManager::m_pInstance = RTP_NULL; +RtpSessionManager* RtpSessionManager::m_pInstance = nullptr; RtpSessionManager::RtpSessionManager() : m_objActiveSessionList(std::list<RtpDt_Void*>()) @@ -27,7 +27,7 @@ RtpSessionManager::~RtpSessionManager() {} RtpSessionManager* RtpSessionManager::getInstance() { - if (m_pInstance == RTP_NULL) + if (m_pInstance == nullptr) { m_pInstance = new RtpSessionManager(); } @@ -50,7 +50,7 @@ eRtp_Bool RtpSessionManager::isValidRtpSession(IN RtpDt_Void* pvData) { for (const auto& pobjActiveSession : m_objActiveSessionList) { - if (pobjActiveSession == RTP_NULL) + if (pobjActiveSession == nullptr) { return eRTP_FALSE; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtpStack.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtpStack.cpp index af620cbd..62564b6e 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtpStack.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtpStack.cpp @@ -20,14 +20,14 @@ RtpStack::RtpStack() : m_objRtpSessionList(std::list<RtpSession*>()), - m_pobjStackProfile(RTP_NULL) + m_pobjStackProfile(nullptr) { } RtpStack::~RtpStack() { // clear stack profile - if (m_pobjStackProfile != RTP_NULL) + if (m_pobjStackProfile != nullptr) { delete m_pobjStackProfile; } @@ -50,10 +50,10 @@ RtpSession* RtpStack::createRtpSession() RtpDt_UInt32 uiTermNum = m_pobjStackProfile->getTermNumber(); RtpSession* pobjRtpSession = new RtpSession(this); - if (pobjRtpSession == RTP_NULL) + if (pobjRtpSession == nullptr) { RTP_TRACE_WARNING("Memory allocation error.", RTP_ZERO, RTP_ZERO); - return RTP_NULL; + return nullptr; } // add session into m_objRtpSessionList @@ -82,7 +82,7 @@ eRtp_Bool RtpStack::isValidRtpSession(IN RtpSession* pobjSession) eRTP_STATUS_CODE RtpStack::deleteRtpSession(IN RtpSession* pobjRtpSession) { - if (pobjRtpSession == RTP_NULL) + if (pobjRtpSession == nullptr) { RTP_TRACE_WARNING("deleteRtpSession, pobjRtpSession is NULL.", RTP_ZERO, RTP_ZERO); return RTP_INVALID_PARAMS; diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtpStackUtil.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtpStackUtil.cpp index 6d71050a..aaf09015 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtpStackUtil.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/core/RtpStackUtil.cpp @@ -22,7 +22,7 @@ RtpStackUtil::~RtpStackUtil() {} RtpDt_UInt16 RtpStackUtil::getSequenceNumber(IN RtpDt_UChar* pucRtpHdrBuf) { - if (pucRtpHdrBuf == RTP_NULL) + if (pucRtpHdrBuf == nullptr) { return RTP_ZERO; } @@ -38,7 +38,7 @@ RtpDt_UInt16 RtpStackUtil::getSequenceNumber(IN RtpDt_UChar* pucRtpHdrBuf) RtpDt_UInt32 RtpStackUtil::getRtpSsrc(IN RtpDt_UChar* pucRtpBuf) { - if (pucRtpBuf == RTP_NULL) + if (pucRtpBuf == nullptr) { return RTP_ZERO; } @@ -52,7 +52,7 @@ RtpDt_UInt32 RtpStackUtil::getRtpSsrc(IN RtpDt_UChar* pucRtpBuf) RtpDt_UInt32 RtpStackUtil::getRtcpSsrc(IN RtpDt_UChar* pucRtcpBuf) { - if (pucRtcpBuf == RTP_NULL) + if (pucRtcpBuf == nullptr) { return RTP_ZERO; } @@ -76,7 +76,7 @@ RtpDt_UInt32 RtpStackUtil::generateNewSsrc(IN RtpDt_UInt32 uiTermNum) RtpDt_UInt32 RtpStackUtil::getMidFourOctets(IN tRTP_NTP_TIME* pstNtpTs) { - if (pstNtpTs == RTP_NULL) + if (pstNtpTs == nullptr) { return RTP_ZERO; } @@ -93,7 +93,7 @@ RtpDt_UInt32 RtpStackUtil::calcRtpTimestamp(IN RtpDt_UInt32 uiPrevRtpTs, IN tRTP_NTP_TIME* pstCurNtpTs, IN tRTP_NTP_TIME* pstPrevNtpTs, IN RtpDt_UInt32 uiSamplingRate) { - if (pstCurNtpTs == RTP_NULL || pstPrevNtpTs == RTP_NULL) + if (pstCurNtpTs == nullptr || pstPrevNtpTs == nullptr) { return RTP_ZERO; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/utils/RtpBuffer.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/utils/RtpBuffer.cpp index 76e4730f..bcb36528 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/utils/RtpBuffer.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/utils/RtpBuffer.cpp @@ -19,21 +19,21 @@ RtpBuffer::RtpBuffer() : m_uiLength(RTP_ZERO), - m_pBuffer(RTP_NULL) + m_pBuffer(nullptr) { } RtpBuffer::RtpBuffer(IN RtpDt_UInt32 uiLength, IN RtpDt_UChar* pBuffer) { m_uiLength = 0; - m_pBuffer = RTP_NULL; + m_pBuffer = nullptr; if (uiLength > RTP_ZERO) { m_uiLength = uiLength; m_pBuffer = new RtpDt_UChar[m_uiLength]; - if (pBuffer != RTP_NULL) + if (pBuffer != nullptr) { memcpy(m_pBuffer, pBuffer, m_uiLength); } @@ -46,7 +46,7 @@ RtpBuffer::RtpBuffer(IN RtpDt_UInt32 uiLength, IN RtpDt_UChar* pBuffer) RtpBuffer::~RtpBuffer() { - if (m_pBuffer != RTP_NULL) + if (m_pBuffer != nullptr) { delete[] m_pBuffer; } diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/utils/RtpOsUtil.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/utils/RtpOsUtil.cpp index 8a34732b..8c9f8cb1 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/utils/RtpOsUtil.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/protocol/rtp/utils/RtpOsUtil.cpp @@ -27,7 +27,7 @@ RtpDt_Void RtpOsUtil::GetNtpTime(tRTP_NTP_TIME& pstNtpTime) { struct timeval stAndrodTp; - if (gettimeofday(&stAndrodTp, RTP_NULL) != -1) + if (gettimeofday(&stAndrodTp, nullptr) != -1) { // To convert a UNIX timestamp (seconds since 1970) to NTP time, add 2,208,988,800 seconds pstNtpTime.m_uiNtpHigh32Bits = stAndrodTp.tv_sec + 2208988800UL; @@ -38,7 +38,7 @@ RtpDt_Void RtpOsUtil::GetNtpTime(tRTP_NTP_TIME& pstNtpTime) RtpDt_Void RtpOsUtil::Srand() { struct timeval stSysTime; - gettimeofday(&stSysTime, RTP_NULL); + gettimeofday(&stSysTime, nullptr); RtpDt_UInt32 uiSeed = stSysTime.tv_usec * 1000; srand(uiSeed); } |