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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 virtual void OnDeviceStarted(const std::string& device_id) = 0; | 109 virtual void OnDeviceStarted(const std::string& device_id) = 0; |
110 | 110 |
111 // Notification to the client that the device has been stopped. | 111 // Notification to the client that the device has been stopped. |
112 virtual void OnDeviceStopped() = 0; | 112 virtual void OnDeviceStopped() = 0; |
113 | 113 |
114 protected: | 114 protected: |
115 virtual ~CaptureEventHandler() {} | 115 virtual ~CaptureEventHandler() {} |
116 }; | 116 }; |
117 | 117 |
118 // Methods called on main render thread ------------------------------------- | 118 // Methods called on main render thread ------------------------------------- |
119 AudioInputDevice(const AudioParameters& params, CaptureCallback* callback, | 119 AudioInputDevice(const media::AudioParameters& params, |
| 120 CaptureCallback* callback, |
120 CaptureEventHandler* event_handler); | 121 CaptureEventHandler* event_handler); |
121 virtual ~AudioInputDevice(); | 122 virtual ~AudioInputDevice(); |
122 | 123 |
123 // Specify the |session_id| to query which device to use. This method is | 124 // Specify the |session_id| to query which device to use. This method is |
124 // asynchronous/non-blocking. | 125 // asynchronous/non-blocking. |
125 // Start() will use the second sequence if this method is called before. | 126 // Start() will use the second sequence if this method is called before. |
126 void SetDevice(int session_id); | 127 void SetDevice(int session_id); |
127 | 128 |
128 // Starts audio capturing. This method is asynchronous/non-blocking. | 129 // Starts audio capturing. This method is asynchronous/non-blocking. |
129 // TODO(henrika): add support for notification when recording has started. | 130 // TODO(henrika): add support for notification when recording has started. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 void ShutDownOnIOThread(); | 170 void ShutDownOnIOThread(); |
170 void SetVolumeOnIOThread(double volume); | 171 void SetVolumeOnIOThread(double volume); |
171 | 172 |
172 void Send(IPC::Message* message); | 173 void Send(IPC::Message* message); |
173 | 174 |
174 // MessageLoop::DestructionObserver implementation for the IO loop. | 175 // MessageLoop::DestructionObserver implementation for the IO loop. |
175 // If the IO loop dies before we do, we shut down the audio thread from here. | 176 // If the IO loop dies before we do, we shut down the audio thread from here. |
176 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; | 177 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; |
177 | 178 |
178 // Format | 179 // Format |
179 AudioParameters audio_parameters_; | 180 media::AudioParameters audio_parameters_; |
180 | 181 |
181 CaptureCallback* callback_; | 182 CaptureCallback* callback_; |
182 CaptureEventHandler* event_handler_; | 183 CaptureEventHandler* event_handler_; |
183 | 184 |
184 // The current volume scaling [0.0, 1.0] of the audio stream. | 185 // The current volume scaling [0.0, 1.0] of the audio stream. |
185 double volume_; | 186 double volume_; |
186 | 187 |
187 // Cached audio input message filter (lives on the main render thread). | 188 // Cached audio input message filter (lives on the main render thread). |
188 scoped_refptr<AudioInputMessageFilter> filter_; | 189 scoped_refptr<AudioInputMessageFilter> filter_; |
189 | 190 |
(...skipping 14 matching lines...) Expand all Loading... |
204 // In order to avoid a race between OnStreamCreated and Stop(), we use this | 205 // In order to avoid a race between OnStreamCreated and Stop(), we use this |
205 // guard to control stopping and starting the audio thread. | 206 // guard to control stopping and starting the audio thread. |
206 base::Lock audio_thread_lock_; | 207 base::Lock audio_thread_lock_; |
207 AudioDeviceThread audio_thread_; | 208 AudioDeviceThread audio_thread_; |
208 scoped_ptr<AudioInputDevice::AudioThreadCallback> audio_callback_; | 209 scoped_ptr<AudioInputDevice::AudioThreadCallback> audio_callback_; |
209 | 210 |
210 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioInputDevice); | 211 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioInputDevice); |
211 }; | 212 }; |
212 | 213 |
213 #endif // CONTENT_RENDERER_MEDIA_AUDIO_INPUT_DEVICE_H_ | 214 #endif // CONTENT_RENDERER_MEDIA_AUDIO_INPUT_DEVICE_H_ |
OLD | NEW |