Removes usage of AGC APIs in the ADM.

Bug: webrtc:8598
Change-Id: I5ebc2e3549eba039797e40d2f8aea48341f3fe46
Reviewed-on: https://webrtc-review.googlesource.com/31520
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21254}
This commit is contained in:
henrika
2017-12-13 14:08:48 +01:00
committed by Commit Bot
parent d235d52d1d
commit e26456a4ed
29 changed files with 11 additions and 431 deletions

View File

@ -49,7 +49,6 @@ AudioDeviceLinuxPulse::AudioDeviceLinuxPulse()
_stopRec(false),
_startPlay(false),
_stopPlay(false),
_AGC(false),
update_speaker_volume_at_startup_(false),
_sndCardPlayDelay(0),
_sndCardRecDelay(0),
@ -579,18 +578,6 @@ int32_t AudioDeviceLinuxPulse::StereoPlayout(bool& enabled) const {
return 0;
}
int32_t AudioDeviceLinuxPulse::SetAGC(bool enable) {
rtc::CritScope lock(&_critSect);
_AGC = enable;
return 0;
}
bool AudioDeviceLinuxPulse::AGC() const {
rtc::CritScope lock(&_critSect);
return _AGC;
}
int32_t AudioDeviceLinuxPulse::MicrophoneVolumeIsAvailable(bool& available) {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
bool wasInitialized = _mixerManager.MicrophoneIsInitialized();
@ -1964,20 +1951,10 @@ int32_t AudioDeviceLinuxPulse::ReadRecordedData(const void* bufferData,
int32_t AudioDeviceLinuxPulse::ProcessRecordedData(int8_t* bufferData,
uint32_t bufferSizeInSamples,
uint32_t recDelay)
RTC_EXCLUSIVE_LOCKS_REQUIRED(_critSect) {
uint32_t currentMicLevel(0);
uint32_t newMicLevel(0);
RTC_EXCLUSIVE_LOCKS_REQUIRED(_critSect) {
_ptrAudioBuffer->SetRecordedBuffer(bufferData, bufferSizeInSamples);
if (AGC()) {
// Store current mic level in the audio buffer if AGC is enabled
if (MicrophoneVolume(currentMicLevel) == 0) {
// This call does not affect the actual microphone volume
_ptrAudioBuffer->SetCurrentMicLevel(currentMicLevel);
}
}
const uint32_t clockDrift(0);
// TODO(andrew): this is a temporary hack, to avoid non-causal far- and
// near-end signals at the AEC for PulseAudio. I think the system delay is
@ -2001,22 +1978,6 @@ int32_t AudioDeviceLinuxPulse::ProcessRecordedData(int8_t* bufferData,
return -1;
}
if (AGC()) {
newMicLevel = _ptrAudioBuffer->NewMicLevel();
if (newMicLevel != 0) {
// The VQE will only deliver non-zero microphone levels when a
// change is needed.
// Set this new mic level (received from the observer as return
// value in the callback).
RTC_LOG(LS_VERBOSE) << "AGC change of volume: old=" << currentMicLevel
<< " => new=" << newMicLevel;
if (SetMicrophoneVolume(newMicLevel) == -1) {
RTC_LOG(LS_WARNING)
<< "the required modification of the microphone volume failed";
}
}
}
return 0;
}