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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 // Sets the |renderer_|, returns false if |renderer_| already exists. | 298 // Sets the |renderer_|, returns false if |renderer_| already exists. |
299 // Called on the main renderer thread. | 299 // Called on the main renderer thread. |
300 bool SetAudioRenderer(WebRtcAudioRenderer* renderer); | 300 bool SetAudioRenderer(WebRtcAudioRenderer* renderer); |
301 | 301 |
302 // Adds/Removes the capturer to the ADM. | 302 // Adds/Removes the capturer to the ADM. |
303 // TODO(xians): Remove these two methods once the ADM does not need to pass | 303 // TODO(xians): Remove these two methods once the ADM does not need to pass |
304 // hardware information up to WebRtc. | 304 // hardware information up to WebRtc. |
305 void AddAudioCapturer(const scoped_refptr<WebRtcAudioCapturer>& capturer); | 305 void AddAudioCapturer(const scoped_refptr<WebRtcAudioCapturer>& capturer); |
306 void RemoveAudioCapturer(const scoped_refptr<WebRtcAudioCapturer>& capturer); | 306 void RemoveAudioCapturer(const scoped_refptr<WebRtcAudioCapturer>& capturer); |
307 | 307 |
| 308 // Gets the default capturer, which is the last capturer in |capturers_|. |
| 309 scoped_refptr<WebRtcAudioCapturer> GetDefaultCapturer() const; |
| 310 |
308 // Gets paired device information of the capture device for the audio | 311 // Gets paired device information of the capture device for the audio |
309 // renderer. This is used to pass on a session id, sample rate and buffer | 312 // renderer. This is used to pass on a session id, sample rate and buffer |
310 // size to a webrtc audio renderer (either local or remote), so that audio | 313 // size to a webrtc audio renderer (either local or remote), so that audio |
311 // will be rendered to a matching output device. | 314 // will be rendered to a matching output device. |
312 // Returns true if the capture device has a paired output device, otherwise | 315 // Returns true if the capture device has a paired output device, otherwise |
313 // false. Note that if there are more than one open capture device the | 316 // false. Note that if there are more than one open capture device the |
314 // function will not be able to pick an appropriate device and return false. | 317 // function will not be able to pick an appropriate device and return false. |
315 bool GetAuthorizedDeviceInfoForAudioRenderer( | 318 bool GetAuthorizedDeviceInfoForAudioRenderer( |
316 int* session_id, int* output_sample_rate, int* output_buffer_size); | 319 int* session_id, int* output_sample_rate, int* output_buffer_size); |
317 | 320 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 // Called on the AudioInputDevice worker thread. | 358 // Called on the AudioInputDevice worker thread. |
356 virtual void RenderData(uint8* audio_data, | 359 virtual void RenderData(uint8* audio_data, |
357 int number_of_channels, | 360 int number_of_channels, |
358 int number_of_frames, | 361 int number_of_frames, |
359 int audio_delay_milliseconds) OVERRIDE; | 362 int audio_delay_milliseconds) OVERRIDE; |
360 | 363 |
361 // Called on the main render thread. | 364 // Called on the main render thread. |
362 virtual void SetRenderFormat(const media::AudioParameters& params) OVERRIDE; | 365 virtual void SetRenderFormat(const media::AudioParameters& params) OVERRIDE; |
363 virtual void RemoveAudioRenderer(WebRtcAudioRenderer* renderer) OVERRIDE; | 366 virtual void RemoveAudioRenderer(WebRtcAudioRenderer* renderer) OVERRIDE; |
364 | 367 |
365 // Helper to get the default capturer, which is the last capturer in | |
366 // |capturers_|. | |
367 scoped_refptr<WebRtcAudioCapturer> GetDefaultCapturer() const; | |
368 | |
369 // Used to DCHECK that we are called on the correct thread. | 368 // Used to DCHECK that we are called on the correct thread. |
370 base::ThreadChecker thread_checker_; | 369 base::ThreadChecker thread_checker_; |
371 | 370 |
372 int ref_count_; | 371 int ref_count_; |
373 | 372 |
374 // List of captures which provides access to the native audio input layer | 373 // List of captures which provides access to the native audio input layer |
375 // in the browser process. | 374 // in the browser process. |
376 CapturerList capturers_; | 375 CapturerList capturers_; |
377 | 376 |
378 // Provides access to the audio renderer in the browser process. | 377 // Provides access to the audio renderer in the browser process. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 // Stores latest microphone volume received in a CaptureData() callback. | 410 // Stores latest microphone volume received in a CaptureData() callback. |
412 // Range is [0, 255]. | 411 // Range is [0, 255]. |
413 uint32_t microphone_volume_; | 412 uint32_t microphone_volume_; |
414 | 413 |
415 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioDeviceImpl); | 414 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioDeviceImpl); |
416 }; | 415 }; |
417 | 416 |
418 } // namespace content | 417 } // namespace content |
419 | 418 |
420 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ | 419 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ |
OLD | NEW |