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 #include "content/renderer/media/media_stream_audio_processor.h" | 5 #include "content/renderer/media/media_stream_audio_processor.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 | 419 |
420 void MediaStreamAudioProcessor::OnIpcClosing() { | 420 void MediaStreamAudioProcessor::OnIpcClosing() { |
421 DCHECK(main_thread_checker_.CalledOnValidThread()); | 421 DCHECK(main_thread_checker_.CalledOnValidThread()); |
422 aec_dump_message_filter_ = NULL; | 422 aec_dump_message_filter_ = NULL; |
423 } | 423 } |
424 | 424 |
425 void MediaStreamAudioProcessor::OnPlayoutData(media::AudioBus* audio_bus, | 425 void MediaStreamAudioProcessor::OnPlayoutData(media::AudioBus* audio_bus, |
426 int sample_rate, | 426 int sample_rate, |
427 int audio_delay_milliseconds) { | 427 int audio_delay_milliseconds) { |
428 DCHECK(render_thread_checker_.CalledOnValidThread()); | 428 DCHECK(render_thread_checker_.CalledOnValidThread()); |
429 #if defined(OS_ANDROID) || defined(OS_IOS) | 429 #if defined(OS_ANDROID) |
430 DCHECK(audio_processing_->echo_control_mobile()->is_enabled()); | 430 DCHECK(audio_processing_->echo_control_mobile()->is_enabled()); |
431 DCHECK(!audio_processing_->echo_cancellation()->is_enabled()); | 431 DCHECK(!audio_processing_->echo_cancellation()->is_enabled()); |
432 #else | 432 #else |
433 DCHECK(!audio_processing_->echo_control_mobile()->is_enabled()); | 433 DCHECK(!audio_processing_->echo_control_mobile()->is_enabled()); |
434 DCHECK(audio_processing_->echo_cancellation()->is_enabled()); | 434 DCHECK(audio_processing_->echo_cancellation()->is_enabled()); |
435 #endif | 435 #endif |
436 | 436 |
437 TRACE_EVENT0("audio", "MediaStreamAudioProcessor::OnPlayoutData"); | 437 TRACE_EVENT0("audio", "MediaStreamAudioProcessor::OnPlayoutData"); |
438 DCHECK_LT(audio_delay_milliseconds, | 438 DCHECK_LT(audio_delay_milliseconds, |
439 std::numeric_limits<base::subtle::Atomic32>::max()); | 439 std::numeric_limits<base::subtle::Atomic32>::max()); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 const MediaStreamDevice::AudioDeviceParameters& input_params) { | 475 const MediaStreamDevice::AudioDeviceParameters& input_params) { |
476 DCHECK(main_thread_checker_.CalledOnValidThread()); | 476 DCHECK(main_thread_checker_.CalledOnValidThread()); |
477 DCHECK(!audio_processing_); | 477 DCHECK(!audio_processing_); |
478 | 478 |
479 MediaAudioConstraints audio_constraints(constraints, input_params.effects); | 479 MediaAudioConstraints audio_constraints(constraints, input_params.effects); |
480 | 480 |
481 // Audio mirroring can be enabled even though audio processing is otherwise | 481 // Audio mirroring can be enabled even though audio processing is otherwise |
482 // disabled. | 482 // disabled. |
483 audio_mirroring_ = audio_constraints.GetGoogAudioMirroring(); | 483 audio_mirroring_ = audio_constraints.GetGoogAudioMirroring(); |
484 | 484 |
485 #if defined(OS_IOS) | |
486 // On iOS, VPIO provides built-in AGC and AEC. | |
487 const bool echo_cancellation = false; | |
488 const bool goog_agc = false; | |
489 #else | |
490 const bool echo_cancellation = | 485 const bool echo_cancellation = |
491 audio_constraints.GetEchoCancellationProperty(); | 486 audio_constraints.GetEchoCancellationProperty(); |
492 const bool goog_agc = audio_constraints.GetGoogAutoGainControl(); | 487 const bool goog_agc = audio_constraints.GetGoogAutoGainControl(); |
493 #endif | |
494 | 488 |
495 #if defined(OS_IOS) || defined(OS_ANDROID) | 489 #if defined(OS_ANDROID) |
496 const bool goog_experimental_aec = false; | 490 const bool goog_experimental_aec = false; |
497 const bool goog_typing_detection = false; | 491 const bool goog_typing_detection = false; |
498 #else | 492 #else |
499 const bool goog_experimental_aec = | 493 const bool goog_experimental_aec = |
500 audio_constraints.GetGoogExperimentalEchoCancellation(); | 494 audio_constraints.GetGoogExperimentalEchoCancellation(); |
501 const bool goog_typing_detection = | 495 const bool goog_typing_detection = |
502 audio_constraints.GetGoogTypingNoiseDetection(); | 496 audio_constraints.GetGoogTypingNoiseDetection(); |
503 #endif | 497 #endif |
504 | 498 |
505 const bool goog_ns = audio_constraints.GetGoogNoiseSuppression(); | 499 const bool goog_ns = audio_constraints.GetGoogNoiseSuppression(); |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 if (echo_information_) { | 728 if (echo_information_) { |
735 echo_information_.get()->UpdateAecDelayStats(ap->echo_cancellation()); | 729 echo_information_.get()->UpdateAecDelayStats(ap->echo_cancellation()); |
736 } | 730 } |
737 | 731 |
738 // Return 0 if the volume hasn't been changed, and otherwise the new volume. | 732 // Return 0 if the volume hasn't been changed, and otherwise the new volume. |
739 return (agc->stream_analog_level() == volume) ? | 733 return (agc->stream_analog_level() == volume) ? |
740 0 : agc->stream_analog_level(); | 734 0 : agc->stream_analog_level(); |
741 } | 735 } |
742 | 736 |
743 } // namespace content | 737 } // namespace content |
OLD | NEW |