External APM usage downstream dependency support cleanup

This CL removes code that supported the now removed
downstream dependencies in the support for using an
external audio processing module.

BUG=webrtc:7939

Review-Url: https://codereview.webrtc.org/2969213002
Cr-Commit-Position: refs/heads/master@{#18929}
This commit is contained in:
peah 2017-07-07 04:25:11 -07:00 committed by Commit Bot
parent a0349c138d
commit e67bedbac3
6 changed files with 12 additions and 54 deletions

View File

@ -19,15 +19,11 @@
namespace webrtc {
namespace internal {
// TODO(peah): Remove the conditional in the audio_transport_proxy_ constructor
// call when upstream dependencies have properly been resolved.
AudioState::AudioState(const AudioState::Config& config)
: config_(config),
voe_base_(config.voice_engine),
audio_transport_proxy_(voe_base_->audio_transport(),
config_.audio_processing
? config_.audio_processing.get()
: voe_base_->audio_processing(),
config_.audio_processing.get(),
config_.audio_mixer) {
process_thread_checker_.DetachFromThread();
RTC_DCHECK(config_.audio_mixer);

View File

@ -28,11 +28,9 @@ class AudioState final : public webrtc::AudioState,
explicit AudioState(const AudioState::Config& config);
~AudioState() override;
// TODO(peah): Remove the conditional when upstream dependencies have properly
// been resolved.
AudioProcessing* audio_processing() override {
return config_.audio_processing ? config_.audio_processing.get()
: voe_base_->audio_processing();
RTC_DCHECK(config_.audio_processing);
return config_.audio_processing.get();
}
VoiceEngine* voice_engine();

View File

@ -72,9 +72,6 @@ class FakeWebRtcVoiceEngine : public webrtc::VoEBase {
inited_ = false;
return 0;
}
// TODO(peah): Remove this when downstream dependencies have properly been
// resolved.
webrtc::AudioProcessing* audio_processing() override { return nullptr; }
webrtc::AudioDeviceModule* audio_device_module() override {
return nullptr;
}

View File

@ -133,12 +133,6 @@ class WEBRTC_DLLEXPORT VoEBase {
AudioProcessing* external_apm = nullptr,
const rtc::scoped_refptr<AudioDecoderFactory>&
decoder_factory = nullptr) = 0;
// Returns null before Init() is called.
// TODO(peah): Remove this when downstream dependencies have properly been
// resolved.
virtual AudioProcessing* audio_processing() = 0;
// This method is WIP - DO NOT USE!
// Returns NULL before Init() is called.
virtual AudioDeviceModule* audio_device_module() = 0;

View File

@ -225,10 +225,9 @@ int VoEBaseImpl::DeRegisterVoiceEngineObserver() {
int VoEBaseImpl::Init(
AudioDeviceModule* external_adm,
AudioProcessing* external_apm,
AudioProcessing* audio_processing,
const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory) {
// TODO(peah): Add a DCHECK for external_apm when downstream dependencies
// have properly been resolved.
RTC_DCHECK(audio_processing);
rtc::CritScope cs(shared_->crit_sec());
WebRtcSpl_Init();
if (shared_->statistics().Initialized()) {
@ -339,43 +338,27 @@ int VoEBaseImpl::Init(
"Init() failed to set mono/stereo recording mode");
}
// TODO(peah): Remove this when upstream dependencies have properly been
// resolved.
AudioProcessing* apm = nullptr;
if (!external_apm) {
audio_processing_ = AudioProcessing::Create();
if (!audio_processing_) {
// This can only happen if there are problems allocating the dynamic
// memory in the Create() call.
LOG(LS_ERROR) << "Failed to create AudioProcessing.";
shared_->SetLastError(VE_NO_MEMORY);
return -1;
}
apm = audio_processing_.get();
} else {
apm = external_apm;
}
shared_->set_audio_processing(apm);
shared_->set_audio_processing(audio_processing);
// Set the error state for any failures in this block.
shared_->SetLastError(VE_APM_ERROR);
// Configure AudioProcessing components.
// TODO(peah): Move this initialization to webrtcvoiceengine.cc.
if (apm->high_pass_filter()->Enable(true) != 0) {
if (audio_processing->high_pass_filter()->Enable(true) != 0) {
LOG_F(LS_ERROR) << "Failed to enable high pass filter.";
return -1;
}
if (apm->echo_cancellation()->enable_drift_compensation(false) != 0) {
if (audio_processing->echo_cancellation()->enable_drift_compensation(false) !=
0) {
LOG_F(LS_ERROR) << "Failed to disable drift compensation.";
return -1;
}
if (apm->noise_suppression()->set_level(kDefaultNsMode) != 0) {
if (audio_processing->noise_suppression()->set_level(kDefaultNsMode) != 0) {
LOG_F(LS_ERROR) << "Failed to set noise suppression level: "
<< kDefaultNsMode;
return -1;
}
GainControl* agc = apm->gain_control();
GainControl* agc = audio_processing->gain_control();
if (agc->set_analog_level_limits(kMinVolumeLevel, kMaxVolumeLevel) != 0) {
LOG_F(LS_ERROR) << "Failed to set analog level limits with minimum: "
<< kMinVolumeLevel << " and maximum: " << kMaxVolumeLevel;

View File

@ -30,14 +30,8 @@ class VoEBaseImpl : public VoEBase,
int Init(
AudioDeviceModule* external_adm,
AudioProcessing* external_apm,
AudioProcessing* audio_processing,
const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory) override;
AudioProcessing* audio_processing() override {
// TODO(peah): Remove this when downstream dependencies have properly been
// resolved.
RTC_DCHECK(audio_processing_);
return audio_processing_.get();
}
AudioDeviceModule* audio_device_module() override {
return shared_->audio_device();
}
@ -124,10 +118,6 @@ class VoEBaseImpl : public VoEBase,
rtc::CriticalSection callbackCritSect_;
rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_;
// TODO(peah): Remove this when upstream dependencies have properly been
// resolved.
rtc::scoped_refptr<AudioProcessing> audio_processing_;
AudioFrame audioFrame_;
voe::SharedData* shared_;
};