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) |
| 10 #include "base/metrics/field_trial.h" |
| 11 #endif |
9 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
10 #include "content/public/common/content_switches.h" | 13 #include "content/public/common/content_switches.h" |
11 #include "content/renderer/media/media_stream_audio_processor_options.h" | 14 #include "content/renderer/media/media_stream_audio_processor_options.h" |
12 #include "content/renderer/media/rtc_media_constraints.h" | 15 #include "content/renderer/media/rtc_media_constraints.h" |
13 #include "content/renderer/media/webrtc_audio_device_impl.h" | 16 #include "content/renderer/media/webrtc_audio_device_impl.h" |
14 #include "media/audio/audio_parameters.h" | 17 #include "media/audio/audio_parameters.h" |
15 #include "media/base/audio_converter.h" | 18 #include "media/base/audio_converter.h" |
16 #include "media/base/audio_fifo.h" | 19 #include "media/base/audio_fifo.h" |
17 #include "media/base/channel_layout.h" | 20 #include "media/base/channel_layout.h" |
18 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" | 21 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 RecordProcessingState(AUDIO_PROCESSING_DISABLED); | 410 RecordProcessingState(AUDIO_PROCESSING_DISABLED); |
408 return; | 411 return; |
409 } | 412 } |
410 | 413 |
411 // Experimental options provided at creation. | 414 // Experimental options provided at creation. |
412 webrtc::Config config; | 415 webrtc::Config config; |
413 if (goog_experimental_aec) | 416 if (goog_experimental_aec) |
414 config.Set<webrtc::DelayCorrection>(new webrtc::DelayCorrection(true)); | 417 config.Set<webrtc::DelayCorrection>(new webrtc::DelayCorrection(true)); |
415 if (goog_experimental_ns) | 418 if (goog_experimental_ns) |
416 config.Set<webrtc::ExperimentalNs>(new webrtc::ExperimentalNs(true)); | 419 config.Set<webrtc::ExperimentalNs>(new webrtc::ExperimentalNs(true)); |
| 420 #if defined(OS_MACOSX) |
| 421 if (base::FieldTrialList::FindFullName("NoReportedDelayOnMac") == "Enabled") |
| 422 config.Set<webrtc::ReportedDelay>(new webrtc::ReportedDelay(false)); |
| 423 #endif |
417 | 424 |
418 // Create and configure the webrtc::AudioProcessing. | 425 // Create and configure the webrtc::AudioProcessing. |
419 audio_processing_.reset(webrtc::AudioProcessing::Create(config)); | 426 audio_processing_.reset(webrtc::AudioProcessing::Create(config)); |
420 | 427 |
421 // Enable the audio processing components. | 428 // Enable the audio processing components. |
422 if (echo_cancellation) { | 429 if (echo_cancellation) { |
423 EnableEchoCancellation(audio_processing_.get()); | 430 EnableEchoCancellation(audio_processing_.get()); |
424 | 431 |
425 if (playout_data_source_) | 432 if (playout_data_source_) |
426 playout_data_source_->AddPlayoutSink(this); | 433 playout_data_source_->AddPlayoutSink(this); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 vad->stream_has_voice()); | 579 vad->stream_has_voice()); |
573 base::subtle::Release_Store(&typing_detected_, detected); | 580 base::subtle::Release_Store(&typing_detected_, detected); |
574 } | 581 } |
575 | 582 |
576 // 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. |
577 return (agc->stream_analog_level() == volume) ? | 584 return (agc->stream_analog_level() == volume) ? |
578 0 : agc->stream_analog_level(); | 585 0 : agc->stream_analog_level(); |
579 } | 586 } |
580 | 587 |
581 } // namespace content | 588 } // namespace content |
OLD | NEW |