| OLD | NEW |
| 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" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 // External synchronous writer for audio controller. | 158 // External synchronous writer for audio controller. |
| 159 SyncWriter* sync_writer, | 159 SyncWriter* sync_writer, |
| 160 UserInputMonitor* user_input_monitor); | 160 UserInputMonitor* user_input_monitor); |
| 161 | 161 |
| 162 // Factory method for creating an AudioInputController for low-latency mode, | 162 // Factory method for creating an AudioInputController for low-latency mode, |
| 163 // taking ownership of |stream|. The stream will be opened on the audio | 163 // taking ownership of |stream|. The stream will be opened on the audio |
| 164 // thread, and when that is done, the event handler will receive an | 164 // thread, and when that is done, the event handler will receive an |
| 165 // OnCreated() call from that same thread. |user_input_monitor| is used for | 165 // OnCreated() call from that same thread. |user_input_monitor| is used for |
| 166 // typing detection and can be NULL. | 166 // typing detection and can be NULL. |
| 167 static scoped_refptr<AudioInputController> CreateForStream( | 167 static scoped_refptr<AudioInputController> CreateForStream( |
| 168 const scoped_refptr<base::MessageLoopProxy>& message_loop, | 168 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 169 EventHandler* event_handler, | 169 EventHandler* event_handler, |
| 170 AudioInputStream* stream, | 170 AudioInputStream* stream, |
| 171 // External synchronous writer for audio controller. | 171 // External synchronous writer for audio controller. |
| 172 SyncWriter* sync_writer, | 172 SyncWriter* sync_writer, |
| 173 UserInputMonitor* user_input_monitor); | 173 UserInputMonitor* user_input_monitor); |
| 174 | 174 |
| 175 // Starts recording using the created audio input stream. | 175 // Starts recording using the created audio input stream. |
| 176 // This method is called on the creator thread. | 176 // This method is called on the creator thread. |
| 177 virtual void Record(); | 177 virtual void Record(); |
| 178 | 178 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 // times out. Called on the audio thread. | 234 // times out. Called on the audio thread. |
| 235 void DoCheckForNoData(); | 235 void DoCheckForNoData(); |
| 236 | 236 |
| 237 // Helper method that stops, closes, and NULL:s |*stream_|. | 237 // Helper method that stops, closes, and NULL:s |*stream_|. |
| 238 // Signals event when done if the event is not NULL. | 238 // Signals event when done if the event is not NULL. |
| 239 void DoStopCloseAndClearStream(base::WaitableEvent* done); | 239 void DoStopCloseAndClearStream(base::WaitableEvent* done); |
| 240 | 240 |
| 241 void SetDataIsActive(bool enabled); | 241 void SetDataIsActive(bool enabled); |
| 242 bool GetDataIsActive(); | 242 bool GetDataIsActive(); |
| 243 | 243 |
| 244 // Gives access to the message loop of the creating thread. | 244 // Gives access to the task runner of the creating thread. |
| 245 scoped_refptr<base::MessageLoopProxy> creator_loop_; | 245 scoped_refptr<base::SingleThreadTaskRunner> creator_task_runner_; |
| 246 | 246 |
| 247 // The message loop of audio-manager thread that this object runs on. | 247 // The task runner of audio-manager thread that this object runs on. |
| 248 scoped_refptr<base::MessageLoopProxy> message_loop_; | 248 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 249 | 249 |
| 250 // Contains the AudioInputController::EventHandler which receives state | 250 // Contains the AudioInputController::EventHandler which receives state |
| 251 // notifications from this class. | 251 // notifications from this class. |
| 252 EventHandler* handler_; | 252 EventHandler* handler_; |
| 253 | 253 |
| 254 // Pointer to the audio input stream object. | 254 // Pointer to the audio input stream object. |
| 255 AudioInputStream* stream_; | 255 AudioInputStream* stream_; |
| 256 | 256 |
| 257 // |no_data_timer_| is used to call OnError() when we stop receiving | 257 // |no_data_timer_| is used to call OnError() when we stop receiving |
| 258 // OnData() calls. This can occur when an audio input device is unplugged | 258 // OnData() calls. This can occur when an audio input device is unplugged |
| (...skipping 25 matching lines...) Expand all Loading... |
| 284 UserInputMonitor* user_input_monitor_; | 284 UserInputMonitor* user_input_monitor_; |
| 285 | 285 |
| 286 size_t prev_key_down_count_; | 286 size_t prev_key_down_count_; |
| 287 | 287 |
| 288 DISALLOW_COPY_AND_ASSIGN(AudioInputController); | 288 DISALLOW_COPY_AND_ASSIGN(AudioInputController); |
| 289 }; | 289 }; |
| 290 | 290 |
| 291 } // namespace media | 291 } // namespace media |
| 292 | 292 |
| 293 #endif // MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ | 293 #endif // MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ |
| OLD | NEW |