| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #if defined(OS_MACOSX) | 9 #if defined(OS_MACOSX) |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| 11 #endif | 11 #endif |
| 12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 13 #include "content/public/common/content_switches.h" | 13 #include "content/public/common/content_switches.h" |
| 14 #include "content/renderer/media/media_stream_audio_processor_options.h" | 14 #include "content/renderer/media/media_stream_audio_processor_options.h" |
| 15 #include "content/renderer/media/rtc_media_constraints.h" | 15 #include "content/renderer/media/rtc_media_constraints.h" |
| 16 #include "content/renderer/media/webrtc_audio_device_impl.h" | 16 #include "content/renderer/media/webrtc_audio_device_impl.h" |
| 17 #include "media/audio/audio_parameters.h" | 17 #include "media/audio/audio_parameters.h" |
| 18 #include "media/base/audio_converter.h" | 18 #include "media/base/audio_converter.h" |
| 19 #include "media/base/audio_fifo.h" | 19 #include "media/base/audio_fifo.h" |
| 20 #include "media/base/channel_layout.h" | 20 #include "media/base/channel_layout.h" |
| 21 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" | 21 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" |
| 22 #include "third_party/libjingle/overrides/init_webrtc.h" | |
| 23 #include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface
.h" | 22 #include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface
.h" |
| 24 #include "third_party/webrtc/modules/audio_processing/typing_detection.h" | 23 #include "third_party/webrtc/modules/audio_processing/typing_detection.h" |
| 25 | 24 |
| 26 namespace content { | 25 namespace content { |
| 27 | 26 |
| 28 namespace { | 27 namespace { |
| 29 | 28 |
| 30 using webrtc::AudioProcessing; | 29 using webrtc::AudioProcessing; |
| 31 | 30 |
| 32 #if defined(OS_ANDROID) | 31 #if defined(OS_ANDROID) |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 if (goog_experimental_aec) | 447 if (goog_experimental_aec) |
| 449 config.Set<webrtc::DelayCorrection>(new webrtc::DelayCorrection(true)); | 448 config.Set<webrtc::DelayCorrection>(new webrtc::DelayCorrection(true)); |
| 450 if (goog_experimental_ns) | 449 if (goog_experimental_ns) |
| 451 config.Set<webrtc::ExperimentalNs>(new webrtc::ExperimentalNs(true)); | 450 config.Set<webrtc::ExperimentalNs>(new webrtc::ExperimentalNs(true)); |
| 452 #if defined(OS_MACOSX) | 451 #if defined(OS_MACOSX) |
| 453 if (base::FieldTrialList::FindFullName("NoReportedDelayOnMac") == "Enabled") | 452 if (base::FieldTrialList::FindFullName("NoReportedDelayOnMac") == "Enabled") |
| 454 config.Set<webrtc::ReportedDelay>(new webrtc::ReportedDelay(false)); | 453 config.Set<webrtc::ReportedDelay>(new webrtc::ReportedDelay(false)); |
| 455 #endif | 454 #endif |
| 456 | 455 |
| 457 // Create and configure the webrtc::AudioProcessing. | 456 // Create and configure the webrtc::AudioProcessing. |
| 458 audio_processing_.reset(CreateWebRtcAudioProcessing(config)); | 457 audio_processing_.reset(webrtc::AudioProcessing::Create(config)); |
| 459 | 458 |
| 460 // Enable the audio processing components. | 459 // Enable the audio processing components. |
| 461 if (echo_cancellation) { | 460 if (echo_cancellation) { |
| 462 EnableEchoCancellation(audio_processing_.get()); | 461 EnableEchoCancellation(audio_processing_.get()); |
| 463 | 462 |
| 464 if (playout_data_source_) | 463 if (playout_data_source_) |
| 465 playout_data_source_->AddPlayoutSink(this); | 464 playout_data_source_->AddPlayoutSink(this); |
| 466 | 465 |
| 467 // Prepare for logging echo information. If there are data remaining in | 466 // Prepare for logging echo information. If there are data remaining in |
| 468 // |echo_information_| we simply discard it. | 467 // |echo_information_| we simply discard it. |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 vad->stream_has_voice()); | 630 vad->stream_has_voice()); |
| 632 base::subtle::Release_Store(&typing_detected_, detected); | 631 base::subtle::Release_Store(&typing_detected_, detected); |
| 633 } | 632 } |
| 634 | 633 |
| 635 // Return 0 if the volume hasn't been changed, and otherwise the new volume. | 634 // Return 0 if the volume hasn't been changed, and otherwise the new volume. |
| 636 return (agc->stream_analog_level() == volume) ? | 635 return (agc->stream_analog_level() == volume) ? |
| 637 0 : agc->stream_analog_level(); | 636 0 : agc->stream_analog_level(); |
| 638 } | 637 } |
| 639 | 638 |
| 640 } // namespace content | 639 } // namespace content |
| OLD | NEW |