summaryrefslogtreecommitdiff
path: root/voice_engine/voe_base_impl.cc
diff options
context:
space:
mode:
authorandrew@webrtc.org <andrew@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2014-01-11 01:25:53 +0000
committerandrew@webrtc.org <andrew@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2014-01-11 01:25:53 +0000
commit22470b5ee6298ed0fe8209563758ec171a1c4397 (patch)
tree31bfc5b24d910eb27d98d699448bba9e5bfd9e31 /voice_engine/voe_base_impl.cc
parentf3a2ef39a9ba3d382916bcfb67c952781ab91df3 (diff)
downloadwebrtc-22470b5ee6298ed0fe8209563758ec171a1c4397.tar.gz
Minor voice engine improvements around AGC.
- Remove one unneeded lock in CaptureLevel(), as the call to this method should always come on the same thread as PrepareDemux(). - Remove check on analog AGC before doing volume calculations. Saves a bit of code. Instead check if the incoming volume is set to zero, which is a potentially common occurrence as it indicates no volume is available. R=aluebs@webrtc.org, xians@webrtc.org Review URL: https://webrtc-codereview.appspot.com/6859004 git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@5366 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'voice_engine/voe_base_impl.cc')
-rw-r--r--voice_engine/voe_base_impl.cc15
1 files changed, 3 insertions, 12 deletions
diff --git a/voice_engine/voe_base_impl.cc b/voice_engine/voe_base_impl.cc
index 682a4a5a..94348638 100644
--- a/voice_engine/voe_base_impl.cc
+++ b/voice_engine/voe_base_impl.cc
@@ -1150,17 +1150,11 @@ int VoEBaseImpl::ProcessRecordedDataWithAPM(
assert(_shared->transmit_mixer() != NULL);
assert(_shared->audio_device() != NULL);
- bool is_analog_agc(false);
- if (_shared->audio_processing() &&
- _shared->audio_processing()->gain_control()->mode() ==
- GainControl::kAdaptiveAnalog) {
- is_analog_agc = true;
- }
-
- // Only deal with the volume in adaptive analog mode.
uint32_t max_volume = 0;
uint16_t current_voe_mic_level = 0;
- if (is_analog_agc) {
+ // Check for zero to skip this calculation; the consumer may use this to
+ // indicate no volume is available.
+ if (current_volume != 0) {
// Scale from ADM to VoE level range
if (_shared->audio_device()->MaxMicrophoneVolume(&max_volume) == 0) {
if (max_volume) {
@@ -1209,9 +1203,6 @@ int VoEBaseImpl::ProcessRecordedDataWithAPM(
number_of_voe_channels);
}
- if (!is_analog_agc)
- return 0;
-
// Scale from VoE to ADM level range.
uint32_t new_voe_mic_level = _shared->transmit_mixer()->CaptureLevel();