Move APM initialization into WebRtcVoiceEngine

TBR=kwiberg@webrtc.org

Bug: webrtc:4690
Change-Id: Icd8590d3f7476c1a841c7e2425d1134d224b1a53
Reviewed-on: https://webrtc-review.googlesource.com/23480
Commit-Queue: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20855}
This commit is contained in:
Fredrik Solenberg 2017-11-23 20:22:55 +01:00 committed by Commit Bot
parent 316386747a
commit 55900fd416
19 changed files with 77 additions and 115 deletions

View File

@ -18,6 +18,24 @@
namespace webrtc {
namespace apm_helpers {
void Init(AudioProcessing* apm) {
RTC_DCHECK(apm);
constexpr int kMinVolumeLevel = 0;
constexpr int kMaxVolumeLevel = 255;
// This is the initialization which used to happen in VoEBase::Init(), but
// which is not covered by the WVoE::ApplyOptions().
if (apm->echo_cancellation()->enable_drift_compensation(false) != 0) {
RTC_DLOG(LS_ERROR) << "Failed to disable drift compensation.";
}
GainControl* gc = apm->gain_control();
if (gc->set_analog_level_limits(kMinVolumeLevel, kMaxVolumeLevel) != 0) {
RTC_DLOG(LS_ERROR) << "Failed to set analog level limits with minimum: "
<< kMinVolumeLevel << " and maximum: " << kMaxVolumeLevel;
}
}
AgcConfig GetAgcConfig(AudioProcessing* apm) {
RTC_DCHECK(apm);
AgcConfig result;

View File

@ -31,6 +31,7 @@ struct AgcConfig {
namespace apm_helpers {
void Init(AudioProcessing* apm);
AgcConfig GetAgcConfig(AudioProcessing* apm);
void SetAgcConfig(AudioProcessing* apm,
const AgcConfig& config);

View File

@ -29,6 +29,7 @@ struct TestHelper {
Config config;
config.Set<ExperimentalAgc>(new ExperimentalAgc(false));
apm_ = rtc::scoped_refptr<AudioProcessing>(AudioProcessing::Create(config));
apm_helpers::Init(apm());
EXPECT_EQ(0, voe_wrapper_.base()->Init(
&mock_audio_device_, apm_,
MockAudioDecoderFactory::CreateEmptyFactory()));
@ -102,14 +103,12 @@ TEST(ApmHelpersTest, AgcConfig_GetAndSet) {
TEST(ApmHelpersTest, AgcStatus_DefaultMode) {
TestHelper helper;
GainControl* gc = helper.apm()->gain_control();
EXPECT_FALSE(gc->is_enabled());
#if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR
EXPECT_FALSE(gc->is_enabled());
EXPECT_EQ(GainControl::kAdaptiveDigital, gc->mode());
EXPECT_EQ(GainControl::kAdaptiveAnalog, gc->mode());
#elif defined(WEBRTC_IOS) || defined(WEBRTC_ANDROID)
EXPECT_FALSE(gc->is_enabled());
EXPECT_EQ(GainControl::kFixedDigital, gc->mode());
#else
EXPECT_TRUE(gc->is_enabled());
EXPECT_EQ(GainControl::kAdaptiveAnalog, gc->mode());
#endif
}
@ -266,7 +265,7 @@ TEST(ApmHelpersTest, MAYBE_TypingDetectionStatus_EnableDisable) {
// of duplicating all relevant tests from audio_processing_test.cc.
TEST(ApmHelpersTest, HighPassFilter_DefaultMode) {
TestHelper helper;
EXPECT_TRUE(helper.apm()->high_pass_filter()->is_enabled());
EXPECT_FALSE(helper.apm()->high_pass_filter()->is_enabled());
}
// TODO(solenberg): Move this test to a better place - added here for the sake

View File

@ -65,9 +65,8 @@ class FakeWebRtcVoiceEngine : public webrtc::VoEBase {
inited_ = true;
return 0;
}
WEBRTC_FUNC(Terminate, ()) {
void Terminate() override {
inited_ = false;
return 0;
}
webrtc::voe::TransmitMixer* transmit_mixer() override {
return transmit_mixer_;

View File

@ -70,7 +70,6 @@ const int kOpusBitrateFbBps = 32000;
// See also http://tools.ietf.org/html/draft-jennings-rtcweb-qos-00
const rtc::DiffServCodePoint kAudioDscpValue = rtc::DSCP_EF;
// Constants from voice_engine_defines.h.
const int kMinTelephoneEventCode = 0; // RFC4733 (Section 2.3.1)
const int kMaxTelephoneEventCode = 255;
@ -299,7 +298,7 @@ void WebRtcVoiceEngine::Init() {
#endif // WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE
RTC_CHECK(adm());
webrtc::adm_helpers::Init(adm());
webrtc::apm_helpers::Init(apm());
RTC_CHECK_EQ(0, voe_wrapper_->base()->Init(adm(), apm(), decoder_factory_));
transmit_mixer_ = voe_wrapper_->base()->transmit_mixer();
RTC_DCHECK(transmit_mixer_);
@ -331,11 +330,6 @@ void WebRtcVoiceEngine::Init() {
RTC_DCHECK(error);
}
// Set default audio devices.
#if !defined(WEBRTC_IOS)
apm()->Initialize();
#endif // !WEBRTC_IOS
// May be null for VoE injected for testing.
if (voe()->engine()) {
audio_state_ = webrtc::AudioState::Create(
@ -723,6 +717,7 @@ webrtc::AudioDeviceModule* WebRtcVoiceEngine::adm() {
webrtc::AudioProcessing* WebRtcVoiceEngine::apm() const {
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
RTC_DCHECK(apm_);
return apm_.get();
}

View File

@ -68,6 +68,16 @@ const uint32_t kSsrcs4[] = { 11, 200, 30, 44 };
constexpr int kRtpHistoryMs = 5000;
constexpr webrtc::GainControl::Mode kDefaultAgcMode =
#if defined(WEBRTC_IOS) || defined(WEBRTC_ANDROID)
webrtc::GainControl::kFixedDigital;
#else
webrtc::GainControl::kAdaptiveAnalog;
#endif
constexpr webrtc::NoiseSuppression::Level kDefaultNsLevel =
webrtc::NoiseSuppression::kHigh;
class FakeVoEWrapper : public cricket::VoEWrapper {
public:
explicit FakeVoEWrapper(cricket::FakeWebRtcVoiceEngine* engine)
@ -137,7 +147,6 @@ TEST(WebRtcVoiceEngineTestStubLibrary, StartupShutdown) {
EXPECT_CALL(*apm, GetConfig()).WillRepeatedly(ReturnPointee(&apm_config));
EXPECT_CALL(*apm, ApplyConfig(_)).WillRepeatedly(SaveArg<0>(&apm_config));
EXPECT_CALL(*apm, SetExtraOptions(testing::_));
EXPECT_CALL(*apm, Initialize()).WillOnce(Return(0));
EXPECT_CALL(*apm, DetachAecDump());
StrictMock<MockTransmitMixer> transmit_mixer;
EXPECT_CALL(transmit_mixer, EnableStereoChannelSwapping(false));
@ -183,12 +192,15 @@ class WebRtcVoiceEngineTestFake : public testing::Test {
EXPECT_CALL(*apm_, GetConfig()).WillRepeatedly(ReturnPointee(&apm_config_));
EXPECT_CALL(*apm_, ApplyConfig(_)).WillRepeatedly(SaveArg<0>(&apm_config_));
EXPECT_CALL(*apm_, SetExtraOptions(testing::_));
EXPECT_CALL(*apm_, Initialize()).WillOnce(Return(0));
EXPECT_CALL(*apm_, DetachAecDump());
// Default Options.
EXPECT_CALL(apm_ec_, Enable(true)).WillOnce(Return(0));
EXPECT_CALL(apm_ec_, enable_metrics(true)).WillOnce(Return(0));
EXPECT_CALL(apm_ec_, enable_drift_compensation(false)).WillOnce(Return(0));
EXPECT_CALL(apm_gc_, set_mode(kDefaultAgcMode)).WillOnce(Return(0));
EXPECT_CALL(apm_gc_, Enable(true)).WillOnce(Return(0));
EXPECT_CALL(apm_gc_, set_analog_level_limits(0, 255)).WillOnce(Return(0));
EXPECT_CALL(apm_ns_, set_level(kDefaultNsLevel)).WillOnce(Return(0));
EXPECT_CALL(apm_ns_, Enable(true)).WillOnce(Return(0));
EXPECT_CALL(apm_vd_, Enable(true)).WillOnce(Return(0));
EXPECT_CALL(transmit_mixer_, EnableStereoChannelSwapping(false));
@ -210,6 +222,7 @@ class WebRtcVoiceEngineTestFake : public testing::Test {
engine_->Init();
send_parameters_.codecs.push_back(kPcmuCodec);
recv_parameters_.codecs.push_back(kPcmuCodec);
// Default Options.
EXPECT_TRUE(IsHighPassFilterEnabled());
}
@ -2221,6 +2234,7 @@ TEST_F(WebRtcVoiceEngineTestFake, TxAgcConfigViaOptions) {
EXPECT_CALL(adm_,
BuiltInAGCIsAvailable()).Times(2).WillRepeatedly(Return(false));
EXPECT_CALL(adm_, SetAGC(true)).Times(2).WillRepeatedly(Return(0));
EXPECT_CALL(apm_gc_, set_mode(kDefaultAgcMode)).Times(2).WillOnce(Return(0));
EXPECT_CALL(apm_gc_, Enable(true)).Times(2).WillOnce(Return(0));
send_parameters_.options.tx_agc_target_dbov = 3;
send_parameters_.options.tx_agc_digital_compression_gain = 9;
@ -2775,6 +2789,7 @@ TEST_F(WebRtcVoiceEngineTestFake, SetAudioOptions) {
EXPECT_CALL(adm_, SetAGC(false)).WillOnce(Return(0));
EXPECT_CALL(apm_ec_, Enable(true)).WillOnce(Return(0));
EXPECT_CALL(apm_ec_, enable_metrics(true)).WillOnce(Return(0));
EXPECT_CALL(apm_gc_, set_mode(kDefaultAgcMode)).WillOnce(Return(0));
EXPECT_CALL(apm_gc_, Enable(false)).WillOnce(Return(0));
send_parameters_.options.auto_gain_control = false;
SetSendParameters(send_parameters_);
@ -2783,6 +2798,7 @@ TEST_F(WebRtcVoiceEngineTestFake, SetAudioOptions) {
EXPECT_CALL(adm_, SetAGC(true)).WillOnce(Return(0));
EXPECT_CALL(apm_ec_, Enable(true)).WillOnce(Return(0));
EXPECT_CALL(apm_ec_, enable_metrics(true)).WillOnce(Return(0));
EXPECT_CALL(apm_gc_, set_mode(kDefaultAgcMode)).WillOnce(Return(0));
EXPECT_CALL(apm_gc_, Enable(true)).WillOnce(Return(0));
send_parameters_.options.auto_gain_control = true;
send_parameters_.options.adjust_agc_delta = rtc::nullopt;
@ -2792,7 +2808,9 @@ TEST_F(WebRtcVoiceEngineTestFake, SetAudioOptions) {
EXPECT_CALL(adm_, SetAGC(true)).WillOnce(Return(0));
EXPECT_CALL(apm_ec_, Enable(true)).WillOnce(Return(0));
EXPECT_CALL(apm_ec_, enable_metrics(true)).WillOnce(Return(0));
EXPECT_CALL(apm_gc_, set_mode(kDefaultAgcMode)).WillOnce(Return(0));
EXPECT_CALL(apm_gc_, Enable(true)).WillOnce(Return(0));
EXPECT_CALL(apm_ns_, set_level(kDefaultNsLevel)).WillOnce(Return(0));
EXPECT_CALL(apm_ns_, Enable(false)).WillOnce(Return(0));
EXPECT_CALL(apm_vd_, Enable(false)).WillOnce(Return(0));
EXPECT_CALL(transmit_mixer_, EnableStereoChannelSwapping(true));
@ -2807,7 +2825,9 @@ TEST_F(WebRtcVoiceEngineTestFake, SetAudioOptions) {
EXPECT_CALL(adm_, SetAGC(true)).WillOnce(Return(0));
EXPECT_CALL(apm_ec_, Enable(true)).WillOnce(Return(0));
EXPECT_CALL(apm_ec_, enable_metrics(true)).WillOnce(Return(0));
EXPECT_CALL(apm_gc_, set_mode(kDefaultAgcMode)).WillOnce(Return(0));
EXPECT_CALL(apm_gc_, Enable(true)).WillOnce(Return(0));
EXPECT_CALL(apm_ns_, set_level(kDefaultNsLevel)).WillOnce(Return(0));
EXPECT_CALL(apm_ns_, Enable(false)).WillOnce(Return(0));
EXPECT_CALL(apm_vd_, Enable(false)).WillOnce(Return(0));
EXPECT_CALL(transmit_mixer_, EnableStereoChannelSwapping(true));
@ -2858,7 +2878,9 @@ TEST_F(WebRtcVoiceEngineTestFake, SetOptionOverridesViaChannels) {
EXPECT_CALL(adm_, SetAGC(true)).Times(2).WillRepeatedly(Return(0));
EXPECT_CALL(apm_ec_, Enable(true)).Times(2).WillRepeatedly(Return(0));
EXPECT_CALL(apm_ec_, enable_metrics(true)).Times(2).WillRepeatedly(Return(0));
EXPECT_CALL(apm_gc_, set_mode(kDefaultAgcMode)).Times(2).WillOnce(Return(0));
EXPECT_CALL(apm_gc_, Enable(true)).Times(2).WillRepeatedly(Return(0));
EXPECT_CALL(apm_ns_, set_level(kDefaultNsLevel)).Times(2).WillOnce(Return(0));
EXPECT_CALL(apm_ns_, Enable(true)).Times(2).WillRepeatedly(Return(0));
EXPECT_TRUE(channel1->SetSendParameters(parameters_options_all));
EXPECT_EQ(parameters_options_all.options, channel1->options());
@ -2871,7 +2893,9 @@ TEST_F(WebRtcVoiceEngineTestFake, SetOptionOverridesViaChannels) {
EXPECT_CALL(adm_, SetAGC(true)).WillOnce(Return(0));
EXPECT_CALL(apm_ec_, Enable(true)).WillOnce(Return(0));
EXPECT_CALL(apm_ec_, enable_metrics(true)).WillOnce(Return(0));
EXPECT_CALL(apm_gc_, set_mode(kDefaultAgcMode)).WillOnce(Return(0));
EXPECT_CALL(apm_gc_, Enable(true)).WillOnce(Return(0));
EXPECT_CALL(apm_ns_, set_level(kDefaultNsLevel)).WillOnce(Return(0));
EXPECT_CALL(apm_ns_, Enable(false)).WillOnce(Return(0));
EXPECT_TRUE(channel1->SetSendParameters(parameters_options_no_ns));
cricket::AudioOptions expected_options = parameters_options_all.options;
@ -2886,7 +2910,9 @@ TEST_F(WebRtcVoiceEngineTestFake, SetOptionOverridesViaChannels) {
EXPECT_CALL(adm_, SetAGC(false)).WillOnce(Return(0));
EXPECT_CALL(apm_ec_, Enable(true)).WillOnce(Return(0));
EXPECT_CALL(apm_ec_, enable_metrics(true)).WillOnce(Return(0));
EXPECT_CALL(apm_gc_, set_mode(kDefaultAgcMode)).WillOnce(Return(0));
EXPECT_CALL(apm_gc_, Enable(false)).WillOnce(Return(0));
EXPECT_CALL(apm_ns_, set_level(kDefaultNsLevel)).WillOnce(Return(0));
EXPECT_CALL(apm_ns_, Enable(true)).WillOnce(Return(0));
EXPECT_TRUE(channel2->SetSendParameters(parameters_options_no_agc));
expected_options.echo_cancellation = true;
@ -2897,21 +2923,27 @@ TEST_F(WebRtcVoiceEngineTestFake, SetOptionOverridesViaChannels) {
EXPECT_CALL(adm_, SetAGC(true)).WillOnce(Return(0));
EXPECT_CALL(apm_ec_, Enable(true)).WillOnce(Return(0));
EXPECT_CALL(apm_ec_, enable_metrics(true)).WillOnce(Return(0));
EXPECT_CALL(apm_gc_, set_mode(kDefaultAgcMode)).WillOnce(Return(0));
EXPECT_CALL(apm_gc_, Enable(true)).WillOnce(Return(0));
EXPECT_CALL(apm_ns_, set_level(kDefaultNsLevel)).WillOnce(Return(0));
EXPECT_CALL(apm_ns_, Enable(true)).WillOnce(Return(0));
EXPECT_TRUE(channel_->SetSendParameters(parameters_options_all));
EXPECT_CALL(adm_, SetAGC(true)).WillOnce(Return(0));
EXPECT_CALL(apm_ec_, Enable(true)).WillOnce(Return(0));
EXPECT_CALL(apm_ec_, enable_metrics(true)).WillOnce(Return(0));
EXPECT_CALL(apm_gc_, set_mode(kDefaultAgcMode)).WillOnce(Return(0));
EXPECT_CALL(apm_gc_, Enable(true)).WillOnce(Return(0));
EXPECT_CALL(apm_ns_, set_level(kDefaultNsLevel)).WillOnce(Return(0));
EXPECT_CALL(apm_ns_, Enable(false)).WillOnce(Return(0));
channel1->SetSend(true);
EXPECT_CALL(adm_, SetAGC(false)).WillOnce(Return(0));
EXPECT_CALL(apm_ec_, Enable(true)).WillOnce(Return(0));
EXPECT_CALL(apm_ec_, enable_metrics(true)).WillOnce(Return(0));
EXPECT_CALL(apm_gc_, set_mode(kDefaultAgcMode)).WillOnce(Return(0));
EXPECT_CALL(apm_gc_, Enable(false)).WillOnce(Return(0));
EXPECT_CALL(apm_ns_, set_level(kDefaultNsLevel)).WillOnce(Return(0));
EXPECT_CALL(apm_ns_, Enable(true)).WillOnce(Return(0));
channel2->SetSend(true);
@ -2923,7 +2955,9 @@ TEST_F(WebRtcVoiceEngineTestFake, SetOptionOverridesViaChannels) {
EXPECT_CALL(adm_, SetAGC(false)).WillOnce(Return(0));
EXPECT_CALL(apm_ec_, Enable(true)).WillOnce(Return(0));
EXPECT_CALL(apm_ec_, enable_metrics(true)).WillOnce(Return(0));
EXPECT_CALL(apm_gc_, set_mode(kDefaultAgcMode)).WillOnce(Return(0));
EXPECT_CALL(apm_gc_, Enable(false)).WillOnce(Return(0));
EXPECT_CALL(apm_ns_, set_level(kDefaultNsLevel)).WillOnce(Return(0));
EXPECT_CALL(apm_ns_, Enable(false)).WillOnce(Return(0));
EXPECT_TRUE(channel2->SetSendParameters(parameters_options_no_agc_nor_ns));
expected_options.echo_cancellation = true;

View File

@ -95,7 +95,7 @@ class MockVoiceEngine : public VoiceEngineImpl {
AudioProcessing* external_apm,
const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory));
MOCK_METHOD0(transmit_mixer, voe::TransmitMixer*());
MOCK_METHOD0(Terminate, int());
MOCK_METHOD0(Terminate, void());
MOCK_METHOD0(CreateChannel, int());
MOCK_METHOD1(CreateChannel, int(const ChannelConfig& config));
MOCK_METHOD1(DeleteChannel, int(int channel));

View File

@ -28,7 +28,6 @@ rtc_static_library("voice_engine") {
"utility.h",
"voe_base_impl.cc",
"voe_base_impl.h",
"voice_engine_defines.h",
"voice_engine_impl.cc",
"voice_engine_impl.h",
]

View File

@ -57,6 +57,10 @@ constexpr double kAudioSampleDurationSeconds = 0.01;
constexpr int64_t kMaxRetransmissionWindowMs = 1000;
constexpr int64_t kMinRetransmissionWindowMs = 30;
// Video Sync.
constexpr int kVoiceEngineMinMinPlayoutDelayMs = 0;
constexpr int kVoiceEngineMaxMinPlayoutDelayMs = 10000;
} // namespace
const int kTelephoneEventAttenuationdB = 10;

View File

@ -32,7 +32,6 @@
#include "voice_engine/audio_level.h"
#include "voice_engine/include/voe_base.h"
#include "voice_engine/shared_data.h"
#include "voice_engine/voice_engine_defines.h"
namespace rtc {
class TimestampWrapAroundHandler;

View File

@ -102,8 +102,7 @@ class WEBRTC_DLLEXPORT VoEBase {
virtual voe::TransmitMixer* transmit_mixer() = 0;
// Terminates all VoiceEngine functions and releases allocated resources.
// Returns 0.
virtual int Terminate() = 0;
virtual void Terminate() = 0;
// Creates a new channel and allocates the required resources for it.
// The second version accepts a |config| struct which includes an Audio Coding

View File

@ -22,7 +22,6 @@
#include "rtc_base/thread_annotations.h"
#include "rtc_base/thread_checker.h"
#include "voice_engine/channel_manager.h"
#include "voice_engine/voice_engine_defines.h"
class ProcessThread;

View File

@ -20,7 +20,6 @@
#include "rtc_base/criticalsection.h"
#include "voice_engine/audio_level.h"
#include "voice_engine/include/voe_base.h"
#include "voice_engine/voice_engine_defines.h"
#if !defined(WEBRTC_ANDROID) && !defined(WEBRTC_IOS)
#define WEBRTC_VOICE_ENGINE_TYPING_DETECTION 1

View File

@ -17,7 +17,6 @@
#include "modules/include/module_common_types.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "voice_engine/voice_engine_defines.h"
namespace webrtc {
namespace voe {

View File

@ -16,7 +16,6 @@
#include "rtc_base/format_macros.h"
#include "test/gtest.h"
#include "voice_engine/utility.h"
#include "voice_engine/voice_engine_defines.h"
namespace webrtc {
namespace voe {

View File

@ -55,6 +55,8 @@ int32_t VoEBaseImpl::RecordedDataIsAvailable(
RTC_DCHECK(shared_->transmit_mixer() != nullptr);
RTC_DCHECK(shared_->audio_device() != nullptr);
constexpr uint32_t kMaxVolumeLevel = 255;
uint32_t max_volume = 0;
uint16_t voe_mic_level = 0;
// Check for zero to skip this calculation; the consumer may use this to
@ -155,57 +157,15 @@ int VoEBaseImpl::Init(
shared_->set_audio_device(audio_device);
shared_->set_audio_processing(audio_processing);
// Configure AudioProcessing components.
// TODO(peah): Move this initialization to webrtcvoiceengine.cc.
if (audio_processing->high_pass_filter()->Enable(true) != 0) {
RTC_LOG_F(LS_ERROR) << "Failed to enable high pass filter.";
return -1;
}
if (audio_processing->echo_cancellation()->enable_drift_compensation(false) !=
0) {
RTC_LOG_F(LS_ERROR) << "Failed to disable drift compensation.";
return -1;
}
if (audio_processing->noise_suppression()->set_level(kDefaultNsMode) != 0) {
RTC_LOG_F(LS_ERROR) << "Failed to set noise suppression level: "
<< kDefaultNsMode;
return -1;
}
GainControl* agc = audio_processing->gain_control();
if (agc->set_analog_level_limits(kMinVolumeLevel, kMaxVolumeLevel) != 0) {
RTC_LOG_F(LS_ERROR) << "Failed to set analog level limits with minimum: "
<< kMinVolumeLevel
<< " and maximum: " << kMaxVolumeLevel;
return -1;
}
if (agc->set_mode(kDefaultAgcMode) != 0) {
RTC_LOG_F(LS_ERROR) << "Failed to set mode: " << kDefaultAgcMode;
return -1;
}
if (agc->Enable(kDefaultAgcState) != 0) {
RTC_LOG_F(LS_ERROR) << "Failed to set agc state: " << kDefaultAgcState;
return -1;
}
#ifdef WEBRTC_VOICE_ENGINE_AGC
bool agc_enabled =
agc->mode() == GainControl::kAdaptiveAnalog && agc->is_enabled();
if (shared_->audio_device()->SetAGC(agc_enabled) != 0) {
RTC_LOG_F(LS_ERROR) << "Failed to set agc to enabled: " << agc_enabled;
// TODO(ajm): No error return here due to
// https://code.google.com/p/webrtc/issues/detail?id=1464
}
#endif
RTC_DCHECK(decoder_factory);
decoder_factory_ = decoder_factory;
return 0;
}
int VoEBaseImpl::Terminate() {
void VoEBaseImpl::Terminate() {
rtc::CritScope cs(shared_->crit_sec());
return TerminateInternal();
TerminateInternal();
}
int VoEBaseImpl::CreateChannel() {
@ -436,7 +396,7 @@ int32_t VoEBaseImpl::SetRecording(bool enabled) {
return ret;
}
int32_t VoEBaseImpl::TerminateInternal() {
void VoEBaseImpl::TerminateInternal() {
// Delete any remaining channel objects
shared_->channel_manager().DestroyAllChannels();
@ -446,7 +406,5 @@ int32_t VoEBaseImpl::TerminateInternal() {
shared_->set_audio_device(nullptr);
shared_->set_audio_processing(nullptr);
return 0;
}
} // namespace webrtc

View File

@ -31,7 +31,7 @@ class VoEBaseImpl : public VoEBase,
voe::TransmitMixer* transmit_mixer() override {
return shared_->transmit_mixer();
}
int Terminate() override;
void Terminate() override;
int CreateChannel() override;
int CreateChannel(const ChannelConfig& config) override;
@ -89,7 +89,7 @@ class VoEBaseImpl : public VoEBase,
int32_t StopPlayout();
int32_t StartSend();
int32_t StopSend();
int32_t TerminateInternal();
void TerminateInternal();
void GetPlayoutData(int sample_rate, size_t number_of_channels,
size_t number_of_frames, bool feed_data_to_apm,

View File

@ -28,7 +28,7 @@ class VoEBaseTest : public ::testing::Test {
}
~VoEBaseTest() {
EXPECT_EQ(0, base_->Terminate());
base_->Terminate();
EXPECT_EQ(1, base_->Release());
EXPECT_TRUE(VoiceEngine::Delete(voe_));
}

View File

@ -8,43 +8,4 @@
* be found in the AUTHORS file in the root of the source tree.
*/
/*
* This file contains common constants for VoiceEngine, as well as
* platform specific settings.
*/
#ifndef VOICE_ENGINE_VOICE_ENGINE_DEFINES_H_
#define VOICE_ENGINE_VOICE_ENGINE_DEFINES_H_
#include "modules/audio_processing/include/audio_processing.h"
namespace webrtc {
// VolumeControl
enum { kMinVolumeLevel = 0 };
enum { kMaxVolumeLevel = 255 };
// Audio processing
const NoiseSuppression::Level kDefaultNsMode = NoiseSuppression::kModerate;
const GainControl::Mode kDefaultAgcMode =
#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
GainControl::kAdaptiveDigital;
#else
GainControl::kAdaptiveAnalog;
#endif
const bool kDefaultAgcState =
#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
false;
#else
true;
#endif
// VideoSync
// Lowest minimum playout delay
enum { kVoiceEngineMinMinPlayoutDelayMs = 0 };
// Highest minimum playout delay
enum { kVoiceEngineMaxMinPlayoutDelayMs = 10000 };
} // namespace webrtc
#endif // VOICE_ENGINE_VOICE_ENGINE_DEFINES_H_
// TODO(solenberg): Remove this file once downstream dependencies are removed.