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

Unified Diff: webrtc/modules/audio_processing/ns/ns_core.c

Issue 2274083002: Replace calls to assert() with RTC_DCHECK_*() in .c code (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 4 years, 4 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/ns/ns_core.c
diff --git a/webrtc/modules/audio_processing/ns/ns_core.c b/webrtc/modules/audio_processing/ns/ns_core.c
index 5ce64cee29eba0c2f8e65de989424afe2426e5f3..76589c5fe9172ad2b7ff9787f707e5db7b8e7b53 100644
--- a/webrtc/modules/audio_processing/ns/ns_core.c
+++ b/webrtc/modules/audio_processing/ns/ns_core.c
@@ -8,11 +8,11 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include <assert.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
+#include "webrtc/base/checks.h"
#include "webrtc/common_audio/fft4g.h"
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
#include "webrtc/modules/audio_processing/ns/noise_suppression.h"
@@ -857,7 +857,7 @@ static void UpdateBuffer(const float* frame,
size_t frame_length,
size_t buffer_length,
float* buffer) {
- assert(buffer_length < 2 * frame_length);
+ RTC_DCHECK_LT(buffer_length, 2 * frame_length);
memcpy(buffer,
buffer + frame_length,
@@ -893,7 +893,7 @@ static void FFT(NoiseSuppressionC* self,
float* magn) {
size_t i;
- assert(magnitude_length == time_data_length / 2 + 1);
+ RTC_DCHECK_EQ(magnitude_length, time_data_length / 2 + 1);
WebRtc_rdft(time_data_length, 1, time_data, self->ip, self->wfft);
@@ -929,7 +929,7 @@ static void IFFT(NoiseSuppressionC* self,
float* time_data) {
size_t i;
- assert(time_data_length == 2 * (magnitude_length - 1));
+ RTC_DCHECK_EQ(time_data_length, 2 * (magnitude_length - 1));
time_data[0] = real[0];
time_data[1] = real[magnitude_length - 1];
@@ -1062,7 +1062,7 @@ void WebRtcNs_AnalyzeCore(NoiseSuppressionC* self, const float* speechFrame) {
float parametric_num = 0.0;
// Check that initiation has been done.
- assert(self->initFlag == 1);
+ RTC_DCHECK_EQ(1, self->initFlag);
updateParsFlag = self->modelUpdatePars[0];
// Update analysis buffer for L band.
@@ -1206,8 +1206,8 @@ void WebRtcNs_ProcessCore(NoiseSuppressionC* self,
float sumMagnAnalyze, sumMagnProcess;
// Check that initiation has been done.
- assert(self->initFlag == 1);
- assert((num_bands - 1) <= NUM_HIGH_BANDS_MAX);
+ RTC_DCHECK_EQ(1, self->initFlag);
+ RTC_DCHECK_LE(num_bands - 1, NUM_HIGH_BANDS_MAX);
const float* const* speechFrameHB = NULL;
float* const* outFrameHB = NULL;

Powered by Google App Engine
This is Rietveld 408576698