OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ |
6 #define CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ | 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 }; | 203 }; |
204 | 204 |
205 class WebRtcAudioCapturerSink { | 205 class WebRtcAudioCapturerSink { |
206 public: | 206 public: |
207 // Callback to deliver the captured interleaved data. | 207 // Callback to deliver the captured interleaved data. |
208 // |channels| contains a vector of WebRtc VoE channels. | 208 // |channels| contains a vector of WebRtc VoE channels. |
209 // |audio_data| is the pointer to the audio data. | 209 // |audio_data| is the pointer to the audio data. |
210 // |sample_rate| is the sample frequency of audio data. | 210 // |sample_rate| is the sample frequency of audio data. |
211 // |number_of_channels| is the number of channels reflecting the order of | 211 // |number_of_channels| is the number of channels reflecting the order of |
212 // surround sound channels. | 212 // surround sound channels. |
213 // |audio_delay_milliseconds| is recording delay value. | 213 virtual void CaptureData(const std::vector<int>& channels, |
214 // |current_volume| is current microphone volume, in range of |0, 255]. | 214 const int16* audio_data, |
215 // |need_audio_processing| indicates if the audio needs WebRtc AEC/NS/AGC | 215 int sample_rate, |
216 // audio processing. | 216 int number_of_channels, |
217 // The return value is the new microphone volume, in the range of |0, 255]. | 217 int number_of_frames) = 0; |
218 // When the volume does not need to be updated, it returns 0. | |
219 virtual int CaptureData(const std::vector<int>& channels, | |
220 const int16* audio_data, | |
221 int sample_rate, | |
222 int number_of_channels, | |
223 int number_of_frames, | |
224 int audio_delay_milliseconds, | |
225 int current_volume, | |
226 bool need_audio_processing, | |
227 bool key_pressed) = 0; | |
228 | 218 |
229 // Set the format for the capture audio parameters. | 219 // Set the format for the capture audio parameters. |
230 virtual void SetCaptureFormat(const media::AudioParameters& params) = 0; | 220 virtual void SetCaptureFormat(const media::AudioParameters& params) = 0; |
231 | 221 |
232 protected: | 222 protected: |
233 virtual ~WebRtcAudioCapturerSink() {} | 223 virtual ~WebRtcAudioCapturerSink() {} |
234 }; | 224 }; |
235 | 225 |
236 // Note that this class inherits from webrtc::AudioDeviceModule but due to | 226 // Note that this class inherits from webrtc::AudioDeviceModule but due to |
237 // the high number of non-implemented methods, we move the cruft over to the | 227 // the high number of non-implemented methods, we move the cruft over to the |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 | 316 |
327 private: | 317 private: |
328 typedef std::list<scoped_refptr<WebRtcAudioCapturer> > CapturerList; | 318 typedef std::list<scoped_refptr<WebRtcAudioCapturer> > CapturerList; |
329 | 319 |
330 // Make destructor private to ensure that we can only be deleted by Release(). | 320 // Make destructor private to ensure that we can only be deleted by Release(). |
331 virtual ~WebRtcAudioDeviceImpl(); | 321 virtual ~WebRtcAudioDeviceImpl(); |
332 | 322 |
333 // WebRtcAudioCapturerSink implementation. | 323 // WebRtcAudioCapturerSink implementation. |
334 | 324 |
335 // Called on the AudioInputDevice worker thread. | 325 // Called on the AudioInputDevice worker thread. |
336 virtual int CaptureData(const std::vector<int>& channels, | 326 virtual void CaptureData(const std::vector<int>& channels, |
337 const int16* audio_data, | 327 const int16* audio_data, |
338 int sample_rate, | 328 int sample_rate, |
339 int number_of_channels, | 329 int number_of_channels, |
340 int number_of_frames, | 330 int number_of_frames) OVERRIDE; |
341 int audio_delay_milliseconds, | |
342 int current_volume, | |
343 bool need_audio_processing, | |
344 bool key_pressed) OVERRIDE; | |
345 | 331 |
346 // Called on the main render thread. | 332 // Called on the main render thread. |
347 virtual void SetCaptureFormat(const media::AudioParameters& params) OVERRIDE; | 333 virtual void SetCaptureFormat(const media::AudioParameters& params) OVERRIDE; |
348 | 334 |
349 // WebRtcAudioRendererSource implementation. | 335 // WebRtcAudioRendererSource implementation. |
350 | 336 |
351 // Called on the AudioInputDevice worker thread. | 337 // Called on the AudioInputDevice worker thread. |
352 virtual void RenderData(uint8* audio_data, | 338 virtual void RenderData(uint8* audio_data, |
353 int number_of_channels, | 339 int number_of_channels, |
354 int number_of_frames, | 340 int number_of_frames, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 // Stores latest microphone volume received in a CaptureData() callback. | 388 // Stores latest microphone volume received in a CaptureData() callback. |
403 // Range is [0, 255]. | 389 // Range is [0, 255]. |
404 uint32_t microphone_volume_; | 390 uint32_t microphone_volume_; |
405 | 391 |
406 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioDeviceImpl); | 392 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioDeviceImpl); |
407 }; | 393 }; |
408 | 394 |
409 } // namespace content | 395 } // namespace content |
410 | 396 |
411 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ | 397 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ |
OLD | NEW |