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

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

Issue 287873004: Adds volume level measurements to the AudioInputController for low-latency clients (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: refactored Created 6 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 unified diff | Download patch | Annotate | Revision Log
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_AUDIO_INPUT_CONTROLLER_H_ 5 #ifndef MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_
6 #define MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ 6 #define MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_
7 7
8 #include <string> 8 #include <string>
9 #include "base/atomicops.h" 9 #include "base/atomicops.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/synchronization/lock.h" 13 #include "base/synchronization/lock.h"
14 #include "base/synchronization/waitable_event.h" 14 #include "base/synchronization/waitable_event.h"
15 #include "base/threading/thread.h" 15 #include "base/threading/thread.h"
16 #include "base/timer/timer.h" 16 #include "base/timer/timer.h"
17 #include "media/audio/audio_io.h" 17 #include "media/audio/audio_io.h"
18 #include "media/audio/audio_manager_base.h" 18 #include "media/audio/audio_manager_base.h"
19 #include "media/audio/audio_parameters.h"
20 #include "media/audio/audio_power_monitor.h"
21 #include "media/base/audio_bus.h"
19 22
20 // An AudioInputController controls an AudioInputStream and records data 23 // An AudioInputController controls an AudioInputStream and records data
21 // from this input stream. The two main methods are Record() and Close() and 24 // from this input stream. The two main methods are Record() and Close() and
22 // they are both executed on the audio thread which is injected by the two 25 // they are both executed on the audio thread which is injected by the two
23 // alternative factory methods, Create() or CreateLowLatency(). 26 // alternative factory methods, Create() or CreateLowLatency().
24 // 27 //
25 // All public methods of AudioInputController are non-blocking. 28 // All public methods of AudioInputController are non-blocking.
26 // 29 //
27 // Here is a state diagram for the AudioInputController: 30 // Here is a state diagram for the AudioInputController:
28 // 31 //
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 305
303 // SyncWriter is used only in low-latency mode for synchronous writing. 306 // SyncWriter is used only in low-latency mode for synchronous writing.
304 SyncWriter* sync_writer_; 307 SyncWriter* sync_writer_;
305 308
306 static Factory* factory_; 309 static Factory* factory_;
307 310
308 double max_volume_; 311 double max_volume_;
309 312
310 UserInputMonitor* user_input_monitor_; 313 UserInputMonitor* user_input_monitor_;
311 314
315 // Scans audio samples from OnData() as input to compute audio levels.
316 scoped_ptr<AudioPowerMonitor> audio_level_;
317
318 scoped_ptr<AudioBus> audio_bus_;
319 base::TimeTicks last_audio_level_log_time_;
320 media::AudioParameters audio_params_;
321
312 size_t prev_key_down_count_; 322 size_t prev_key_down_count_;
313 323
314 DISALLOW_COPY_AND_ASSIGN(AudioInputController); 324 DISALLOW_COPY_AND_ASSIGN(AudioInputController);
315 }; 325 };
316 326
317 } // namespace media 327 } // namespace media
318 328
319 #endif // MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ 329 #endif // MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | media/audio/audio_input_controller.cc » ('j') | media/audio/audio_input_controller.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698