| 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" |
| 22 #include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface
.h" | 23 #include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface
.h" |
| 23 #include "third_party/webrtc/modules/audio_processing/typing_detection.h" | 24 #include "third_party/webrtc/modules/audio_processing/typing_detection.h" |
| 24 | 25 |
| 25 namespace content { | 26 namespace content { |
| 26 | 27 |
| 27 namespace { | 28 namespace { |
| 28 | 29 |
| 29 using webrtc::AudioProcessing; | 30 using webrtc::AudioProcessing; |
| 30 | 31 |
| 31 #if defined(OS_ANDROID) | 32 #if defined(OS_ANDROID) |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 if (goog_experimental_aec) | 445 if (goog_experimental_aec) |
| 445 config.Set<webrtc::DelayCorrection>(new webrtc::DelayCorrection(true)); | 446 config.Set<webrtc::DelayCorrection>(new webrtc::DelayCorrection(true)); |
| 446 if (goog_experimental_ns) | 447 if (goog_experimental_ns) |
| 447 config.Set<webrtc::ExperimentalNs>(new webrtc::ExperimentalNs(true)); | 448 config.Set<webrtc::ExperimentalNs>(new webrtc::ExperimentalNs(true)); |
| 448 #if defined(OS_MACOSX) | 449 #if defined(OS_MACOSX) |
| 449 if (base::FieldTrialList::FindFullName("NoReportedDelayOnMac") == "Enabled") | 450 if (base::FieldTrialList::FindFullName("NoReportedDelayOnMac") == "Enabled") |
| 450 config.Set<webrtc::ReportedDelay>(new webrtc::ReportedDelay(false)); | 451 config.Set<webrtc::ReportedDelay>(new webrtc::ReportedDelay(false)); |
| 451 #endif | 452 #endif |
| 452 | 453 |
| 453 // Create and configure the webrtc::AudioProcessing. | 454 // Create and configure the webrtc::AudioProcessing. |
| 454 audio_processing_.reset(webrtc::AudioProcessing::Create(config)); | 455 audio_processing_.reset(CreateWebRtcAudioProcessing(config)); |
| 455 | 456 |
| 456 // Enable the audio processing components. | 457 // Enable the audio processing components. |
| 457 if (echo_cancellation) { | 458 if (echo_cancellation) { |
| 458 EnableEchoCancellation(audio_processing_.get()); | 459 EnableEchoCancellation(audio_processing_.get()); |
| 459 | 460 |
| 460 if (playout_data_source_) | 461 if (playout_data_source_) |
| 461 playout_data_source_->AddPlayoutSink(this); | 462 playout_data_source_->AddPlayoutSink(this); |
| 462 } | 463 } |
| 463 | 464 |
| 464 if (goog_ns) | 465 if (goog_ns) |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 vad->stream_has_voice()); | 624 vad->stream_has_voice()); |
| 624 base::subtle::Release_Store(&typing_detected_, detected); | 625 base::subtle::Release_Store(&typing_detected_, detected); |
| 625 } | 626 } |
| 626 | 627 |
| 627 // Return 0 if the volume hasn't been changed, and otherwise the new volume. | 628 // Return 0 if the volume hasn't been changed, and otherwise the new volume. |
| 628 return (agc->stream_analog_level() == volume) ? | 629 return (agc->stream_analog_level() == volume) ? |
| 629 0 : agc->stream_analog_level(); | 630 0 : agc->stream_analog_level(); |
| 630 } | 631 } |
| 631 | 632 |
| 632 } // namespace content | 633 } // namespace content |
| OLD | NEW |