| 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 virtual int32_t StereoRecordingIsAvailable(bool* available) const OVERRIDE; | 292 virtual int32_t StereoRecordingIsAvailable(bool* available) const OVERRIDE; |
| 293 virtual int32_t PlayoutDelay(uint16_t* delay_ms) const OVERRIDE; | 293 virtual int32_t PlayoutDelay(uint16_t* delay_ms) const OVERRIDE; |
| 294 virtual int32_t RecordingDelay(uint16_t* delay_ms) const OVERRIDE; | 294 virtual int32_t RecordingDelay(uint16_t* delay_ms) const OVERRIDE; |
| 295 virtual int32_t RecordingSampleRate(uint32_t* samples_per_sec) const OVERRIDE; | 295 virtual int32_t RecordingSampleRate(uint32_t* samples_per_sec) const OVERRIDE; |
| 296 virtual int32_t PlayoutSampleRate(uint32_t* samples_per_sec) const OVERRIDE; | 296 virtual int32_t PlayoutSampleRate(uint32_t* samples_per_sec) const OVERRIDE; |
| 297 | 297 |
| 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 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 |
| 304 // hardware information up to WebRtc. |
| 303 void AddAudioCapturer(const scoped_refptr<WebRtcAudioCapturer>& capturer); | 305 void AddAudioCapturer(const scoped_refptr<WebRtcAudioCapturer>& capturer); |
| 304 | 306 void RemoveAudioCapturer(const scoped_refptr<WebRtcAudioCapturer>& capturer); |
| 305 // Gets the default capturer, which is the capturer in the list with | |
| 306 // a valid |device_id|. Microphones are represented by capturers with a valid | |
| 307 // |device_id|, since only one microphone is supported today, only one | |
| 308 // capturer in the |capturers_| can have a valid |device_id|. | |
| 309 scoped_refptr<WebRtcAudioCapturer> GetDefaultCapturer() const; | |
| 310 | 307 |
| 311 const scoped_refptr<WebRtcAudioRenderer>& renderer() const { | 308 const scoped_refptr<WebRtcAudioRenderer>& renderer() const { |
| 312 return renderer_; | 309 return renderer_; |
| 313 } | 310 } |
| 314 int output_buffer_size() const { | 311 int output_buffer_size() const { |
| 315 return output_audio_parameters_.frames_per_buffer(); | 312 return output_audio_parameters_.frames_per_buffer(); |
| 316 } | 313 } |
| 317 int output_channels() const { | 314 int output_channels() const { |
| 318 return output_audio_parameters_.channels(); | 315 return output_audio_parameters_.channels(); |
| 319 } | 316 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 348 // Called on the AudioInputDevice worker thread. | 345 // Called on the AudioInputDevice worker thread. |
| 349 virtual void RenderData(uint8* audio_data, | 346 virtual void RenderData(uint8* audio_data, |
| 350 int number_of_channels, | 347 int number_of_channels, |
| 351 int number_of_frames, | 348 int number_of_frames, |
| 352 int audio_delay_milliseconds) OVERRIDE; | 349 int audio_delay_milliseconds) OVERRIDE; |
| 353 | 350 |
| 354 // Called on the main render thread. | 351 // Called on the main render thread. |
| 355 virtual void SetRenderFormat(const media::AudioParameters& params) OVERRIDE; | 352 virtual void SetRenderFormat(const media::AudioParameters& params) OVERRIDE; |
| 356 virtual void RemoveAudioRenderer(WebRtcAudioRenderer* renderer) OVERRIDE; | 353 virtual void RemoveAudioRenderer(WebRtcAudioRenderer* renderer) OVERRIDE; |
| 357 | 354 |
| 355 // Helper to get the default capturer, which is the capturer in the list with |
| 356 // a valid |device_id|. |
| 357 scoped_refptr<WebRtcAudioCapturer> GetDefaultCapturer() const; |
| 358 |
| 358 // Used to DCHECK that we are called on the correct thread. | 359 // Used to DCHECK that we are called on the correct thread. |
| 359 base::ThreadChecker thread_checker_; | 360 base::ThreadChecker thread_checker_; |
| 360 | 361 |
| 361 int ref_count_; | 362 int ref_count_; |
| 362 | 363 |
| 363 // List of captures which provides access to the native audio input layer | 364 // List of captures which provides access to the native audio input layer |
| 364 // in the browser process. | 365 // in the browser process. |
| 365 CapturerList capturers_; | 366 CapturerList capturers_; |
| 366 | 367 |
| 367 // Provides access to the audio renderer in the browser process. | 368 // Provides access to the audio renderer in the browser process. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 // Stores latest microphone volume received in a CaptureData() callback. | 401 // Stores latest microphone volume received in a CaptureData() callback. |
| 401 // Range is [0, 255]. | 402 // Range is [0, 255]. |
| 402 uint32_t microphone_volume_; | 403 uint32_t microphone_volume_; |
| 403 | 404 |
| 404 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioDeviceImpl); | 405 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioDeviceImpl); |
| 405 }; | 406 }; |
| 406 | 407 |
| 407 } // namespace content | 408 } // namespace content |
| 408 | 409 |
| 409 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ | 410 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ |
| OLD | NEW |