| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 // Close this synchronous writer. | 140 // Close this synchronous writer. |
| 141 virtual void Close() = 0; | 141 virtual void Close() = 0; |
| 142 }; | 142 }; |
| 143 | 143 |
| 144 // AudioInputController::Create() can use the currently registered Factory | 144 // AudioInputController::Create() can use the currently registered Factory |
| 145 // to create the AudioInputController. Factory is intended for testing only. | 145 // to create the AudioInputController. Factory is intended for testing only. |
| 146 // |user_input_monitor| is used for typing detection and can be NULL. | 146 // |user_input_monitor| is used for typing detection and can be NULL. |
| 147 class Factory { | 147 class Factory { |
| 148 public: | 148 public: |
| 149 virtual AudioInputController* Create( | 149 virtual AudioInputController* Create( |
| 150 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| 151 SyncWriter* sync_writer, |
| 150 AudioManager* audio_manager, | 152 AudioManager* audio_manager, |
| 151 EventHandler* event_handler, | 153 EventHandler* event_handler, |
| 152 AudioParameters params, | 154 AudioParameters params, |
| 153 UserInputMonitor* user_input_monitor) = 0; | 155 UserInputMonitor* user_input_monitor) = 0; |
| 154 | 156 |
| 155 protected: | 157 protected: |
| 156 virtual ~Factory() {} | 158 virtual ~Factory() {} |
| 157 }; | 159 }; |
| 158 | 160 |
| 159 // Factory method for creating an AudioInputController. | 161 // Factory method for creating an AudioInputController. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 // device-specific implementation. | 227 // device-specific implementation. |
| 226 void OnData(AudioInputStream* stream, | 228 void OnData(AudioInputStream* stream, |
| 227 const AudioBus* source, | 229 const AudioBus* source, |
| 228 uint32_t hardware_delay_bytes, | 230 uint32_t hardware_delay_bytes, |
| 229 double volume) override; | 231 double volume) override; |
| 230 void OnError(AudioInputStream* stream) override; | 232 void OnError(AudioInputStream* stream) override; |
| 231 | 233 |
| 232 bool SharedMemoryAndSyncSocketMode() const { return sync_writer_ != NULL; } | 234 bool SharedMemoryAndSyncSocketMode() const { return sync_writer_ != NULL; } |
| 233 | 235 |
| 234 // Enable debug recording of audio input. | 236 // Enable debug recording of audio input. |
| 235 void EnableDebugRecording(const base::FilePath& file_name); | 237 virtual void EnableDebugRecording(const base::FilePath& file_name); |
| 236 | 238 |
| 237 // Disable debug recording of audio input. | 239 // Disable debug recording of audio input. |
| 238 void DisableDebugRecording(); | 240 virtual void DisableDebugRecording(); |
| 239 | 241 |
| 240 protected: | 242 protected: |
| 241 friend class base::RefCountedThreadSafe<AudioInputController>; | 243 friend class base::RefCountedThreadSafe<AudioInputController>; |
| 242 | 244 |
| 243 // Used to log the result of capture startup. | 245 // Used to log the result of capture startup. |
| 244 // This was previously logged as a boolean with only the no callback and OK | 246 // This was previously logged as a boolean with only the no callback and OK |
| 245 // options. The enum order is kept to ensure backwards compatibility. | 247 // options. The enum order is kept to ensure backwards compatibility. |
| 246 // Elements in this enum should not be deleted or rearranged; the only | 248 // Elements in this enum should not be deleted or rearranged; the only |
| 247 // permitted operation is to add new elements before | 249 // permitted operation is to add new elements before |
| 248 // CAPTURE_STARTUP_RESULT_MAX and update CAPTURE_STARTUP_RESULT_MAX. | 250 // CAPTURE_STARTUP_RESULT_MAX and update CAPTURE_STARTUP_RESULT_MAX. |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 // Used for audio debug recordings. Accessed on audio thread. | 396 // Used for audio debug recordings. Accessed on audio thread. |
| 395 const std::unique_ptr<AudioInputWriter> debug_writer_; | 397 const std::unique_ptr<AudioInputWriter> debug_writer_; |
| 396 | 398 |
| 397 private: | 399 private: |
| 398 DISALLOW_COPY_AND_ASSIGN(AudioInputController); | 400 DISALLOW_COPY_AND_ASSIGN(AudioInputController); |
| 399 }; | 401 }; |
| 400 | 402 |
| 401 } // namespace media | 403 } // namespace media |
| 402 | 404 |
| 403 #endif // MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ | 405 #endif // MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ |
| OLD | NEW |