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

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

Issue 2620373005: Rename AudioInputWriter -> AudioFileWriter. (Closed)
Patch Set: Created 3 years, 11 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 | « media/audio/audio_file_writer.h ('k') | media/audio/audio_input_controller.cc » ('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_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 <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 // audio thread, the controller must not add or release references to the 74 // audio thread, the controller must not add or release references to the
75 // AudioManager or itself (since it in turn holds a reference to the manager). 75 // AudioManager or itself (since it in turn holds a reference to the manager).
76 // 76 //
77 namespace media { 77 namespace media {
78 78
79 // Only do power monitoring for non-mobile platforms to save resources. 79 // Only do power monitoring for non-mobile platforms to save resources.
80 #if !defined(OS_ANDROID) && !defined(OS_IOS) 80 #if !defined(OS_ANDROID) && !defined(OS_IOS)
81 #define AUDIO_POWER_MONITORING 81 #define AUDIO_POWER_MONITORING
82 #endif 82 #endif
83 83
84 class AudioInputWriter; 84 class AudioFileWriter;
85 class UserInputMonitor; 85 class UserInputMonitor;
86 86
87 class MEDIA_EXPORT AudioInputController 87 class MEDIA_EXPORT AudioInputController
88 : public base::RefCountedThreadSafe<AudioInputController>, 88 : public base::RefCountedThreadSafe<AudioInputController>,
89 public AudioInputStream::AudioInputCallback { 89 public AudioInputStream::AudioInputCallback {
90 public: 90 public:
91 // Error codes to make native logging more clear. These error codes are added 91 // Error codes to make native logging more clear. These error codes are added
92 // to generic error strings to provide a higher degree of details. 92 // to generic error strings to provide a higher degree of details.
93 // Changing these values can lead to problems when matching native debug 93 // Changing these values can lead to problems when matching native debug
94 // logs with the actual cause of error. 94 // logs with the actual cause of error.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // The audio device will be created on the audio thread, and when that is 178 // The audio device will be created on the audio thread, and when that is
179 // done, the event handler will receive an OnCreated() call from that same 179 // done, the event handler will receive an OnCreated() call from that same
180 // thread. |user_input_monitor| is used for typing detection and can be NULL. 180 // thread. |user_input_monitor| is used for typing detection and can be NULL.
181 static scoped_refptr<AudioInputController> CreateLowLatency( 181 static scoped_refptr<AudioInputController> CreateLowLatency(
182 AudioManager* audio_manager, 182 AudioManager* audio_manager,
183 EventHandler* event_handler, 183 EventHandler* event_handler,
184 const AudioParameters& params, 184 const AudioParameters& params,
185 const std::string& device_id, 185 const std::string& device_id,
186 // External synchronous writer for audio controller. 186 // External synchronous writer for audio controller.
187 SyncWriter* sync_writer, 187 SyncWriter* sync_writer,
188 std::unique_ptr<AudioInputWriter> debug_writer, 188 std::unique_ptr<AudioFileWriter> debug_writer,
189 UserInputMonitor* user_input_monitor, 189 UserInputMonitor* user_input_monitor,
190 const bool agc_is_enabled); 190 const bool agc_is_enabled);
191 191
192 // Factory method for creating an AudioInputController with an existing 192 // Factory method for creating an AudioInputController with an existing
193 // |stream| for low-latency mode, taking ownership of |stream|. The stream 193 // |stream| for low-latency mode, taking ownership of |stream|. The stream
194 // will be opened on the audio thread, and when that is done, the event 194 // will be opened on the audio thread, and when that is done, the event
195 // handler will receive an OnCreated() call from that same thread. 195 // handler will receive an OnCreated() call from that same thread.
196 // |user_input_monitor| is used for typing detection and can be NULL. 196 // |user_input_monitor| is used for typing detection and can be NULL.
197 static scoped_refptr<AudioInputController> CreateForStream( 197 static scoped_refptr<AudioInputController> CreateForStream(
198 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 198 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
199 EventHandler* event_handler, 199 EventHandler* event_handler,
200 AudioInputStream* stream, 200 AudioInputStream* stream,
201 // External synchronous writer for audio controller. 201 // External synchronous writer for audio controller.
202 SyncWriter* sync_writer, 202 SyncWriter* sync_writer,
203 std::unique_ptr<AudioInputWriter> debug_writer, 203 std::unique_ptr<AudioFileWriter> debug_writer,
204 UserInputMonitor* user_input_monitor); 204 UserInputMonitor* user_input_monitor);
205 205
206 // Starts recording using the created audio input stream. 206 // Starts recording using the created audio input stream.
207 // This method is called on the creator thread. 207 // This method is called on the creator thread.
208 virtual void Record(); 208 virtual void Record();
209 209
210 // Closes the audio input stream. The state is changed and the resources 210 // Closes the audio input stream. The state is changed and the resources
211 // are freed on the audio thread. |closed_task| is then executed on the thread 211 // are freed on the audio thread. |closed_task| is then executed on the thread
212 // that called Close(). 212 // that called Close().
213 // Callbacks (EventHandler and SyncWriter) must exist until |closed_task| 213 // Callbacks (EventHandler and SyncWriter) must exist until |closed_task|
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 SILENCE_STATE_NO_MEASUREMENT = 0, 282 SILENCE_STATE_NO_MEASUREMENT = 0,
283 SILENCE_STATE_ONLY_AUDIO = 1, 283 SILENCE_STATE_ONLY_AUDIO = 1,
284 SILENCE_STATE_ONLY_SILENCE = 2, 284 SILENCE_STATE_ONLY_SILENCE = 2,
285 SILENCE_STATE_AUDIO_AND_SILENCE = 3, 285 SILENCE_STATE_AUDIO_AND_SILENCE = 3,
286 SILENCE_STATE_MAX = SILENCE_STATE_AUDIO_AND_SILENCE 286 SILENCE_STATE_MAX = SILENCE_STATE_AUDIO_AND_SILENCE
287 }; 287 };
288 #endif 288 #endif
289 289
290 AudioInputController(EventHandler* handler, 290 AudioInputController(EventHandler* handler,
291 SyncWriter* sync_writer, 291 SyncWriter* sync_writer,
292 std::unique_ptr<AudioInputWriter> debug_writer, 292 std::unique_ptr<AudioFileWriter> debug_writer,
293 UserInputMonitor* user_input_monitor, 293 UserInputMonitor* user_input_monitor,
294 const bool agc_is_enabled); 294 const bool agc_is_enabled);
295 ~AudioInputController() override; 295 ~AudioInputController() override;
296 296
297 // Methods called on the audio thread (owned by the AudioManager). 297 // Methods called on the audio thread (owned by the AudioManager).
298 void DoCreate(AudioManager* audio_manager, 298 void DoCreate(AudioManager* audio_manager,
299 const AudioParameters& params, 299 const AudioParameters& params,
300 const std::string& device_id); 300 const std::string& device_id);
301 void DoCreateForLowLatency(AudioManager* audio_manager, 301 void DoCreateForLowLatency(AudioManager* audio_manager,
302 const AudioParameters& params, 302 const AudioParameters& params,
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 // The silence report sent as UMA stat at the end of a session. 385 // The silence report sent as UMA stat at the end of a session.
386 SilenceState silence_state_; 386 SilenceState silence_state_;
387 #endif 387 #endif
388 388
389 size_t prev_key_down_count_; 389 size_t prev_key_down_count_;
390 390
391 // Time when a low-latency stream is created. 391 // Time when a low-latency stream is created.
392 base::TimeTicks low_latency_create_time_; 392 base::TimeTicks low_latency_create_time_;
393 393
394 // Used for audio debug recordings. Accessed on audio thread. 394 // Used for audio debug recordings. Accessed on audio thread.
395 const std::unique_ptr<AudioInputWriter> debug_writer_; 395 const std::unique_ptr<AudioFileWriter> debug_writer_;
396 396
397 private: 397 private:
398 DISALLOW_COPY_AND_ASSIGN(AudioInputController); 398 DISALLOW_COPY_AND_ASSIGN(AudioInputController);
399 }; 399 };
400 400
401 } // namespace media 401 } // namespace media
402 402
403 #endif // MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ 403 #endif // MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_
OLDNEW
« no previous file with comments | « media/audio/audio_file_writer.h ('k') | media/audio/audio_input_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698