Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(902)

Unified Diff: webrtc/modules/audio_processing/aecm/aecm_core.cc

Issue 2685783014: Replace NULL with nullptr in all C++ files. (Closed)
Patch Set: Fixing android. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_processing/aecm/aecm_core.cc
diff --git a/webrtc/modules/audio_processing/aecm/aecm_core.cc b/webrtc/modules/audio_processing/aecm/aecm_core.cc
index 97f91a22541d5fd4a9eafe8e013d12eb4bc8384b..70a0e9abeca87c42282acae144257aa16ec8d7c3 100644
--- a/webrtc/modules/audio_processing/aecm/aecm_core.cc
+++ b/webrtc/modules/audio_processing/aecm/aecm_core.cc
@@ -187,7 +187,7 @@ void WebRtcAecm_UpdateFarHistory(AecmCore* self,
//
// Return value:
// - far_spectrum : Pointer to the aligned far end spectrum
-// NULL - Error
+// null - Error
//
const uint16_t* WebRtcAecm_AlignedFarend(AecmCore* self,
int* far_q,
@@ -219,7 +219,7 @@ AecmCore* WebRtcAecm_CreateCore() {
if (!aecm->farFrameBuf)
{
WebRtcAecm_FreeCore(aecm);
- return NULL;
+ return nullptr;
}
aecm->nearNoisyFrameBuf = WebRtc_CreateBuffer(FRAME_LEN + PART_LEN,
@@ -227,7 +227,7 @@ AecmCore* WebRtcAecm_CreateCore() {
if (!aecm->nearNoisyFrameBuf)
{
WebRtcAecm_FreeCore(aecm);
- return NULL;
+ return nullptr;
}
aecm->nearCleanFrameBuf = WebRtc_CreateBuffer(FRAME_LEN + PART_LEN,
@@ -235,7 +235,7 @@ AecmCore* WebRtcAecm_CreateCore() {
if (!aecm->nearCleanFrameBuf)
{
WebRtcAecm_FreeCore(aecm);
- return NULL;
+ return nullptr;
}
aecm->outFrameBuf = WebRtc_CreateBuffer(FRAME_LEN + PART_LEN,
@@ -243,29 +243,29 @@ AecmCore* WebRtcAecm_CreateCore() {
if (!aecm->outFrameBuf)
{
WebRtcAecm_FreeCore(aecm);
- return NULL;
+ return nullptr;
}
aecm->delay_estimator_farend = WebRtc_CreateDelayEstimatorFarend(PART_LEN1,
MAX_DELAY);
- if (aecm->delay_estimator_farend == NULL) {
+ if (aecm->delay_estimator_farend == nullptr) {
WebRtcAecm_FreeCore(aecm);
- return NULL;
+ return nullptr;
}
aecm->delay_estimator =
WebRtc_CreateDelayEstimator(aecm->delay_estimator_farend, 0);
- if (aecm->delay_estimator == NULL) {
+ if (aecm->delay_estimator == nullptr) {
WebRtcAecm_FreeCore(aecm);
- return NULL;
+ return nullptr;
}
// TODO(bjornv): Explicitly disable robust delay validation until no
// performance regression has been established. Then remove the line.
WebRtc_enable_robust_validation(aecm->delay_estimator, 0);
aecm->real_fft = WebRtcSpl_CreateRealFFT(PART_LEN_SHIFT);
- if (aecm->real_fft == NULL) {
+ if (aecm->real_fft == nullptr) {
WebRtcAecm_FreeCore(aecm);
- return NULL;
+ return nullptr;
}
// Init some aecm pointers. 16 and 32 byte alignment is only necessary
@@ -532,8 +532,8 @@ int WebRtcAecm_Control(AecmCore* aecm, int delay, int nlpFlag) {
}
void WebRtcAecm_FreeCore(AecmCore* aecm) {
- if (aecm == NULL) {
- return;
+ if (aecm == nullptr) {
+ return;
}
WebRtc_FreeBuffer(aecm->farFrameBuf);
@@ -557,7 +557,7 @@ int WebRtcAecm_ProcessFrame(AecmCore* aecm,
int16_t* outBlock = (int16_t*) (((uintptr_t) outBlock_buf + 15) & ~ 15);
int16_t farFrame[FRAME_LEN];
- const int16_t* out_ptr = NULL;
+ const int16_t* out_ptr = nullptr;
int size = 0;
// Buffer the current frame.
@@ -569,18 +569,17 @@ int WebRtcAecm_ProcessFrame(AecmCore* aecm,
// to pass the smaller blocks individually.
WebRtc_WriteBuffer(aecm->farFrameBuf, farFrame, FRAME_LEN);
WebRtc_WriteBuffer(aecm->nearNoisyFrameBuf, nearendNoisy, FRAME_LEN);
- if (nearendClean != NULL)
- {
- WebRtc_WriteBuffer(aecm->nearCleanFrameBuf, nearendClean, FRAME_LEN);
+ if (nearendClean != nullptr) {
+ WebRtc_WriteBuffer(aecm->nearCleanFrameBuf, nearendClean, FRAME_LEN);
}
// Process as many blocks as possible.
while (WebRtc_available_read(aecm->farFrameBuf) >= PART_LEN)
{
int16_t far_block[PART_LEN];
- const int16_t* far_block_ptr = NULL;
+ const int16_t* far_block_ptr = nullptr;
int16_t near_noisy_block[PART_LEN];
- const int16_t* near_noisy_block_ptr = NULL;
+ const int16_t* near_noisy_block_ptr = nullptr;
WebRtc_ReadBuffer(aecm->farFrameBuf, (void**) &far_block_ptr, far_block,
PART_LEN);
@@ -588,32 +587,22 @@ int WebRtcAecm_ProcessFrame(AecmCore* aecm,
(void**) &near_noisy_block_ptr,
near_noisy_block,
PART_LEN);
- if (nearendClean != NULL)
- {
- int16_t near_clean_block[PART_LEN];
- const int16_t* near_clean_block_ptr = NULL;
-
- WebRtc_ReadBuffer(aecm->nearCleanFrameBuf,
- (void**) &near_clean_block_ptr,
- near_clean_block,
- PART_LEN);
- if (WebRtcAecm_ProcessBlock(aecm,
- far_block_ptr,
- near_noisy_block_ptr,
- near_clean_block_ptr,
- outBlock) == -1)
- {
- return -1;
- }
+ if (nearendClean != nullptr) {
+ int16_t near_clean_block[PART_LEN];
+ const int16_t* near_clean_block_ptr = nullptr;
+
+ WebRtc_ReadBuffer(aecm->nearCleanFrameBuf,
+ (void**)&near_clean_block_ptr, near_clean_block,
+ PART_LEN);
+ if (WebRtcAecm_ProcessBlock(aecm, far_block_ptr, near_noisy_block_ptr,
+ near_clean_block_ptr, outBlock) == -1) {
+ return -1;
+ }
} else
{
- if (WebRtcAecm_ProcessBlock(aecm,
- far_block_ptr,
- near_noisy_block_ptr,
- NULL,
- outBlock) == -1)
- {
- return -1;
+ if (WebRtcAecm_ProcessBlock(aecm, far_block_ptr, near_noisy_block_ptr,
+ nullptr, outBlock) == -1) {
+ return -1;
}
}

Powered by Google App Engine
This is Rietveld 408576698