webrtc/modules/audio_processing: Use RTC_DCHECK() instead of assert()

Review-Url: https://codereview.webrtc.org/2320053003
Cr-Commit-Position: refs/heads/master@{#14211}
diff --git a/webrtc/modules/audio_processing/aec/aec_core.cc b/webrtc/modules/audio_processing/aec/aec_core.cc
index acdd8a9..910e21c 100644
--- a/webrtc/modules/audio_processing/aec/aec_core.cc
+++ b/webrtc/modules/audio_processing/aec/aec_core.cc
@@ -15,7 +15,6 @@
 #include "webrtc/modules/audio_processing/aec/aec_core.h"
 
 #include <algorithm>
-#include <assert.h>
 #include <math.h>
 #include <stddef.h>  // size_t
 #include <stdlib.h>
@@ -870,7 +869,7 @@
 static int SignalBasedDelayCorrection(AecCore* self) {
   int delay_correction = 0;
   int last_delay = -2;
-  assert(self != NULL);
+  RTC_DCHECK(self);
 #if !defined(WEBRTC_ANDROID)
   // On desktops, turn on correction after |kDelayCorrectionStart| frames.  This
   // is to let the delay estimation get a chance to converge.  Also, if the
@@ -1846,7 +1845,7 @@
   // Note that the two algorithms operate independently.  Currently, we only
   // allow one algorithm to be turned on.
 
-  assert(aec->num_bands == num_bands);
+  RTC_DCHECK_EQ(aec->num_bands, num_bands);
 
   for (size_t j = 0; j < num_samples; j += FRAME_LEN) {
     // 1) At most we process |aec->mult|+1 partitions in 10 ms. Make sure we
@@ -1949,9 +1948,9 @@
                                   int* median,
                                   int* std,
                                   float* fraction_poor_delays) {
-  assert(self != NULL);
-  assert(median != NULL);
-  assert(std != NULL);
+  RTC_DCHECK(self);
+  RTC_DCHECK(median);
+  RTC_DCHECK(std);
 
   if (self->delay_logging_enabled == 0) {
     // Logging disabled.
@@ -1978,9 +1977,9 @@
                             Stats* erle,
                             Stats* a_nlp,
                             float* divergent_filter_fraction) {
-  assert(erl != NULL);
-  assert(erle != NULL);
-  assert(a_nlp != NULL);
+  RTC_DCHECK(erl);
+  RTC_DCHECK(erle);
+  RTC_DCHECK(a_nlp);
   *erl = self->erl;
   *erle = self->erle;
   *a_nlp = self->aNlp;
@@ -1992,7 +1991,8 @@
                              int nlp_mode,
                              int metrics_mode,
                              int delay_logging) {
-  assert(nlp_mode >= 0 && nlp_mode < 3);
+  RTC_DCHECK_GE(nlp_mode, 0);
+  RTC_DCHECK_LT(nlp_mode, 3);
   self->nlp_mode = nlp_mode;
   self->metricsMode = metrics_mode;
   if (self->metricsMode) {
@@ -2019,7 +2019,7 @@
 }
 
 int WebRtcAec_aec3_enabled(AecCore* self) {
-  assert(self->aec3_enabled == 0 || self->aec3_enabled == 1);
+  RTC_DCHECK(self->aec3_enabled == 0 || self->aec3_enabled == 1);
   return self->aec3_enabled;
 }
 
@@ -2051,7 +2051,7 @@
 }
 
 void WebRtcAec_SetSystemDelay(AecCore* self, int delay) {
-  assert(delay >= 0);
+  RTC_DCHECK_GE(delay, 0);
   self->system_delay = delay;
 }
 }  // namespace webrtc
diff --git a/webrtc/modules/audio_processing/aec/aec_resampler.cc b/webrtc/modules/audio_processing/aec/aec_resampler.cc
index cc9046b..2fde934 100644
--- a/webrtc/modules/audio_processing/aec/aec_resampler.cc
+++ b/webrtc/modules/audio_processing/aec/aec_resampler.cc
@@ -14,11 +14,11 @@
 
 #include "webrtc/modules/audio_processing/aec/aec_resampler.h"
 
-#include <assert.h>
 #include <math.h>
 #include <stdlib.h>
 #include <string.h>
 
+#include "webrtc/base/checks.h"
 #include "webrtc/modules/audio_processing/aec/aec_core.h"
 
 namespace webrtc {
@@ -74,11 +74,11 @@
   float be, tnew;
   size_t tn, mm;
 
-  assert(size <= 2 * FRAME_LEN);
-  assert(resampInst != NULL);
-  assert(inspeech != NULL);
-  assert(outspeech != NULL);
-  assert(size_out != NULL);
+  RTC_DCHECK_LE(size, 2u * FRAME_LEN);
+  RTC_DCHECK(resampInst);
+  RTC_DCHECK(inspeech);
+  RTC_DCHECK(outspeech);
+  RTC_DCHECK(size_out);
 
   // Add new frame data in lookahead
   memcpy(&obj->buffer[FRAME_LEN + kResamplingDelay], inspeech,
@@ -163,7 +163,7 @@
   if (n == 0) {
     return -1;
   }
-  assert(n > 0);
+  RTC_DCHECK_GT(n, 0);
   rawAvg /= n;
 
   for (i = 0; i < size; i++) {
@@ -172,7 +172,7 @@
       rawAbsDev += err >= 0 ? err : -err;
     }
   }
-  assert(n > 0);
+  RTC_DCHECK_GT(n, 0);
   rawAbsDev /= n;
   upperLimit = static_cast<int>(rawAvg + 5 * rawAbsDev + 1);  // +1 for ceiling.
   lowerLimit = static_cast<int>(rawAvg - 5 * rawAbsDev - 1);  // -1 for floor.
@@ -193,7 +193,7 @@
   if (n == 0) {
     return -1;
   }
-  assert(n > 0);
+  RTC_DCHECK_GT(n, 0);
   xAvg = x / n;
   denom = x2 - xAvg * x;
 
diff --git a/webrtc/modules/audio_processing/aecm/aecm_core.cc b/webrtc/modules/audio_processing/aecm/aecm_core.cc
index a17220d..97f91a2 100644
--- a/webrtc/modules/audio_processing/aecm/aecm_core.cc
+++ b/webrtc/modules/audio_processing/aecm/aecm_core.cc
@@ -10,7 +10,6 @@
 
 #include "webrtc/modules/audio_processing/aecm/aecm_core.h"
 
-#include <assert.h>
 #include <stddef.h>
 #include <stdlib.h>
 
@@ -24,6 +23,7 @@
 #include "webrtc/system_wrappers/include/cpu_features_wrapper.h"
 }
 
+#include "webrtc/base/checks.h"
 #include "webrtc/typedefs.h"
 
 #ifdef AEC_DEBUG
@@ -193,7 +193,7 @@
                                          int* far_q,
                                          int delay) {
   int buffer_position = 0;
-  assert(self != NULL);
+  RTC_DCHECK(self);
   buffer_position = self->far_history_pos - delay;
 
   // Check buffer position
diff --git a/webrtc/modules/audio_processing/aecm/aecm_core_c.cc b/webrtc/modules/audio_processing/aecm/aecm_core_c.cc
index 57f859f..d868d6a 100644
--- a/webrtc/modules/audio_processing/aecm/aecm_core_c.cc
+++ b/webrtc/modules/audio_processing/aecm/aecm_core_c.cc
@@ -10,7 +10,6 @@
 
 #include "webrtc/modules/audio_processing/aecm/aecm_core.h"
 
-#include <assert.h>
 #include <stddef.h>
 #include <stdlib.h>
 
@@ -23,6 +22,8 @@
 extern "C" {
 #include "webrtc/system_wrappers/include/cpu_features_wrapper.h"
 }
+
+#include "webrtc/base/checks.h"
 #include "webrtc/typedefs.h"
 
 // Square root of Hanning window in Q14.
@@ -483,7 +484,7 @@
     }
 
     zeros16 = WebRtcSpl_NormW16(aecm->nearFilt[i]);
-    assert(zeros16 >= 0);  // |zeros16| is a norm, hence non-negative.
+    RTC_DCHECK_GE(zeros16, 0);  // |zeros16| is a norm, hence non-negative.
     dfa_clean_q_domain_diff = aecm->dfaCleanQDomain - aecm->dfaCleanQDomainOld;
     if (zeros16 < dfa_clean_q_domain_diff && aecm->nearFilt[i]) {
       tmp16no1 = aecm->nearFilt[i] << zeros16;
@@ -562,7 +563,7 @@
     {
       avgHnl32 += (int32_t)hnl[i];
     }
-    assert(kMaxPrefBand - kMinPrefBand + 1 > 0);
+    RTC_DCHECK_GT(kMaxPrefBand - kMinPrefBand + 1, 0);
     avgHnl32 /= (kMaxPrefBand - kMinPrefBand + 1);
 
     for (i = kMaxPrefBand; i < PART_LEN1; i++)
@@ -652,8 +653,8 @@
   int16_t shiftFromNearToNoise = kNoiseEstQDomain - aecm->dfaCleanQDomain;
   int16_t minTrackShift;
 
-  assert(shiftFromNearToNoise >= 0);
-  assert(shiftFromNearToNoise < 16);
+  RTC_DCHECK_GE(shiftFromNearToNoise, 0);
+  RTC_DCHECK_LT(shiftFromNearToNoise, 16);
 
   if (aecm->noiseEstCtr < 100)
   {
diff --git a/webrtc/modules/audio_processing/aecm/aecm_core_mips.cc b/webrtc/modules/audio_processing/aecm/aecm_core_mips.cc
index e625a46..7d898f8 100644
--- a/webrtc/modules/audio_processing/aecm/aecm_core_mips.cc
+++ b/webrtc/modules/audio_processing/aecm/aecm_core_mips.cc
@@ -10,8 +10,7 @@
 
 #include "webrtc/modules/audio_processing/aecm/aecm_core.h"
 
-#include <assert.h>
-
+#include "webrtc/base/checks.h"
 #include "webrtc/modules/audio_processing/aecm/echo_control_mobile.h"
 #include "webrtc/modules/audio_processing/utility/delay_estimator_wrapper.h"
 
@@ -995,7 +994,7 @@
     }
 
     zeros16 = WebRtcSpl_NormW16(aecm->nearFilt[i]);
-    assert(zeros16 >= 0);  // |zeros16| is a norm, hence non-negative.
+    RTC_DCHECK_GE(zeros16, 0);  // |zeros16| is a norm, hence non-negative.
     dfa_clean_q_domain_diff = aecm->dfaCleanQDomain - aecm->dfaCleanQDomainOld;
     if (zeros16 < dfa_clean_q_domain_diff && aecm->nearFilt[i]) {
       tmp16no1 = aecm->nearFilt[i] << zeros16;
@@ -1119,7 +1118,7 @@
       avgHnl32 += (int32_t)hnl[i];
     }
 
-    assert(kMaxPrefBand - kMinPrefBand + 1 > 0);
+    RTC_DCHECK_GT(kMaxPrefBand - kMinPrefBand + 1, 0);
     avgHnl32 /= (kMaxPrefBand - kMinPrefBand + 1);
 
     for (i = kMaxPrefBand; i < PART_LEN1; i++) {
@@ -1271,8 +1270,8 @@
   int16_t shiftFromNearToNoise = kNoiseEstQDomain - aecm->dfaCleanQDomain;
   int16_t minTrackShift = 9;
 
-  assert(shiftFromNearToNoise >= 0);
-  assert(shiftFromNearToNoise < 16);
+  RTC_DCHECK_GE(shiftFromNearToNoise, 0);
+  RTC_DCHECK_LT(shiftFromNearToNoise, 16);
 
   if (aecm->noiseEstCtr < 100) {
     // Track the minimum more quickly initially.
diff --git a/webrtc/modules/audio_processing/aecm/aecm_core_neon.cc b/webrtc/modules/audio_processing/aecm/aecm_core_neon.cc
index 81c7667..bc368f2 100644
--- a/webrtc/modules/audio_processing/aecm/aecm_core_neon.cc
+++ b/webrtc/modules/audio_processing/aecm/aecm_core_neon.cc
@@ -11,8 +11,8 @@
 #include "webrtc/modules/audio_processing/aecm/aecm_core.h"
 
 #include <arm_neon.h>
-#include <assert.h>
 
+#include "webrtc/base/checks.h"
 #include "webrtc/common_audio/signal_processing/include/real_fft.h"
 
 // TODO(kma): Re-write the corresponding assembly file, the offset
@@ -104,9 +104,9 @@
 void WebRtcAecm_StoreAdaptiveChannelNeon(AecmCore* aecm,
                                          const uint16_t* far_spectrum,
                                          int32_t* echo_est) {
-  assert((uintptr_t)echo_est % 32 == 0);
-  assert((uintptr_t)(aecm->channelStored) % 16 == 0);
-  assert((uintptr_t)(aecm->channelAdapt16) % 16 == 0);
+  RTC_DCHECK_EQ(0u, (uintptr_t)echo_est % 32);
+  RTC_DCHECK_EQ(0u, (uintptr_t)aecm->channelStored % 16);
+  RTC_DCHECK_EQ(0u, (uintptr_t)aecm->channelAdapt16 % 16);
 
   // This is C code of following optimized code.
   // During startup we store the channel every block.
@@ -161,9 +161,9 @@
 }
 
 void WebRtcAecm_ResetAdaptiveChannelNeon(AecmCore* aecm) {
-  assert((uintptr_t)(aecm->channelStored) % 16 == 0);
-  assert((uintptr_t)(aecm->channelAdapt16) % 16 == 0);
-  assert((uintptr_t)(aecm->channelAdapt32) % 32 == 0);
+  RTC_DCHECK_EQ(0u, (uintptr_t)aecm->channelStored % 16);
+  RTC_DCHECK_EQ(0u, (uintptr_t)aecm->channelAdapt16 % 16);
+  RTC_DCHECK_EQ(0u, (uintptr_t)aecm->channelAdapt32 % 32);
 
   // The C code of following optimized code.
   // for (i = 0; i < PART_LEN1; i++) {
diff --git a/webrtc/modules/audio_processing/agc/agc.cc b/webrtc/modules/audio_processing/agc/agc.cc
index 2bff735..a6256cb 100644
--- a/webrtc/modules/audio_processing/agc/agc.cc
+++ b/webrtc/modules/audio_processing/agc/agc.cc
@@ -39,7 +39,7 @@
 Agc::~Agc() {}
 
 float Agc::AnalyzePreproc(const int16_t* audio, size_t length) {
-  assert(length > 0);
+  RTC_DCHECK_GT(length, 0u);
   size_t num_clipped = 0;
   for (size_t i = 0; i < length; ++i) {
     if (audio[i] == 32767 || audio[i] == -32768)
@@ -62,7 +62,7 @@
 
 bool Agc::GetRmsErrorDb(int* error) {
   if (!error) {
-    assert(false);
+    RTC_NOTREACHED();
     return false;
   }
 
diff --git a/webrtc/modules/audio_processing/agc/agc_manager_direct.cc b/webrtc/modules/audio_processing/agc/agc_manager_direct.cc
index e56984a..92715dc 100644
--- a/webrtc/modules/audio_processing/agc/agc_manager_direct.cc
+++ b/webrtc/modules/audio_processing/agc/agc_manager_direct.cc
@@ -10,13 +10,13 @@
 
 #include "webrtc/modules/audio_processing/agc/agc_manager_direct.h"
 
-#include <cassert>
 #include <cmath>
 
 #ifdef WEBRTC_AGC_DEBUG_DUMP
 #include <cstdio>
 #endif
 
+#include "webrtc/base/checks.h"
 #include "webrtc/modules/audio_processing/agc/gain_map_internal.h"
 #include "webrtc/modules/audio_processing/gain_control_impl.h"
 #include "webrtc/modules/include/module_common_types.h"
@@ -61,7 +61,8 @@
 }
 
 int LevelFromGainError(int gain_error, int level) {
-  assert(level >= 0 && level <= kMaxMicLevel);
+  RTC_DCHECK_GE(level, 0);
+  RTC_DCHECK_LE(level, kMaxMicLevel);
   if (gain_error == 0) {
     return level;
   }
@@ -90,7 +91,7 @@
  public:
   explicit DebugFile(const char* filename)
       : file_(fopen(filename, "wb")) {
-    assert(file_);
+    RTC_DCHECK(file_);
   }
   ~DebugFile() {
     fclose(file_);
@@ -245,7 +246,7 @@
 
   if (agc_->Process(audio, length, sample_rate_hz) != 0) {
     LOG(LS_ERROR) << "Agc::Process failed";
-    assert(false);
+    RTC_NOTREACHED();
   }
 
   UpdateGain();
@@ -297,7 +298,7 @@
 }
 
 void AgcManagerDirect::SetMaxLevel(int level) {
-  assert(level >= kClippedLevelMin);
+  RTC_DCHECK_GE(level, kClippedLevelMin);
   max_level_ = level;
   // Scale the |kSurplusCompressionGain| linearly across the restricted
   // level range.
diff --git a/webrtc/modules/audio_processing/agc/loudness_histogram.cc b/webrtc/modules/audio_processing/agc/loudness_histogram.cc
index 05b6b32..9112fbb 100644
--- a/webrtc/modules/audio_processing/agc/loudness_histogram.cc
+++ b/webrtc/modules/audio_processing/agc/loudness_histogram.cc
@@ -13,6 +13,7 @@
 #include <cmath>
 #include <cstring>
 
+#include "webrtc/base/checks.h"
 #include "webrtc/modules/include/module_common_types.h"
 
 namespace webrtc {
@@ -101,7 +102,7 @@
 
 // Doing nothing if buffer is not full, yet.
 void LoudnessHistogram::RemoveOldestEntryAndUpdate() {
-  assert(len_circular_buffer_ > 0);
+  RTC_DCHECK_GT(len_circular_buffer_, 0);
   // Do nothing if circular buffer is not full.
   if (!buffer_is_full_)
     return;
@@ -114,7 +115,7 @@
 void LoudnessHistogram::RemoveTransient() {
   // Don't expect to be here if high-activity region is longer than
   // |kTransientWidthThreshold| or there has not been any transient.
-  assert(len_high_activity_ <= kTransientWidthThreshold);
+  RTC_DCHECK_LE(len_high_activity_, kTransientWidthThreshold);
   int index =
       (buffer_index_ > 0) ? (buffer_index_ - 1) : len_circular_buffer_ - 1;
   while (len_high_activity_ > 0) {
diff --git a/webrtc/modules/audio_processing/audio_buffer.cc b/webrtc/modules/audio_processing/audio_buffer.cc
index 13ece67..f5b9016 100644
--- a/webrtc/modules/audio_processing/audio_buffer.cc
+++ b/webrtc/modules/audio_processing/audio_buffer.cc
@@ -10,6 +10,7 @@
 
 #include "webrtc/modules/audio_processing/audio_buffer.h"
 
+#include "webrtc/base/checks.h"
 #include "webrtc/common_audio/include/audio_util.h"
 #include "webrtc/common_audio/resampler/push_sinc_resampler.h"
 #include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
@@ -25,7 +26,7 @@
 
 int KeyboardChannelIndex(const StreamConfig& stream_config) {
   if (!stream_config.has_keyboard()) {
-    assert(false);
+    RTC_NOTREACHED();
     return 0;
   }
 
@@ -61,11 +62,12 @@
     activity_(AudioFrame::kVadUnknown),
     keyboard_data_(NULL),
     data_(new IFChannelBuffer(proc_num_frames_, num_proc_channels_)) {
-  assert(input_num_frames_ > 0);
-  assert(proc_num_frames_ > 0);
-  assert(output_num_frames_ > 0);
-  assert(num_input_channels_ > 0);
-  assert(num_proc_channels_ > 0 && num_proc_channels_ <= num_input_channels_);
+  RTC_DCHECK_GT(input_num_frames_, 0u);
+  RTC_DCHECK_GT(proc_num_frames_, 0u);
+  RTC_DCHECK_GT(output_num_frames_, 0u);
+  RTC_DCHECK_GT(num_input_channels_, 0u);
+  RTC_DCHECK_GT(num_proc_channels_, 0u);
+  RTC_DCHECK_LE(num_proc_channels_, num_input_channels_);
 
   if (input_num_frames_ != proc_num_frames_ ||
       output_num_frames_ != proc_num_frames_) {
@@ -102,8 +104,8 @@
 
 void AudioBuffer::CopyFrom(const float* const* data,
                            const StreamConfig& stream_config) {
-  assert(stream_config.num_frames() == input_num_frames_);
-  assert(stream_config.num_channels() == num_input_channels_);
+  RTC_DCHECK_EQ(stream_config.num_frames(), input_num_frames_);
+  RTC_DCHECK_EQ(stream_config.num_channels(), num_input_channels_);
   InitForNewData();
   // Initialized lazily because there's a different condition in
   // DeinterleaveFrom.
@@ -147,8 +149,9 @@
 
 void AudioBuffer::CopyTo(const StreamConfig& stream_config,
                          float* const* data) {
-  assert(stream_config.num_frames() == output_num_frames_);
-  assert(stream_config.num_channels() == num_channels_ || num_channels_ == 1);
+  RTC_DCHECK_EQ(stream_config.num_frames(), output_num_frames_);
+  RTC_DCHECK(stream_config.num_channels() == num_channels_ ||
+             num_channels_ == 1);
 
   // Convert to the float range.
   float* const* data_ptr = data;
@@ -374,8 +377,8 @@
 
 // The resampler is only for supporting 48kHz to 16kHz in the reverse stream.
 void AudioBuffer::DeinterleaveFrom(AudioFrame* frame) {
-  assert(frame->num_channels_ == num_input_channels_);
-  assert(frame->samples_per_channel_ == input_num_frames_);
+  RTC_DCHECK_EQ(frame->num_channels_, num_input_channels_);
+  RTC_DCHECK_EQ(frame->samples_per_channel_, input_num_frames_);
   InitForNewData();
   // Initialized lazily because there's a different condition in CopyFrom.
   if ((input_num_frames_ != proc_num_frames_) && !input_buffer_) {
@@ -395,7 +398,7 @@
     DownmixInterleavedToMono(frame->data_, input_num_frames_,
                              num_input_channels_, deinterleaved[0]);
   } else {
-    assert(num_proc_channels_ == num_input_channels_);
+    RTC_DCHECK_EQ(num_proc_channels_, num_input_channels_);
     Deinterleave(frame->data_,
                  input_num_frames_,
                  num_proc_channels_,
@@ -419,8 +422,8 @@
     return;
   }
 
-  assert(frame->num_channels_ == num_channels_ || num_channels_ == 1);
-  assert(frame->samples_per_channel_ == output_num_frames_);
+  RTC_DCHECK(frame->num_channels_ == num_channels_ || num_channels_ == 1);
+  RTC_DCHECK_EQ(frame->samples_per_channel_, output_num_frames_);
 
   // Resample if necessary.
   IFChannelBuffer* data_ptr = data_.get();
diff --git a/webrtc/modules/audio_processing/audio_processing_impl.cc b/webrtc/modules/audio_processing/audio_processing_impl.cc
index 5478456..9b7b953 100644
--- a/webrtc/modules/audio_processing/audio_processing_impl.cc
+++ b/webrtc/modules/audio_processing/audio_processing_impl.cc
@@ -10,7 +10,6 @@
 
 #include "webrtc/modules/audio_processing/audio_processing_impl.h"
 
-#include <assert.h>
 #include <algorithm>
 
 #include "webrtc/base/checks.h"
@@ -84,7 +83,7 @@
       return true;
   }
 
-  assert(false);
+  RTC_NOTREACHED();
   return false;
 }
 
@@ -693,8 +692,8 @@
         MaybeInitializeCapture(processing_config, reinitialization_required));
   }
   rtc::CritScope cs_capture(&crit_capture_);
-  assert(processing_config.input_stream().num_frames() ==
-         formats_.api_format.input_stream().num_frames());
+  RTC_DCHECK_EQ(processing_config.input_stream().num_frames(),
+                formats_.api_format.input_stream().num_frames());
 
 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
   if (debug_dump_.debug_file->is_open()) {
@@ -1010,8 +1009,8 @@
   processing_config.reverse_output_stream() = reverse_output_config;
 
   RETURN_ON_ERR(MaybeInitializeRender(processing_config));
-  assert(reverse_input_config.num_frames() ==
-         formats_.api_format.reverse_input_stream().num_frames());
+  RTC_DCHECK_EQ(reverse_input_config.num_frames(),
+                formats_.api_format.reverse_input_stream().num_frames());
 
 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
   if (debug_dump_.debug_file->is_open()) {
diff --git a/webrtc/modules/audio_processing/audio_processing_unittest.cc b/webrtc/modules/audio_processing/audio_processing_unittest.cc
index 23705e7..646e8b7 100644
--- a/webrtc/modules/audio_processing/audio_processing_unittest.cc
+++ b/webrtc/modules/audio_processing/audio_processing_unittest.cc
@@ -17,6 +17,7 @@
 #include <queue>
 
 #include "webrtc/base/arraysize.h"
+#include "webrtc/base/checks.h"
 #include "webrtc/common_audio/include/audio_util.h"
 #include "webrtc/common_audio/resampler/include/push_resampler.h"
 #include "webrtc/common_audio/resampler/push_sinc_resampler.h"
@@ -92,7 +93,7 @@
     case AudioProcessing::kStereoAndKeyboard:
       return 3;
   }
-  assert(false);
+  RTC_NOTREACHED();
   return 0;
 }
 
@@ -265,7 +266,7 @@
   } else if (num_output_channels == 2) {
     ss << "stereo";
   } else {
-    assert(false);
+    RTC_NOTREACHED();
   }
   ss << output_rate / 1000;
   if (num_reverse_output_channels == 1) {
@@ -273,7 +274,7 @@
   } else if (num_reverse_output_channels == 2) {
     ss << "_rstereo";
   } else {
-    assert(false);
+    RTC_NOTREACHED();
   }
   ss << reverse_output_rate / 1000;
   ss << "_d" << file_direction << "_pcm";
@@ -311,7 +312,7 @@
   size_t read_count = fread(int_data, sizeof(int16_t), frame_size, file);
   if (read_count != frame_size) {
     // Check that the file really ended.
-    assert(feof(file));
+    RTC_DCHECK(feof(file));
     return false;  // This is expected.
   }
 
diff --git a/webrtc/modules/audio_processing/common.h b/webrtc/modules/audio_processing/common.h
index d4ddb92..184e2a5 100644
--- a/webrtc/modules/audio_processing/common.h
+++ b/webrtc/modules/audio_processing/common.h
@@ -11,8 +11,7 @@
 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_COMMON_H_
 #define WEBRTC_MODULES_AUDIO_PROCESSING_COMMON_H_
 
-#include <assert.h>
-
+#include "webrtc/base/checks.h"
 #include "webrtc/modules/audio_processing/include/audio_processing.h"
 
 namespace webrtc {
@@ -26,7 +25,7 @@
     case AudioProcessing::kStereoAndKeyboard:
       return 2;
   }
-  assert(false);
+  RTC_NOTREACHED();
   return 0;
 }
 
diff --git a/webrtc/modules/audio_processing/echo_cancellation_impl.cc b/webrtc/modules/audio_processing/echo_cancellation_impl.cc
index 2de4d13..65b4c36 100644
--- a/webrtc/modules/audio_processing/echo_cancellation_impl.cc
+++ b/webrtc/modules/audio_processing/echo_cancellation_impl.cc
@@ -10,9 +10,9 @@
 
 #include "webrtc/modules/audio_processing/echo_cancellation_impl.h"
 
-#include <assert.h>
 #include <string.h>
 
+#include "webrtc/base/checks.h"
 #include "webrtc/modules/audio_processing/aec/aec_core.h"
 #include "webrtc/modules/audio_processing/aec/echo_cancellation.h"
 #include "webrtc/modules/audio_processing/audio_buffer.h"
@@ -29,7 +29,7 @@
     case EchoCancellation::kHighSuppression:
       return kAecNlpAggressive;
   }
-  assert(false);
+  RTC_NOTREACHED();
   return -1;
 }
 
diff --git a/webrtc/modules/audio_processing/gain_control_impl.cc b/webrtc/modules/audio_processing/gain_control_impl.cc
index 6bb1d20..aa4316d 100644
--- a/webrtc/modules/audio_processing/gain_control_impl.cc
+++ b/webrtc/modules/audio_processing/gain_control_impl.cc
@@ -296,7 +296,7 @@
 int GainControlImpl::stream_analog_level() {
   rtc::CritScope cs(crit_capture_);
   // TODO(ajm): enable this assertion?
-  //assert(mode_ == kAdaptiveAnalog);
+  //RTC_DCHECK_EQ(kAdaptiveAnalog, mode_);
 
   return analog_capture_level_;
 }
@@ -482,7 +482,7 @@
   WebRtcAgcConfig config;
   // TODO(ajm): Flip the sign here (since AGC expects a positive value) if we
   //            change the interface.
-  //assert(target_level_dbfs_ <= 0);
+  //RTC_DCHECK_LE(target_level_dbfs_, 0);
   //config.targetLevelDbfs = static_cast<int16_t>(-target_level_dbfs_);
   config.targetLevelDbfs = static_cast<int16_t>(target_level_dbfs_);
   config.compressionGaindB =
diff --git a/webrtc/modules/audio_processing/rms_level.cc b/webrtc/modules/audio_processing/rms_level.cc
index 70c4422..957a7b5 100644
--- a/webrtc/modules/audio_processing/rms_level.cc
+++ b/webrtc/modules/audio_processing/rms_level.cc
@@ -10,9 +10,10 @@
 
 #include "webrtc/modules/audio_processing/rms_level.h"
 
-#include <assert.h>
 #include <math.h>
 
+#include "webrtc/base/checks.h"
+
 namespace webrtc {
 
 static const float kMaxSquaredLevel = 32768 * 32768;
@@ -49,7 +50,7 @@
   float rms = sum_square_ / (sample_count_ * kMaxSquaredLevel);
   // 20log_10(x^0.5) = 10log_10(x)
   rms = 10 * log10(rms);
-  assert(rms <= 0);
+  RTC_DCHECK_LE(rms, 0);
   if (rms < -kMinLevel)
     rms = -kMinLevel;
 
diff --git a/webrtc/modules/audio_processing/transient/transient_detector.cc b/webrtc/modules/audio_processing/transient/transient_detector.cc
index 12a50bd..987ff81 100644
--- a/webrtc/modules/audio_processing/transient/transient_detector.cc
+++ b/webrtc/modules/audio_processing/transient/transient_detector.cc
@@ -10,13 +10,13 @@
 
 #include "webrtc/modules/audio_processing/transient/transient_detector.h"
 
-#include <assert.h>
 #include <float.h>
 #include <math.h>
 #include <string.h>
 
 #include <algorithm>
 
+#include "webrtc/base/checks.h"
 #include "webrtc/modules/audio_processing/transient/common.h"
 #include "webrtc/modules/audio_processing/transient/daubechies_8_wavelet_coeffs.h"
 #include "webrtc/modules/audio_processing/transient/moving_moments.h"
@@ -36,10 +36,10 @@
       chunks_at_startup_left_to_delete_(kChunksAtStartupLeftToDelete),
       reference_energy_(1.f),
       using_reference_(false) {
-  assert(sample_rate_hz == ts::kSampleRate8kHz ||
-         sample_rate_hz == ts::kSampleRate16kHz ||
-         sample_rate_hz == ts::kSampleRate32kHz ||
-         sample_rate_hz == ts::kSampleRate48kHz);
+  RTC_DCHECK(sample_rate_hz == ts::kSampleRate8kHz ||
+             sample_rate_hz == ts::kSampleRate16kHz ||
+             sample_rate_hz == ts::kSampleRate32kHz ||
+             sample_rate_hz == ts::kSampleRate48kHz);
   int samples_per_transient = sample_rate_hz * kTransientLengthMs / 1000;
   // Adjustment to avoid data loss while downsampling, making
   // |samples_per_chunk_| and |samples_per_transient| always divisible by
@@ -72,7 +72,8 @@
                                 size_t data_length,
                                 const float* reference_data,
                                 size_t reference_length) {
-  assert(data && data_length == samples_per_chunk_);
+  RTC_DCHECK(data);
+  RTC_DCHECK_EQ(samples_per_chunk_, data_length);
 
   // TODO(aluebs): Check if these errors can logically happen and if not assert
   // on them.
@@ -160,7 +161,7 @@
     using_reference_ = false;
     return 1.f;
   }
-  assert(reference_energy_ != 0);
+  RTC_DCHECK_NE(0, reference_energy_);
   float result = 1.f / (1.f + exp(kReferenceNonLinearity *
                                   (kEnergyRatioThreshold -
                                    reference_energy / reference_energy_)));
diff --git a/webrtc/modules/audio_processing/transient/wpd_node.cc b/webrtc/modules/audio_processing/transient/wpd_node.cc
index ab476a0..a689827 100644
--- a/webrtc/modules/audio_processing/transient/wpd_node.cc
+++ b/webrtc/modules/audio_processing/transient/wpd_node.cc
@@ -10,10 +10,10 @@
 
 #include "webrtc/modules/audio_processing/transient/wpd_node.h"
 
-#include <assert.h>
 #include <math.h>
 #include <string.h>
 
+#include "webrtc/base/checks.h"
 #include "webrtc/common_audio/fir_filter.h"
 #include "webrtc/modules/audio_processing/transient/dyadic_decimator.h"
 
@@ -29,7 +29,9 @@
       filter_(FIRFilter::Create(coefficients,
                                 coefficients_length,
                                 2 * length + 1)) {
-  assert(length > 0 && coefficients && coefficients_length > 0);
+  RTC_DCHECK_GT(length, 0u);
+  RTC_DCHECK(coefficients);
+  RTC_DCHECK_GT(coefficients_length, 0u);
   memset(data_.get(), 0.f, (2 * length + 1) * sizeof(data_[0]));
 }
 
diff --git a/webrtc/modules/audio_processing/transient/wpd_tree.cc b/webrtc/modules/audio_processing/transient/wpd_tree.cc
index 28cbb04..fece686 100644
--- a/webrtc/modules/audio_processing/transient/wpd_tree.cc
+++ b/webrtc/modules/audio_processing/transient/wpd_tree.cc
@@ -10,10 +10,10 @@
 
 #include "webrtc/modules/audio_processing/transient/wpd_tree.h"
 
-#include <assert.h>
 #include <math.h>
 #include <string.h>
 
+#include "webrtc/base/checks.h"
 #include "webrtc/modules/audio_processing/transient/dyadic_decimator.h"
 #include "webrtc/modules/audio_processing/transient/wpd_node.h"
 
@@ -25,10 +25,10 @@
     : data_length_(data_length),
       levels_(levels),
       num_nodes_((1 << (levels + 1)) - 1) {
-  assert(data_length > (static_cast<size_t>(1) << levels) &&
-         high_pass_coefficients &&
-         low_pass_coefficients &&
-         levels > 0);
+  RTC_DCHECK_GT(data_length, (static_cast<size_t>(1) << levels));
+  RTC_DCHECK(high_pass_coefficients);
+  RTC_DCHECK(low_pass_coefficients);
+  RTC_DCHECK_GT(levels, 0);
   // Size is 1 more, so we can use the array as 1-based. nodes_[0] is never
   // allocated.
   nodes_.reset(new std::unique_ptr<WPDNode>[num_nodes_ + 1]);
diff --git a/webrtc/modules/audio_processing/utility/delay_estimator.cc b/webrtc/modules/audio_processing/utility/delay_estimator.cc
index 56bdde8..bc67ba1 100644
--- a/webrtc/modules/audio_processing/utility/delay_estimator.cc
+++ b/webrtc/modules/audio_processing/utility/delay_estimator.cc
@@ -10,11 +10,12 @@
 
 #include "webrtc/modules/audio_processing/utility/delay_estimator.h"
 
-#include <assert.h>
 #include <stdlib.h>
 #include <string.h>
 #include <algorithm>
 
+#include "webrtc/base/checks.h"
+
 // Number of right shifts for scaling is linearly depending on number of bits in
 // the far-end binary spectrum.
 static const int kShiftsAtZero = 13;  // Right shifts at zero binary spectrum.
@@ -99,7 +100,7 @@
       kMaxHitsWhenPossiblyNonCausal : kMaxHitsWhenPossiblyCausal;
   int i = 0;
 
-  assert(self->history_size == self->farend->history_size);
+  RTC_DCHECK_EQ(self->history_size, self->farend->history_size);
   // Reset |candidate_hits| if we have a new candidate.
   if (candidate_delay != self->last_candidate_delay) {
     self->candidate_hits = 0;
@@ -296,7 +297,7 @@
 
 int WebRtc_AllocateFarendBufferMemory(BinaryDelayEstimatorFarend* self,
                                       int history_size) {
-  assert(self != NULL);
+  RTC_DCHECK(self);
   // (Re-)Allocate memory for history buffers.
   self->binary_far_history = static_cast<uint32_t*>(
       realloc(self->binary_far_history,
@@ -323,7 +324,7 @@
 }
 
 void WebRtc_InitBinaryDelayEstimatorFarend(BinaryDelayEstimatorFarend* self) {
-  assert(self != NULL);
+  RTC_DCHECK(self);
   memset(self->binary_far_history, 0, sizeof(uint32_t) * self->history_size);
   memset(self->far_bit_counts, 0, sizeof(int) * self->history_size);
 }
@@ -336,9 +337,9 @@
   int src_index = 0;
   int padding_index = 0;
 
-  assert(self != NULL);
+  RTC_DCHECK(self);
   shift_size = self->history_size - abs_shift;
-  assert(shift_size > 0);
+  RTC_DCHECK_GT(shift_size, 0);
   if (delay_shift == 0) {
     return;
   } else if (delay_shift > 0) {
@@ -363,7 +364,7 @@
 
 void WebRtc_AddBinaryFarSpectrum(BinaryDelayEstimatorFarend* handle,
                                  uint32_t binary_far_spectrum) {
-  assert(handle != NULL);
+  RTC_DCHECK(handle);
   // Shift binary spectrum history and insert current |binary_far_spectrum|.
   memmove(&(handle->binary_far_history[1]), &(handle->binary_far_history[0]),
           (handle->history_size - 1) * sizeof(uint32_t));
@@ -481,7 +482,7 @@
 
 void WebRtc_InitBinaryDelayEstimator(BinaryDelayEstimator* self) {
   int i = 0;
-  assert(self != NULL);
+  RTC_DCHECK(self);
 
   memset(self->bit_counts, 0, sizeof(int32_t) * self->history_size);
   memset(self->binary_near_history,
@@ -506,7 +507,7 @@
 int WebRtc_SoftResetBinaryDelayEstimator(BinaryDelayEstimator* self,
                                          int delay_shift) {
   int lookahead = 0;
-  assert(self != NULL);
+  RTC_DCHECK(self);
   lookahead = self->lookahead;
   self->lookahead -= delay_shift;
   if (self->lookahead < 0) {
@@ -528,7 +529,7 @@
   int32_t value_worst_candidate = 0;
   int32_t valley_depth = 0;
 
-  assert(self != NULL);
+  RTC_DCHECK(self);
   if (self->farend->history_size != self->history_size) {
     // Non matching history sizes.
     return -1;
@@ -664,13 +665,13 @@
 }
 
 int WebRtc_binary_last_delay(BinaryDelayEstimator* self) {
-  assert(self != NULL);
+  RTC_DCHECK(self);
   return self->last_delay;
 }
 
 float WebRtc_binary_last_delay_quality(BinaryDelayEstimator* self) {
   float quality = 0;
-  assert(self != NULL);
+  RTC_DCHECK(self);
 
   if (self->robust_validation_enabled) {
     // Simply a linear function of the histogram height at delay estimate.
diff --git a/webrtc/modules/audio_processing/utility/delay_estimator_wrapper.cc b/webrtc/modules/audio_processing/utility/delay_estimator_wrapper.cc
index 75c7abe..2dd092c 100644
--- a/webrtc/modules/audio_processing/utility/delay_estimator_wrapper.cc
+++ b/webrtc/modules/audio_processing/utility/delay_estimator_wrapper.cc
@@ -10,10 +10,10 @@
 
 #include "webrtc/modules/audio_processing/utility/delay_estimator_wrapper.h"
 
-#include <assert.h>
 #include <stdlib.h>
 #include <string.h>
 
+#include "webrtc/base/checks.h"
 #include "webrtc/modules/audio_processing/utility/delay_estimator.h"
 #include "webrtc/modules/audio_processing/utility/delay_estimator_internal.h"
 
@@ -42,7 +42,7 @@
 static void MeanEstimatorFloat(float new_value,
                                float scale,
                                float* mean_value) {
-  assert(scale < 1.0f);
+  RTC_DCHECK_LT(scale, 1.0f);
   *mean_value += (new_value - *mean_value) * scale;
 }
 
@@ -64,7 +64,7 @@
   int i = kBandFirst;
   uint32_t out = 0;
 
-  assert(q_domain < 16);
+  RTC_DCHECK_LT(q_domain, 16);
 
   if (!(*threshold_initialized)) {
     // Set the |threshold_spectrum| to half the input |spectrum| as starting
@@ -194,7 +194,7 @@
 
 void WebRtc_SoftResetDelayEstimatorFarend(void* handle, int delay_shift) {
   DelayEstimatorFarend* self = (DelayEstimatorFarend*) handle;
-  assert(self != NULL);
+  RTC_DCHECK(self);
   WebRtc_SoftResetBinaryDelayEstimatorFarend(self->binary_farend, delay_shift);
 }
 
@@ -324,7 +324,7 @@
 
 int WebRtc_SoftResetDelayEstimator(void* handle, int delay_shift) {
   DelayEstimator* self = (DelayEstimator*) handle;
-  assert(self != NULL);
+  RTC_DCHECK(self);
   return WebRtc_SoftResetBinaryDelayEstimator(self->binary_handle, delay_shift);
 }
 
@@ -353,8 +353,8 @@
 
 int WebRtc_set_lookahead(void* handle, int lookahead) {
   DelayEstimator* self = (DelayEstimator*) handle;
-  assert(self != NULL);
-  assert(self->binary_handle != NULL);
+  RTC_DCHECK(self);
+  RTC_DCHECK(self->binary_handle);
   if ((lookahead > self->binary_handle->near_history_size - 1) ||
       (lookahead < 0)) {
     return -1;
@@ -365,8 +365,8 @@
 
 int WebRtc_lookahead(void* handle) {
   DelayEstimator* self = (DelayEstimator*) handle;
-  assert(self != NULL);
-  assert(self->binary_handle != NULL);
+  RTC_DCHECK(self);
+  RTC_DCHECK(self->binary_handle);
   return self->binary_handle->lookahead;
 }
 
@@ -398,7 +398,7 @@
   if ((enable < 0) || (enable > 1)) {
     return -1;
   }
-  assert(self->binary_handle != NULL);
+  RTC_DCHECK(self->binary_handle);
   self->binary_handle->robust_validation_enabled = enable;
   return 0;
 }
@@ -481,6 +481,6 @@
 
 float WebRtc_last_delay_quality(void* handle) {
   DelayEstimator* self = (DelayEstimator*) handle;
-  assert(self != NULL);
+  RTC_DCHECK(self);
   return WebRtc_binary_last_delay_quality(self->binary_handle);
 }
diff --git a/webrtc/modules/audio_processing/vad/pitch_based_vad.cc b/webrtc/modules/audio_processing/vad/pitch_based_vad.cc
index fce144d..6ef1e39 100644
--- a/webrtc/modules/audio_processing/vad/pitch_based_vad.cc
+++ b/webrtc/modules/audio_processing/vad/pitch_based_vad.cc
@@ -10,7 +10,6 @@
 
 #include "webrtc/modules/audio_processing/vad/pitch_based_vad.h"
 
-#include <assert.h>
 #include <math.h>
 #include <string.h>
 
diff --git a/webrtc/modules/audio_processing/vad/standalone_vad.cc b/webrtc/modules/audio_processing/vad/standalone_vad.cc
index 1209526..8636eb4 100644
--- a/webrtc/modules/audio_processing/vad/standalone_vad.cc
+++ b/webrtc/modules/audio_processing/vad/standalone_vad.cc
@@ -10,8 +10,7 @@
 
 #include "webrtc/modules/audio_processing/vad/standalone_vad.h"
 
-#include <assert.h>
-
+#include "webrtc/base/checks.h"
 #include "webrtc/modules/include/module_common_types.h"
 #include "webrtc/modules/utility/include/audio_frame_operations.h"
 #include "webrtc/typedefs.h"
@@ -64,7 +63,7 @@
   const size_t num_frames = index_ / kLength10Ms;
   if (num_frames > length_p)
     return -1;
-  assert(WebRtcVad_ValidRateAndFrameLength(kSampleRateHz, index_) == 0);
+  RTC_DCHECK_EQ(0, WebRtcVad_ValidRateAndFrameLength(kSampleRateHz, index_));
 
   int activity = WebRtcVad_Process(vad_, kSampleRateHz, buffer_, index_);
   if (activity < 0)
diff --git a/webrtc/modules/audio_processing/vad/vad_audio_proc.cc b/webrtc/modules/audio_processing/vad/vad_audio_proc.cc
index 1a59559..af1214b 100644
--- a/webrtc/modules/audio_processing/vad/vad_audio_proc.cc
+++ b/webrtc/modules/audio_processing/vad/vad_audio_proc.cc
@@ -13,6 +13,7 @@
 #include <math.h>
 #include <stdio.h>
 
+#include "webrtc/base/checks.h"
 #include "webrtc/common_audio/fft4g.h"
 #include "webrtc/modules/audio_processing/vad/vad_audio_proc_internal.h"
 #include "webrtc/modules/audio_processing/vad/pitch_internal.h"
@@ -95,7 +96,7 @@
   if (num_buffer_samples_ < kBufferLength) {
     return 0;
   }
-  assert(num_buffer_samples_ == kBufferLength);
+  RTC_DCHECK_EQ(num_buffer_samples_, kBufferLength);
   features->num_frames = kNum10msSubframes;
   features->silence = false;
 
@@ -121,7 +122,7 @@
 void VadAudioProc::SubframeCorrelation(double* corr,
                                        size_t length_corr,
                                        size_t subframe_index) {
-  assert(length_corr >= kLpcOrder + 1);
+  RTC_DCHECK_GE(length_corr, kLpcOrder + 1);
   double windowed_audio[kNumSubframeSamples + kNumPastSignalSamples];
   size_t buffer_index = subframe_index * kNumSubframeSamples;
 
@@ -137,7 +138,7 @@
 // each 10ms sub-frame. This is equivalent to computing LPC coefficients for the
 // first half of each 10 ms subframe.
 void VadAudioProc::GetLpcPolynomials(double* lpc, size_t length_lpc) {
-  assert(length_lpc >= kNum10msSubframes * (kLpcOrder + 1));
+  RTC_DCHECK_GE(length_lpc, kNum10msSubframes * (kLpcOrder + 1));
   double corr[kLpcOrder + 1];
   double reflec_coeff[kLpcOrder];
   for (size_t i = 0, offset_lpc = 0; i < kNum10msSubframes;
@@ -165,7 +166,7 @@
 
   fractional_index =
       -(next_val - prev_val) * 0.5f / (next_val + prev_val - 2.f * curr_val);
-  assert(fabs(fractional_index) < 1);
+  RTC_DCHECK_LT(fabs(fractional_index), 1);
   return fractional_index;
 }
 
@@ -176,7 +177,7 @@
 // to save on one square root.
 void VadAudioProc::FindFirstSpectralPeaks(double* f_peak,
                                           size_t length_f_peak) {
-  assert(length_f_peak >= kNum10msSubframes);
+  RTC_DCHECK_GE(length_f_peak, kNum10msSubframes);
   double lpc[kNum10msSubframes * (kLpcOrder + 1)];
   // For all sub-frames.
   GetLpcPolynomials(lpc, kNum10msSubframes * (kLpcOrder + 1));
@@ -232,7 +233,7 @@
                                  size_t length) {
   // TODO(turajs): This can be "imported" from iSAC & and the next two
   // constants.
-  assert(length >= kNum10msSubframes);
+  RTC_DCHECK_GE(length, kNum10msSubframes);
   const int kNumPitchSubframes = 4;
   double gains[kNumPitchSubframes];
   double lags[kNumPitchSubframes];
@@ -262,7 +263,7 @@
 }
 
 void VadAudioProc::Rms(double* rms, size_t length_rms) {
-  assert(length_rms >= kNum10msSubframes);
+  RTC_DCHECK_GE(length_rms, kNum10msSubframes);
   size_t offset = kNumPastSignalSamples;
   for (size_t i = 0; i < kNum10msSubframes; i++) {
     rms[i] = 0;
diff --git a/webrtc/modules/audio_processing/vad/vad_audio_proc.h b/webrtc/modules/audio_processing/vad/vad_audio_proc.h
index a8ecc7b..1f27b29 100644
--- a/webrtc/modules/audio_processing/vad/vad_audio_proc.h
+++ b/webrtc/modules/audio_processing/vad/vad_audio_proc.h
@@ -50,25 +50,28 @@
   // For every 30 ms we compute 3 spectral peak there for 3 LPC analysis.
   // LPC is computed over 15 ms of windowed audio. For every 10 ms sub-frame
   // we need 5 ms of past signal to create the input of LPC analysis.
-  static const size_t kNumPastSignalSamples =
-      static_cast<size_t>(kSampleRateHz / 200);
+  enum : size_t {
+    kNumPastSignalSamples = static_cast<size_t>(kSampleRateHz / 200)
+  };
 
   // TODO(turajs): maybe defining this at a higher level (maybe enum) so that
   // all the code recognize it as "no-error."
-  static const int kNoError = 0;
+  enum : int { kNoError = 0 };
 
-  static const size_t kNum10msSubframes = 3;
-  static const size_t kNumSubframeSamples =
-      static_cast<size_t>(kSampleRateHz / 100);
-  static const size_t kNumSamplesToProcess =
-      kNum10msSubframes *
-      kNumSubframeSamples;  // Samples in 30 ms @ given sampling rate.
-  static const size_t kBufferLength =
-      kNumPastSignalSamples + kNumSamplesToProcess;
-  static const size_t kIpLength = kDftSize >> 1;
-  static const size_t kWLength = kDftSize >> 1;
-
-  static const size_t kLpcOrder = 16;
+  enum : size_t { kNum10msSubframes = 3 };
+  enum : size_t {
+    kNumSubframeSamples = static_cast<size_t>(kSampleRateHz / 100)
+  };
+  enum : size_t {
+    // Samples in 30 ms @ given sampling rate.
+    kNumSamplesToProcess = kNum10msSubframes * kNumSubframeSamples
+  };
+  enum : size_t {
+    kBufferLength = kNumPastSignalSamples + kNumSamplesToProcess
+  };
+  enum : size_t { kIpLength = kDftSize >> 1 };
+  enum : size_t { kWLength = kDftSize >> 1 };
+  enum : size_t { kLpcOrder = 16 };
 
   size_t ip_[kIpLength];
   float w_fft_[kWLength];
diff --git a/webrtc/modules/audio_processing/vad/vad_circular_buffer.cc b/webrtc/modules/audio_processing/vad/vad_circular_buffer.cc
index d337893..22d5dea 100644
--- a/webrtc/modules/audio_processing/vad/vad_circular_buffer.cc
+++ b/webrtc/modules/audio_processing/vad/vad_circular_buffer.cc
@@ -10,7 +10,6 @@
 
 #include "webrtc/modules/audio_processing/vad/vad_circular_buffer.h"
 
-#include <assert.h>
 #include <stdlib.h>
 
 namespace webrtc {
diff --git a/webrtc/modules/audio_processing/voice_detection_impl.cc b/webrtc/modules/audio_processing/voice_detection_impl.cc
index 5a0d37c..a0702e8 100644
--- a/webrtc/modules/audio_processing/voice_detection_impl.cc
+++ b/webrtc/modules/audio_processing/voice_detection_impl.cc
@@ -103,7 +103,7 @@
 bool VoiceDetectionImpl::stream_has_voice() const {
   rtc::CritScope cs(crit_);
   // TODO(ajm): enable this assertion?
-  //assert(using_external_vad_ || is_component_enabled());
+  //RTC_DCHECK(using_external_vad_ || is_component_enabled());
   return stream_has_voice_;
 }