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 // Low-latency audio capturing class utilizing audio input stream provided | 5 // Low-latency audio capturing class utilizing audio input stream provided |
6 // by a server (browser) process by use of an IPC interface. | 6 // by a server (browser) process by use of an IPC interface. |
7 // | 7 // |
8 // Relationship of classes: | 8 // Relationship of classes: |
9 // | 9 // |
10 // AudioInputController AudioInputDevice | 10 // AudioInputController AudioInputDevice |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 // This callback is triggered as a result of StartDevice(). | 103 // This callback is triggered as a result of StartDevice(). |
104 virtual void OnDeviceStarted(const std::string& device_id) = 0; | 104 virtual void OnDeviceStarted(const std::string& device_id) = 0; |
105 | 105 |
106 // Notification to the client that the device has been stopped. | 106 // Notification to the client that the device has been stopped. |
107 virtual void OnDeviceStopped() = 0; | 107 virtual void OnDeviceStopped() = 0; |
108 | 108 |
109 protected: | 109 protected: |
110 virtual ~CaptureEventHandler(); | 110 virtual ~CaptureEventHandler(); |
111 }; | 111 }; |
112 | 112 |
113 AudioInputDevice(AudioInputIPC* ipc, | 113 // Creates an uninitialized AudioInputDevice. Clients must call Initialize() |
| 114 // before using. |
| 115 AudioInputDevice(scoped_ptr<AudioInputIPC> ipc, |
114 const scoped_refptr<base::MessageLoopProxy>& io_loop); | 116 const scoped_refptr<base::MessageLoopProxy>& io_loop); |
115 | 117 |
116 // Initializes the AudioInputDevice. This method must be called before | 118 // Initializes the AudioInputDevice. This method must be called before |
117 // any other methods can be used. | 119 // any other methods can be used. |
118 void Initialize(const AudioParameters& params, | 120 void Initialize(const AudioParameters& params, |
119 CaptureCallback* callback, | 121 CaptureCallback* callback, |
120 CaptureEventHandler* event_handler); | 122 CaptureEventHandler* event_handler); |
121 | 123 |
122 // Specify the |session_id| to query which device to use. | 124 // Specify the |session_id| to query which device to use. |
123 // Start() will use the second sequence if this method is called before. | 125 // Start() will use the second sequence if this method is called before. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 171 |
170 // MessageLoop::DestructionObserver implementation for the IO loop. | 172 // MessageLoop::DestructionObserver implementation for the IO loop. |
171 // If the IO loop dies before we do, we shut down the audio thread from here. | 173 // If the IO loop dies before we do, we shut down the audio thread from here. |
172 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; | 174 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; |
173 | 175 |
174 AudioParameters audio_parameters_; | 176 AudioParameters audio_parameters_; |
175 | 177 |
176 CaptureCallback* callback_; | 178 CaptureCallback* callback_; |
177 CaptureEventHandler* event_handler_; | 179 CaptureEventHandler* event_handler_; |
178 | 180 |
179 AudioInputIPC* ipc_; | 181 scoped_ptr<AudioInputIPC> ipc_; |
180 | 182 |
181 // Our stream ID on the message filter. Only modified on the IO thread. | 183 // Our stream ID on the message filter. Only modified on the IO thread. |
182 int stream_id_; | 184 int stream_id_; |
183 | 185 |
184 // The media session ID used to identify which input device to be started. | 186 // The media session ID used to identify which input device to be started. |
185 // Only modified on the IO thread. | 187 // Only modified on the IO thread. |
186 int session_id_; | 188 int session_id_; |
187 | 189 |
188 // State variable used to indicate it is waiting for a OnDeviceReady() | 190 // State variable used to indicate it is waiting for a OnDeviceReady() |
189 // callback. Only modified on the IO thread. | 191 // callback. Only modified on the IO thread. |
(...skipping 11 matching lines...) Expand all Loading... |
201 base::Lock audio_thread_lock_; | 203 base::Lock audio_thread_lock_; |
202 AudioDeviceThread audio_thread_; | 204 AudioDeviceThread audio_thread_; |
203 scoped_ptr<AudioInputDevice::AudioThreadCallback> audio_callback_; | 205 scoped_ptr<AudioInputDevice::AudioThreadCallback> audio_callback_; |
204 | 206 |
205 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioInputDevice); | 207 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioInputDevice); |
206 }; | 208 }; |
207 | 209 |
208 } // namespace media | 210 } // namespace media |
209 | 211 |
210 #endif // MEDIA_AUDIO_AUDIO_INPUT_DEVICE_H_ | 212 #endif // MEDIA_AUDIO_AUDIO_INPUT_DEVICE_H_ |
OLD | NEW |