| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 // times out. Called on the audio thread. | 235 // times out. Called on the audio thread. |
| 236 void DoCheckForNoData(); | 236 void DoCheckForNoData(); |
| 237 | 237 |
| 238 // Helper method that stops, closes, and NULL:s |*stream_|. | 238 // Helper method that stops, closes, and NULL:s |*stream_|. |
| 239 // Signals event when done if the event is not NULL. | 239 // Signals event when done if the event is not NULL. |
| 240 void DoStopCloseAndClearStream(base::WaitableEvent* done); | 240 void DoStopCloseAndClearStream(base::WaitableEvent* done); |
| 241 | 241 |
| 242 void SetDataIsActive(bool enabled); | 242 void SetDataIsActive(bool enabled); |
| 243 bool GetDataIsActive(); | 243 bool GetDataIsActive(); |
| 244 | 244 |
| 245 // Gives access to the message loop of the creating thread. | 245 // Gives access to the task runner of the creating thread. |
| 246 scoped_refptr<base::MessageLoopProxy> creator_loop_; | 246 scoped_refptr<base::SingleThreadTaskRunner> creator_task_runner_; |
| 247 | 247 |
| 248 // The message loop of audio-manager thread that this object runs on. | 248 // The task runner of audio-manager thread that this object runs on. |
| 249 scoped_refptr<base::MessageLoopProxy> message_loop_; | 249 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 250 | 250 |
| 251 // Contains the AudioInputController::EventHandler which receives state | 251 // Contains the AudioInputController::EventHandler which receives state |
| 252 // notifications from this class. | 252 // notifications from this class. |
| 253 EventHandler* handler_; | 253 EventHandler* handler_; |
| 254 | 254 |
| 255 // Pointer to the audio input stream object. | 255 // Pointer to the audio input stream object. |
| 256 AudioInputStream* stream_; | 256 AudioInputStream* stream_; |
| 257 | 257 |
| 258 // |no_data_timer_| is used to call OnError() when we stop receiving | 258 // |no_data_timer_| is used to call OnError() when we stop receiving |
| 259 // OnData() calls without an OnClose() call. This can occur | 259 // OnData() calls without an OnClose() call. This can occur |
| (...skipping 25 matching lines...) Expand all Loading... |
| 285 UserInputMonitor* user_input_monitor_; | 285 UserInputMonitor* user_input_monitor_; |
| 286 | 286 |
| 287 size_t prev_key_down_count_; | 287 size_t prev_key_down_count_; |
| 288 | 288 |
| 289 DISALLOW_COPY_AND_ASSIGN(AudioInputController); | 289 DISALLOW_COPY_AND_ASSIGN(AudioInputController); |
| 290 }; | 290 }; |
| 291 | 291 |
| 292 } // namespace media | 292 } // namespace media |
| 293 | 293 |
| 294 #endif // MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ | 294 #endif // MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ |
| OLD | NEW |