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

Unified Diff: webrtc/modules/audio_processing/agc/agc_manager_direct.cc

Issue 2320053003: webrtc/modules/audio_processing: Use RTC_DCHECK() instead of assert() (Closed)
Patch Set: rebase Created 4 years, 3 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/agc/agc_manager_direct.cc
diff --git a/webrtc/modules/audio_processing/agc/agc_manager_direct.cc b/webrtc/modules/audio_processing/agc/agc_manager_direct.cc
index e56984a1b1029a0dd12d604457905353eb11824a..92715dc61e1693fa8a4422753824ea0c2bc688a7 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 ClampLevel(int mic_level) {
}
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 @@ class DebugFile {
public:
explicit DebugFile(const char* filename)
: file_(fopen(filename, "wb")) {
- assert(file_);
+ RTC_DCHECK(file_);
}
~DebugFile() {
fclose(file_);
@@ -245,7 +246,7 @@ void AgcManagerDirect::Process(const int16_t* audio,
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::SetLevel(int new_level) {
}
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.
« no previous file with comments | « webrtc/modules/audio_processing/agc/agc.cc ('k') | webrtc/modules/audio_processing/agc/loudness_histogram.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698