| 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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 // Returns true if the capture device has a paired output device, otherwise | 346 // Returns true if the capture device has a paired output device, otherwise |
| 347 // false. Note that if there are more than one open capture device the | 347 // false. Note that if there are more than one open capture device the |
| 348 // function will not be able to pick an appropriate device and return false. | 348 // function will not be able to pick an appropriate device and return false. |
| 349 bool GetAuthorizedDeviceInfoForAudioRenderer( | 349 bool GetAuthorizedDeviceInfoForAudioRenderer( |
| 350 int* session_id, int* output_sample_rate, int* output_buffer_size); | 350 int* session_id, int* output_sample_rate, int* output_buffer_size); |
| 351 | 351 |
| 352 const scoped_refptr<WebRtcAudioRenderer>& renderer() const { | 352 const scoped_refptr<WebRtcAudioRenderer>& renderer() const { |
| 353 return renderer_; | 353 return renderer_; |
| 354 } | 354 } |
| 355 | 355 |
| 356 // Enables the Aec dump. If the default capturer exists, it will call | |
| 357 // StartAecDump() on the capturer and pass the ownership of the file to | |
| 358 // WebRtc. Otherwise it will hold the file until a capturer is added. | |
| 359 void EnableAecDump(base::File aec_dump_file); | |
| 360 | |
| 361 // Disables the Aec dump. When this method is called, the ongoing Aec dump | |
| 362 // on WebRtc will be stopped. | |
| 363 void DisableAecDump(); | |
| 364 | |
| 365 private: | 356 private: |
| 366 typedef std::list<scoped_refptr<WebRtcAudioCapturer> > CapturerList; | 357 typedef std::list<scoped_refptr<WebRtcAudioCapturer> > CapturerList; |
| 367 typedef std::list<WebRtcPlayoutDataSource::Sink*> PlayoutDataSinkList; | 358 typedef std::list<WebRtcPlayoutDataSource::Sink*> PlayoutDataSinkList; |
| 368 class RenderBuffer; | 359 class RenderBuffer; |
| 369 | 360 |
| 370 // Make destructor private to ensure that we can only be deleted by Release(). | 361 // Make destructor private to ensure that we can only be deleted by Release(). |
| 371 virtual ~WebRtcAudioDeviceImpl(); | 362 virtual ~WebRtcAudioDeviceImpl(); |
| 372 | 363 |
| 373 // PeerConnectionAudioSink implementation. | 364 // PeerConnectionAudioSink implementation. |
| 374 | 365 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 394 int audio_delay_milliseconds, | 385 int audio_delay_milliseconds, |
| 395 base::TimeDelta* current_time) OVERRIDE; | 386 base::TimeDelta* current_time) OVERRIDE; |
| 396 | 387 |
| 397 // Called on the main render thread. | 388 // Called on the main render thread. |
| 398 virtual void RemoveAudioRenderer(WebRtcAudioRenderer* renderer) OVERRIDE; | 389 virtual void RemoveAudioRenderer(WebRtcAudioRenderer* renderer) OVERRIDE; |
| 399 | 390 |
| 400 // WebRtcPlayoutDataSource implementation. | 391 // WebRtcPlayoutDataSource implementation. |
| 401 virtual void AddPlayoutSink(WebRtcPlayoutDataSource::Sink* sink) OVERRIDE; | 392 virtual void AddPlayoutSink(WebRtcPlayoutDataSource::Sink* sink) OVERRIDE; |
| 402 virtual void RemovePlayoutSink(WebRtcPlayoutDataSource::Sink* sink) OVERRIDE; | 393 virtual void RemovePlayoutSink(WebRtcPlayoutDataSource::Sink* sink) OVERRIDE; |
| 403 | 394 |
| 404 // Helper to start the Aec dump if the default capturer exists. | |
| 405 void MaybeStartAecDump(); | |
| 406 | |
| 407 // Used to DCHECK that we are called on the correct thread. | 395 // Used to DCHECK that we are called on the correct thread. |
| 408 base::ThreadChecker thread_checker_; | 396 base::ThreadChecker thread_checker_; |
| 409 | 397 |
| 410 int ref_count_; | 398 int ref_count_; |
| 411 | 399 |
| 412 // List of captures which provides access to the native audio input layer | 400 // List of captures which provides access to the native audio input layer |
| 413 // in the browser process. | 401 // in the browser process. |
| 414 CapturerList capturers_; | 402 CapturerList capturers_; |
| 415 | 403 |
| 416 // Provides access to the audio renderer in the browser process. | 404 // Provides access to the audio renderer in the browser process. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 445 bool recording_; | 433 bool recording_; |
| 446 | 434 |
| 447 // Stores latest microphone volume received in a CaptureData() callback. | 435 // Stores latest microphone volume received in a CaptureData() callback. |
| 448 // Range is [0, 255]. | 436 // Range is [0, 255]. |
| 449 uint32_t microphone_volume_; | 437 uint32_t microphone_volume_; |
| 450 | 438 |
| 451 // Buffer used for temporary storage during render callback. | 439 // Buffer used for temporary storage during render callback. |
| 452 // It is only accessed by the audio render thread. | 440 // It is only accessed by the audio render thread. |
| 453 std::vector<int16> render_buffer_; | 441 std::vector<int16> render_buffer_; |
| 454 | 442 |
| 455 // Used for start the Aec dump on the default capturer. | |
| 456 base::File aec_dump_file_; | |
| 457 | |
| 458 // Flag to tell if audio processing is enabled in MediaStreamAudioProcessor. | 443 // Flag to tell if audio processing is enabled in MediaStreamAudioProcessor. |
| 459 const bool is_audio_track_processing_enabled_; | 444 const bool is_audio_track_processing_enabled_; |
| 460 | 445 |
| 461 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioDeviceImpl); | 446 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioDeviceImpl); |
| 462 }; | 447 }; |
| 463 | 448 |
| 464 } // namespace content | 449 } // namespace content |
| 465 | 450 |
| 466 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ | 451 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ |
| OLD | NEW |