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