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

Side by Side Diff: media/audio/agc_audio_stream.h

Issue 1355063004: Template methods on Timer classes instead of the classes themselves. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: timer: fixcaller Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « jingle/notifier/communicator/login.h ('k') | media/audio/audio_output_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_AUDIO_AGC_AUDIO_STREAM_H_ 5 #ifndef MEDIA_AUDIO_AGC_AUDIO_STREAM_H_
6 #define MEDIA_AUDIO_AGC_AUDIO_STREAM_H_ 6 #define MEDIA_AUDIO_AGC_AUDIO_STREAM_H_
7 7
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 base::AutoLock auto_lock(lock_); 173 base::AutoLock auto_lock(lock_);
174 normalized_volume_ = normalized_volume; 174 normalized_volume_ = normalized_volume;
175 } 175 }
176 } 176 }
177 177
178 // Ensures that this class is created and destroyed on the same thread. 178 // Ensures that this class is created and destroyed on the same thread.
179 base::ThreadChecker thread_checker_; 179 base::ThreadChecker thread_checker_;
180 180
181 // Repeating timer which cancels itself when it goes out of scope. 181 // Repeating timer which cancels itself when it goes out of scope.
182 // Used to check the microphone volume periodically. 182 // Used to check the microphone volume periodically.
183 base::RepeatingTimer<AgcAudioStream<AudioInterface> > timer_; 183 base::RepeatingTimer timer_;
184 184
185 // True when automatic gain control is enabled, false otherwise. 185 // True when automatic gain control is enabled, false otherwise.
186 bool agc_is_enabled_; 186 bool agc_is_enabled_;
187 187
188 // Stores the maximum volume which is used for normalization to a volume 188 // Stores the maximum volume which is used for normalization to a volume
189 // range of [0.0, 1.0]. 189 // range of [0.0, 1.0].
190 double max_volume_; 190 double max_volume_;
191 191
192 // Contains last result of internal call to GetVolume(). We save resources 192 // Contains last result of internal call to GetVolume(). We save resources
193 // by not querying the capture volume for each callback. Guarded by |lock_|. 193 // by not querying the capture volume for each callback. Guarded by |lock_|.
194 // The range is normalized to [0.0, 1.0]. 194 // The range is normalized to [0.0, 1.0].
195 double normalized_volume_; 195 double normalized_volume_;
196 196
197 // Protects |normalized_volume_| . 197 // Protects |normalized_volume_| .
198 base::Lock lock_; 198 base::Lock lock_;
199 199
200 DISALLOW_COPY_AND_ASSIGN(AgcAudioStream<AudioInterface>); 200 DISALLOW_COPY_AND_ASSIGN(AgcAudioStream<AudioInterface>);
201 }; 201 };
202 202
203 } // namespace media 203 } // namespace media
204 204
205 #endif // MEDIA_AUDIO_AGC_AUDIO_STREAM_H_ 205 #endif // MEDIA_AUDIO_AGC_AUDIO_STREAM_H_
OLDNEW
« no previous file with comments | « jingle/notifier/communicator/login.h ('k') | media/audio/audio_output_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698