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 unit utilizing audio input stream provided | 5 // Low-latency audio capturing unit utilizing audio input stream provided |
6 // by browser process through IPC. | 6 // by browser process through IPC. |
7 // | 7 // |
8 // Relationship of classes: | 8 // Relationship of classes: |
9 // | 9 // |
10 // AudioInputController AudioInputDevice | 10 // AudioInputController AudioInputDevice |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 virtual void OnDeviceStarted(const std::string& device_id) = 0; | 111 virtual void OnDeviceStarted(const std::string& device_id) = 0; |
112 | 112 |
113 // Notification to the client that the device has been stopped. | 113 // Notification to the client that the device has been stopped. |
114 virtual void OnDeviceStopped() = 0; | 114 virtual void OnDeviceStopped() = 0; |
115 | 115 |
116 protected: | 116 protected: |
117 virtual ~CaptureEventHandler() {} | 117 virtual ~CaptureEventHandler() {} |
118 }; | 118 }; |
119 | 119 |
120 // Methods called on main render thread ------------------------------------- | 120 // Methods called on main render thread ------------------------------------- |
121 AudioInputDevice(const AudioParameters& params, CaptureCallback* callback, | 121 AudioInputDevice(const media::AudioParameters& params, |
| 122 CaptureCallback* callback, |
122 CaptureEventHandler* event_handler); | 123 CaptureEventHandler* event_handler); |
123 virtual ~AudioInputDevice(); | 124 virtual ~AudioInputDevice(); |
124 | 125 |
125 // Specify the |session_id| to query which device to use. This method is | 126 // Specify the |session_id| to query which device to use. This method is |
126 // asynchronous/non-blocking. | 127 // asynchronous/non-blocking. |
127 // Start() will use the second sequence if this method is called before. | 128 // Start() will use the second sequence if this method is called before. |
128 void SetDevice(int session_id); | 129 void SetDevice(int session_id); |
129 | 130 |
130 // Starts audio capturing. This method is asynchronous/non-blocking. | 131 // Starts audio capturing. This method is asynchronous/non-blocking. |
131 // TODO(henrika): add support for notification when recording has started. | 132 // TODO(henrika): add support for notification when recording has started. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 void SetVolumeOnIOThread(double volume); | 178 void SetVolumeOnIOThread(double volume); |
178 void SetAutomaticGainControlOnIOThread(bool enabled); | 179 void SetAutomaticGainControlOnIOThread(bool enabled); |
179 | 180 |
180 void Send(IPC::Message* message); | 181 void Send(IPC::Message* message); |
181 | 182 |
182 // MessageLoop::DestructionObserver implementation for the IO loop. | 183 // MessageLoop::DestructionObserver implementation for the IO loop. |
183 // If the IO loop dies before we do, we shut down the audio thread from here. | 184 // If the IO loop dies before we do, we shut down the audio thread from here. |
184 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; | 185 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; |
185 | 186 |
186 // Format | 187 // Format |
187 AudioParameters audio_parameters_; | 188 media::AudioParameters audio_parameters_; |
188 | 189 |
189 CaptureCallback* callback_; | 190 CaptureCallback* callback_; |
190 CaptureEventHandler* event_handler_; | 191 CaptureEventHandler* event_handler_; |
191 | 192 |
192 // The current volume scaling [0.0, 1.0] of the audio stream. | 193 // The current volume scaling [0.0, 1.0] of the audio stream. |
193 double volume_; | 194 double volume_; |
194 | 195 |
195 // Cached audio input message filter (lives on the main render thread). | 196 // Cached audio input message filter (lives on the main render thread). |
196 scoped_refptr<AudioInputMessageFilter> filter_; | 197 scoped_refptr<AudioInputMessageFilter> filter_; |
197 | 198 |
(...skipping 18 matching lines...) Expand all Loading... |
216 // In order to avoid a race between OnStreamCreated and Stop(), we use this | 217 // In order to avoid a race between OnStreamCreated and Stop(), we use this |
217 // guard to control stopping and starting the audio thread. | 218 // guard to control stopping and starting the audio thread. |
218 base::Lock audio_thread_lock_; | 219 base::Lock audio_thread_lock_; |
219 AudioDeviceThread audio_thread_; | 220 AudioDeviceThread audio_thread_; |
220 scoped_ptr<AudioInputDevice::AudioThreadCallback> audio_callback_; | 221 scoped_ptr<AudioInputDevice::AudioThreadCallback> audio_callback_; |
221 | 222 |
222 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioInputDevice); | 223 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioInputDevice); |
223 }; | 224 }; |
224 | 225 |
225 #endif // CONTENT_RENDERER_MEDIA_AUDIO_INPUT_DEVICE_H_ | 226 #endif // CONTENT_RENDERER_MEDIA_AUDIO_INPUT_DEVICE_H_ |
OLD | NEW |