Replace calls to assert() with RTC_DCHECK_*() in .c code
We have RTC_CHECK and RTC_DCHECK for C now, so we should use it. It's one fewer difference between our C and C++ code. NOPRESUBMIT=true Review-Url: https://codereview.webrtc.org/2274083002 Cr-Commit-Position: refs/heads/master@{#13930}
This commit is contained in:
@ -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
|
||||
|
||||
@ -14,12 +14,12 @@
|
||||
|
||||
#include "webrtc/modules/audio_processing/agc/legacy/digital_agc.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#ifdef WEBRTC_AGC_DEBUG_DUMP
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/modules/audio_processing/agc/legacy/gain_control.h"
|
||||
|
||||
// To generate the gaintable, copy&paste the following lines to a Matlab window:
|
||||
@ -109,7 +109,7 @@ int32_t WebRtcAgc_CalculateGainTable(int32_t* gainTable, // Q16
|
||||
diffGain =
|
||||
WebRtcSpl_DivW32W16ResW16(tmp32no1 + (kCompRatio >> 1), kCompRatio);
|
||||
if (diffGain < 0 || diffGain >= kGenFuncTableSize) {
|
||||
assert(0);
|
||||
RTC_DCHECK(0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -268,7 +268,7 @@ int32_t WebRtcAgc_InitDigital(DigitalAgc* stt, int16_t agcMode) {
|
||||
int32_t WebRtcAgc_AddFarendToDigital(DigitalAgc* stt,
|
||||
const int16_t* in_far,
|
||||
size_t nrSamples) {
|
||||
assert(stt != NULL);
|
||||
RTC_DCHECK(stt);
|
||||
// VAD for far end
|
||||
WebRtcAgc_ProcessVad(&stt->vadFarend, in_far, nrSamples);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user