(Re)move VoE specific enums from common_types.h.

BUG=webrtc:5876

Review-Url: https://codereview.webrtc.org/2745253007
Cr-Commit-Position: refs/heads/master@{#17267}
This commit is contained in:
solenberg 2017-03-16 01:20:23 -07:00 committed by Commit bot
parent 299b67809a
commit 22818a5804
6 changed files with 20 additions and 85 deletions

View File

@ -410,68 +410,6 @@ struct AudioDecodingCallStats {
int decoded_muted_output; // Number of calls returning a muted state output.
};
// Type of Noise Suppression.
enum NsModes {
kNsUnchanged = 0, // previously set mode
kNsDefault, // platform default
kNsConference, // conferencing default
kNsLowSuppression, // lowest suppression
kNsModerateSuppression,
kNsHighSuppression,
kNsVeryHighSuppression, // highest suppression
};
// Type of Automatic Gain Control.
enum AgcModes {
kAgcUnchanged = 0, // previously set mode
kAgcDefault, // platform default
// adaptive mode for use when analog volume control exists (e.g. for
// PC softphone)
kAgcAdaptiveAnalog,
// scaling takes place in the digital domain (e.g. for conference servers
// and embedded devices)
kAgcAdaptiveDigital,
// can be used on embedded devices where the capture signal level
// is predictable
kAgcFixedDigital
};
// Type of Echo Control.
enum EcModes {
kEcUnchanged = 0, // previously set mode
kEcDefault, // platform default
kEcConference, // conferencing default (aggressive AEC)
kEcAec, // Acoustic Echo Cancellation
kEcAecm, // AEC mobile
};
// Mode of AECM.
enum AecmModes {
kAecmQuietEarpieceOrHeadset = 0,
// Quiet earpiece or headset use
kAecmEarpiece, // most earpiece use
kAecmLoudEarpiece, // Loud earpiece or quiet speakerphone use
kAecmSpeakerphone, // most speakerphone use (default)
kAecmLoudSpeakerphone // Loud speakerphone
};
// AGC configuration parameters
struct AgcConfig {
unsigned short targetLeveldBOv;
unsigned short digitalCompressionGaindB;
bool limiterEnable;
};
enum StereoChannel { kStereoLeft = 0, kStereoRight, kStereoBoth };
// Audio device layers
enum AudioLayers {
kAudioPlatformDefault = 0,
kAudioWindowsCore = 2,
kAudioLinuxAlsa = 3,
kAudioLinuxPulse = 4
};
// ==================================================================
// Video specific types
// ==================================================================

View File

@ -45,15 +45,12 @@ void SetAgcConfig(AudioProcessing* apm,
void SetAgcStatus(AudioProcessing* apm,
AudioDeviceModule* adm,
bool enable,
AgcModes mode) {
bool enable) {
RTC_DCHECK(apm);
RTC_DCHECK(adm);
#if defined(WEBRTC_IOS) || defined(WEBRTC_ANDROID)
RTC_DCHECK_EQ(kAgcFixedDigital, mode);
GainControl::Mode agc_mode = GainControl::kFixedDigital;
#else
RTC_DCHECK_EQ(kAgcAdaptiveAnalog, mode);
GainControl::Mode agc_mode = GainControl::kAdaptiveAnalog;
#endif
GainControl* gc = apm->gain_control();
@ -70,7 +67,7 @@ void SetAgcStatus(AudioProcessing* apm,
LOG(LS_ERROR) << "Failed to set AGC mode in ADM: " << enable;
return;
}
LOG(LS_INFO) << "AGC set to " << enable << " with mode " << mode;
LOG(LS_INFO) << "AGC set to " << enable << " with mode " << agc_mode;
}
void SetEcStatus(AudioProcessing* apm,

View File

@ -11,13 +11,22 @@
#ifndef WEBRTC_MEDIA_ENGINE_APM_HELPERS_H_
#define WEBRTC_MEDIA_ENGINE_APM_HELPERS_H_
#include "webrtc/common_types.h"
namespace webrtc {
class AudioProcessing;
class AudioDeviceModule;
enum EcModes {
kEcConference, // Conferencing default (aggressive AEC).
kEcAecm, // AEC mobile.
};
struct AgcConfig {
unsigned short targetLeveldBOv;
unsigned short digitalCompressionGaindB;
bool limiterEnable;
};
namespace apm_helpers {
AgcConfig GetAgcConfig(AudioProcessing* apm);
@ -25,8 +34,7 @@ void SetAgcConfig(AudioProcessing* apm,
const AgcConfig& config);
void SetAgcStatus(AudioProcessing* apm,
AudioDeviceModule* adm,
bool enable,
AgcModes mode);
bool enable);
void SetEcStatus(AudioProcessing* apm,
bool enable,
EcModes mode);

View File

@ -123,25 +123,21 @@ TEST(ApmHelpersTest, AgcStatus_EnableDisable) {
TestHelper helper;
GainControl* gc = helper.apm()->gain_control();
#if defined(WEBRTC_IOS) || defined(WEBRTC_ANDROID)
apm_helpers::SetAgcStatus(helper.apm(), helper.adm(), false,
kAgcFixedDigital);
apm_helpers::SetAgcStatus(helper.apm(), helper.adm(), false);
EXPECT_FALSE(gc->is_enabled());
EXPECT_EQ(GainControl::kFixedDigital, gc->mode());
apm_helpers::SetAgcStatus(helper.apm(), helper.adm(), true,
kAgcFixedDigital);
apm_helpers::SetAgcStatus(helper.apm(), helper.adm(), true);
EXPECT_TRUE(gc->is_enabled());
EXPECT_EQ(GainControl::kFixedDigital, gc->mode());
#else
EXPECT_CALL(*helper.adm(), SetAGC(false)).WillOnce(testing::Return(0));
apm_helpers::SetAgcStatus(helper.apm(), helper.adm(), false,
kAgcAdaptiveAnalog);
apm_helpers::SetAgcStatus(helper.apm(), helper.adm(), false);
EXPECT_FALSE(gc->is_enabled());
EXPECT_EQ(GainControl::kAdaptiveAnalog, gc->mode());
EXPECT_CALL(*helper.adm(), SetAGC(true)).WillOnce(testing::Return(0));
apm_helpers::SetAgcStatus(helper.apm(), helper.adm(), true,
kAgcAdaptiveAnalog);
apm_helpers::SetAgcStatus(helper.apm(), helper.adm(), true);
EXPECT_TRUE(gc->is_enabled());
EXPECT_EQ(GainControl::kAdaptiveAnalog, gc->mode());
#endif

View File

@ -681,7 +681,6 @@ bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) {
// kEcConference is AEC with high suppression.
webrtc::EcModes ec_mode = webrtc::kEcConference;
webrtc::AgcModes agc_mode = webrtc::kAgcAdaptiveAnalog;
if (options.aecm_generate_comfort_noise) {
LOG(LS_VERBOSE) << "Comfort noise explicitly set to "
<< *options.aecm_generate_comfort_noise
@ -700,9 +699,6 @@ bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) {
#endif
#if defined(WEBRTC_IOS) || defined(ANDROID)
// Set the AGC mode for iOS as well despite disabling it above, to avoid
// unsupported configuration errors from webrtc.
agc_mode = webrtc::kAgcFixedDigital;
options.typing_detection = rtc::Optional<bool>(false);
options.experimental_agc = rtc::Optional<bool>(false);
options.extended_filter_aec = rtc::Optional<bool>(false);
@ -770,8 +766,7 @@ bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) {
LOG(LS_INFO) << "Disabling AGC since built-in AGC will be used instead";
}
}
webrtc::apm_helpers::SetAgcStatus(
apm(), adm(), *options.auto_gain_control, agc_mode);
webrtc::apm_helpers::SetAgcStatus(apm(), adm(), *options.auto_gain_control);
}
if (options.tx_agc_target_dbov || options.tx_agc_digital_compression_gain ||

View File

@ -25,6 +25,7 @@
#include "webrtc/call/call.h"
#include "webrtc/config.h"
#include "webrtc/media/base/rtputils.h"
#include "webrtc/media/engine/apm_helpers.h"
#include "webrtc/media/engine/webrtccommon.h"
#include "webrtc/media/engine/webrtcvoe.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h"