Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1261)

Unified Diff: content/renderer/media/webrtc_audio_device_impl.h

Issue 9702019: Adds Analog Gain Control (AGC) to the WebRTC client. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Improved AGC comments Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/webrtc_audio_device_impl.h
diff --git a/content/renderer/media/webrtc_audio_device_impl.h b/content/renderer/media/webrtc_audio_device_impl.h
index 4c43498a3903c6f6561e43b1cd0bd5f632f2be75..baff6409aaa73f1b4dbf88b3270864810477f03c 100644
--- a/content/renderer/media/webrtc_audio_device_impl.h
+++ b/content/renderer/media/webrtc_audio_device_impl.h
@@ -91,7 +91,24 @@
//
// - This class must be created on the main render thread.
// - The webrtc::AudioDeviceModule is reference counted.
-// - Recording is currently not supported on Mac OS X.
+// - Regarding the AGC: It aims at maintaining the same speech loudness level
tommi (sloooow) - chröme 2012/03/26 15:26:40 s/It aims at maintaining/It aims to maintain It's
henrika (OOO until Aug 14) 2012/03/27 09:20:38 Modified to "It aims to maintain a constant speech
+// from the microphone. This is done by both controlling the analog
+// microphone gain and applying a digital gain. The microphone gain on the
tommi (sloooow) - chröme 2012/03/26 15:26:40 s/a digital gain/digital gain
henrika (OOO until Aug 14) 2012/03/27 09:20:38 Done.
+// sound card is slowly increased/decreased during speech only. By observing
+// the microphone control slider you can see it move when you speak. If you
+// scream, the slider moves downwards and then upwards again when you return
+// to normal. It is not uncommon that the slider hits the maximum. This
+// means that the maximum analog gain is not large enough to give the
+// desired loudness. Nevertheless, we can in general still attain the
+// desired loudness. If the microphone control slider is moved manually,
+// the analog adaptation restarts and returns to roughly the same position
tommi (sloooow) - chröme 2012/03/26 15:26:40 s/analog adaptation/gain adaptation.
henrika (OOO until Aug 14) 2012/03/27 09:20:38 Actually, it is only the analog part that restarts
+// as before the change if the circumstances are still the same. When the
+// input microphone signal causes saturation, the level is decreased
+// dramatically and has to re-adapt towards the old level. The adaptation
+// is a slowly varying process and at the beginning of a call this is
tommi (sloooow) - chröme 2012/03/26 15:26:40 s/beginning of a call/beginning of capture (there
henrika (OOO until Aug 14) 2012/03/27 09:20:38 Done.
+// noticed by a slow increase in volume. Smaller changes in microphone input
+// level is leveled out by the built-in digital control. For larger
+// differences we need to rely on the slow adaptation.
//
class CONTENT_EXPORT WebRtcAudioDeviceImpl
: NON_EXPORTED_BASE(public webrtc::AudioDeviceModule),
@@ -120,7 +137,8 @@ class CONTENT_EXPORT WebRtcAudioDeviceImpl
// AudioInputDevice::CaptureCallback implementation.
virtual void Capture(const std::vector<float*>& audio_data,
size_t number_of_frames,
- size_t audio_delay_milliseconds) OVERRIDE;
+ size_t audio_delay_milliseconds,
+ double volume) OVERRIDE;
virtual void OnCaptureError() OVERRIDE;
// AudioInputDevice::CaptureEventHandler implementation.
@@ -258,7 +276,7 @@ class CONTENT_EXPORT WebRtcAudioDeviceImpl
return input_audio_parameters_.frames_per_buffer();
}
size_t output_buffer_size() const {
- return input_audio_parameters_.frames_per_buffer();
+ return output_audio_parameters_.frames_per_buffer();
}
int input_channels() const {
return input_audio_parameters_.channels();
@@ -336,6 +354,9 @@ class CONTENT_EXPORT WebRtcAudioDeviceImpl
bool playing_;
bool recording_;
+ // Local copy of the current Automatic Gain Control state.
+ bool agc_is_enabled_;
+
DISALLOW_COPY_AND_ASSIGN(WebRtcAudioDeviceImpl);
};

Powered by Google App Engine
This is Rietveld 408576698