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