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

Unified Diff: media/audio/win/audio_low_latency_input_win.cc

Issue 15563004: Improved AGC update scheme for the audio backend in Chrome (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added Start/Stop APIs for the AGC part Created 7 years, 7 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
« no previous file with comments | « media/audio/win/audio_low_latency_input_win.h ('k') | media/media.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/win/audio_low_latency_input_win.cc
diff --git a/media/audio/win/audio_low_latency_input_win.cc b/media/audio/win/audio_low_latency_input_win.cc
index ae4c630f78245248afb09ac4fe748b69c184d7f2..a57a1cbd2eb6944d90695464dfc842f71b3274db 100644
--- a/media/audio/win/audio_low_latency_input_win.cc
+++ b/media/audio/win/audio_low_latency_input_win.cc
@@ -127,6 +127,10 @@ void WASAPIAudioInputStream::Start(AudioInputCallback* callback) {
sink_ = callback;
+ // Starts periodic AGC microphone measurements if the AGC has been enabled
+ // using SetAutomaticGainControl().
+ StartAgc();
+
// Create and start the thread that will drive the capturing by waiting for
// capture events.
capture_thread_ =
@@ -146,6 +150,9 @@ void WASAPIAudioInputStream::Stop() {
if (!started_)
return;
+ // Stops periodic AGC microphone measurements.
+ StopAgc();
+
// Shut down the capture thread.
if (stop_capture_event_.IsValid()) {
SetEvent(stop_capture_event_.Get());
@@ -387,10 +394,10 @@ void WASAPIAudioInputStream::Run() {
first_audio_frame_timestamp) / 10000.0) * ms_to_frame_count_ +
buffer_frame_index - num_frames_to_read;
- // Update the AGC volume level once every second. Note that,
- // |volume| is also updated each time SetVolume() is called
- // through IPC by the render-side AGC.
- QueryAgcVolume(&volume);
+ // Get a cached AGC volume level which is updated once every second
+ // on the audio manager thread. Note that, |volume| is also updated
+ // each time SetVolume() is called through IPC by the render-side AGC.
+ GetAgcVolume(&volume);
// Deliver captured data to the registered consumer using a packet
// size which was specified at construction.
« no previous file with comments | « media/audio/win/audio_low_latency_input_win.h ('k') | media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698