| 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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 if (goog_experimental_aec) | 417 if (goog_experimental_aec) |
| 417 config.Set<webrtc::DelayCorrection>(new webrtc::DelayCorrection(true)); | 418 config.Set<webrtc::DelayCorrection>(new webrtc::DelayCorrection(true)); |
| 418 if (goog_experimental_ns) | 419 if (goog_experimental_ns) |
| 419 config.Set<webrtc::ExperimentalNs>(new webrtc::ExperimentalNs(true)); | 420 config.Set<webrtc::ExperimentalNs>(new webrtc::ExperimentalNs(true)); |
| 420 #if defined(OS_MACOSX) | 421 #if defined(OS_MACOSX) |
| 421 if (base::FieldTrialList::FindFullName("NoReportedDelayOnMac") == "Enabled") | 422 if (base::FieldTrialList::FindFullName("NoReportedDelayOnMac") == "Enabled") |
| 422 config.Set<webrtc::ReportedDelay>(new webrtc::ReportedDelay(false)); | 423 config.Set<webrtc::ReportedDelay>(new webrtc::ReportedDelay(false)); |
| 423 #endif | 424 #endif |
| 424 | 425 |
| 425 // Create and configure the webrtc::AudioProcessing. | 426 // Create and configure the webrtc::AudioProcessing. |
| 426 audio_processing_.reset(webrtc::AudioProcessing::Create(config)); | 427 audio_processing_.reset(CreateWebRtcAudioProcessing(config)); |
| 427 | 428 |
| 428 // Enable the audio processing components. | 429 // Enable the audio processing components. |
| 429 if (echo_cancellation) { | 430 if (echo_cancellation) { |
| 430 EnableEchoCancellation(audio_processing_.get()); | 431 EnableEchoCancellation(audio_processing_.get()); |
| 431 | 432 |
| 432 if (playout_data_source_) | 433 if (playout_data_source_) |
| 433 playout_data_source_->AddPlayoutSink(this); | 434 playout_data_source_->AddPlayoutSink(this); |
| 434 } | 435 } |
| 435 | 436 |
| 436 if (goog_ns) | 437 if (goog_ns) |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 vad->stream_has_voice()); | 580 vad->stream_has_voice()); |
| 580 base::subtle::Release_Store(&typing_detected_, detected); | 581 base::subtle::Release_Store(&typing_detected_, detected); |
| 581 } | 582 } |
| 582 | 583 |
| 583 // Return 0 if the volume hasn't been changed, and otherwise the new volume. | 584 // Return 0 if the volume hasn't been changed, and otherwise the new volume. |
| 584 return (agc->stream_analog_level() == volume) ? | 585 return (agc->stream_analog_level() == volume) ? |
| 585 0 : agc->stream_analog_level(); | 586 0 : agc->stream_analog_level(); |
| 586 } | 587 } |
| 587 | 588 |
| 588 } // namespace content | 589 } // namespace content |
| OLD | NEW |