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

Unified Diff: webrtc/modules/audio_processing/agc/legacy/analog_agc.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/agc/legacy/analog_agc.c
diff --git a/webrtc/modules/audio_processing/agc/legacy/analog_agc.c b/webrtc/modules/audio_processing/agc/legacy/analog_agc.c
index 2450e05b768027918c2f90f453000041adbd8988..d2155648d63d2015eb72f90bf491791418045e64 100644
--- a/webrtc/modules/audio_processing/agc/legacy/analog_agc.c
+++ b/webrtc/modules/audio_processing/agc/legacy/analog_agc.c
@@ -19,12 +19,13 @@
#include "webrtc/modules/audio_processing/agc/legacy/analog_agc.h"
-#include <assert.h>
#include <stdlib.h>
#ifdef WEBRTC_AGC_DEBUG_DUMP
#include <stdio.h>
#endif
+#include "webrtc/base/checks.h"
+
/* The slope of in Q13*/
static const int16_t kSlope1[8] = {21793, 12517, 7189, 4129,
2372, 1362, 472, 78};
@@ -155,14 +156,14 @@ int WebRtcAgc_AddMic(void* state,
if (stt->micVol > stt->maxAnalog) {
/* |maxLevel| is strictly >= |micVol|, so this condition should be
* satisfied here, ensuring there is no divide-by-zero. */
- assert(stt->maxLevel > stt->maxAnalog);
+ RTC_DCHECK_GT(stt->maxLevel, stt->maxAnalog);
/* Q1 */
tmp16 = (int16_t)(stt->micVol - stt->maxAnalog);
tmp32 = (GAIN_TBL_LEN - 1) * tmp16;
tmp16 = (int16_t)(stt->maxLevel - stt->maxAnalog);
targetGainIdx = tmp32 / tmp16;
- assert(targetGainIdx < GAIN_TBL_LEN);
+ RTC_DCHECK_LT(targetGainIdx, GAIN_TBL_LEN);
/* Increment through the table towards the target gain.
* If micVol drops below maxAnalog, we allow the gain

Powered by Google App Engine
This is Rietveld 408576698