VAD refactor: Mode changed to "int".
As part of style this CL includes changing the input aggressiveness mode from int16_t to int. No other style changes made. Impact on: - Audio Processing: Changed return value on MapSetting(). - Function test in audio_conference_mixer already uses int. No action. - NetEq: Function pointer changes and input parameter changes in SetVADMode() and SetVADModeInternal(). - Audio Coding: Uses enum ACMVADMode which is type independent. - VAD: Two unit tests. TESTS=vad_unittests, neteq_unittests, audioproc_unittest Review URL: https://webrtc-codereview.appspot.com/373001 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1544 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -127,7 +127,7 @@ int WebRtcVad_Init(VadInst *vad_inst);
|
||||
* Return value : 0 - Ok
|
||||
* -1 - Error
|
||||
*/
|
||||
int WebRtcVad_set_mode(VadInst *vad_inst, WebRtc_Word16 mode);
|
||||
int WebRtcVad_set_mode(VadInst *vad_inst, int mode);
|
||||
|
||||
/****************************************************************************
|
||||
* WebRtcVad_Process(...)
|
||||
|
||||
@@ -527,7 +527,7 @@ int WebRtcVad_InitCore(VadInstT* self) {
|
||||
}
|
||||
|
||||
// Set aggressiveness mode
|
||||
int WebRtcVad_set_mode_core(VadInstT *inst, short mode)
|
||||
int WebRtcVad_set_mode_core(VadInstT *inst, int mode)
|
||||
{
|
||||
|
||||
if (mode == 0)
|
||||
|
||||
@@ -75,7 +75,7 @@ int WebRtcVad_InitCore(VadInstT* self);
|
||||
* -1 - Error
|
||||
*/
|
||||
|
||||
int WebRtcVad_set_mode_core(VadInstT* inst, short mode);
|
||||
int WebRtcVad_set_mode_core(VadInstT* inst, int mode);
|
||||
|
||||
/****************************************************************************
|
||||
* WebRtcVad_CalcVad32khz(...)
|
||||
|
||||
@@ -45,8 +45,7 @@ TEST_F(VadTest, set_mode_core) {
|
||||
// Test WebRtcVad_set_mode_core().
|
||||
// Invalid modes should return -1.
|
||||
EXPECT_EQ(-1, WebRtcVad_set_mode_core(self, -1));
|
||||
EXPECT_EQ(-1, WebRtcVad_set_mode_core(self,
|
||||
static_cast<int16_t>(kModesSize)));
|
||||
EXPECT_EQ(-1, WebRtcVad_set_mode_core(self, 1000));
|
||||
// Valid modes should return 0.
|
||||
for (size_t j = 0; j < kModesSize; ++j) {
|
||||
EXPECT_EQ(0, WebRtcVad_set_mode_core(self, kModes[j]));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
@@ -19,7 +19,7 @@
|
||||
namespace {
|
||||
|
||||
// Modes we support
|
||||
const int16_t kModes[] = { 0, 1, 2, 3 };
|
||||
const int kModes[] = { 0, 1, 2, 3 };
|
||||
const size_t kModesSize = sizeof(kModes) / sizeof(*kModes);
|
||||
|
||||
// Rates we support.
|
||||
|
||||
@@ -106,7 +106,7 @@ int WebRtcVad_Init(VadInst* handle) {
|
||||
return WebRtcVad_InitCore((VadInstT*) handle);
|
||||
}
|
||||
|
||||
int WebRtcVad_set_mode(VadInst *vad_inst, WebRtc_Word16 mode)
|
||||
int WebRtcVad_set_mode(VadInst *vad_inst, int mode)
|
||||
{
|
||||
VadInstT* vad_ptr;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user