| 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 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 void MediaStreamAudioProcessor::GetStats(AudioProcessorStats* stats) { | 258 void MediaStreamAudioProcessor::GetStats(AudioProcessorStats* stats) { |
| 259 stats->typing_noise_detected = | 259 stats->typing_noise_detected = |
| 260 (base::subtle::Acquire_Load(&typing_detected_) != false); | 260 (base::subtle::Acquire_Load(&typing_detected_) != false); |
| 261 GetAecStats(audio_processing_.get(), stats); | 261 GetAecStats(audio_processing_.get(), stats); |
| 262 } | 262 } |
| 263 | 263 |
| 264 void MediaStreamAudioProcessor::InitializeAudioProcessingModule( | 264 void MediaStreamAudioProcessor::InitializeAudioProcessingModule( |
| 265 const blink::WebMediaConstraints& constraints, int effects, | 265 const blink::WebMediaConstraints& constraints, int effects, |
| 266 MediaStreamType type) { | 266 MediaStreamType type) { |
| 267 DCHECK(!audio_processing_); | 267 DCHECK(!audio_processing_); |
| 268 const std::string group_name = | 268 if (!IsAudioTrackProcessingEnabled()) |
| 269 base::FieldTrialList::FindFullName("MediaStreamAudioTrackProcessing"); | |
| 270 if (!CommandLine::ForCurrentProcess()->HasSwitch( | |
| 271 switches::kEnableAudioTrackProcessing) && | |
| 272 group_name != "Enabled") { | |
| 273 return; | 269 return; |
| 274 } | |
| 275 | 270 |
| 276 RTCMediaConstraints native_constraints(constraints); | 271 RTCMediaConstraints native_constraints(constraints); |
| 277 | 272 |
| 278 // Only apply the fixed constraints for gUM of MEDIA_DEVICE_AUDIO_CAPTURE. | 273 // Only apply the fixed constraints for gUM of MEDIA_DEVICE_AUDIO_CAPTURE. |
| 279 DCHECK(IsAudioMediaType(type)); | 274 DCHECK(IsAudioMediaType(type)); |
| 280 if (type == MEDIA_DEVICE_AUDIO_CAPTURE) | 275 if (type == MEDIA_DEVICE_AUDIO_CAPTURE) |
| 281 ApplyFixedAudioConstraints(&native_constraints); | 276 ApplyFixedAudioConstraints(&native_constraints); |
| 282 | 277 |
| 283 if (effects & media::AudioParameters::ECHO_CANCELLER) { | 278 if (effects & media::AudioParameters::ECHO_CANCELLER) { |
| 284 // If platform echo canceller is enabled, disable the software AEC. | 279 // If platform echo canceller is enabled, disable the software AEC. |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 return; | 480 return; |
| 486 | 481 |
| 487 StopAecDump(); | 482 StopAecDump(); |
| 488 | 483 |
| 489 if (playout_data_source_) | 484 if (playout_data_source_) |
| 490 playout_data_source_->RemovePlayoutSink(this); | 485 playout_data_source_->RemovePlayoutSink(this); |
| 491 | 486 |
| 492 audio_processing_.reset(); | 487 audio_processing_.reset(); |
| 493 } | 488 } |
| 494 | 489 |
| 490 bool MediaStreamAudioProcessor::IsAudioTrackProcessingEnabled() const { |
| 491 const std::string group_name = |
| 492 base::FieldTrialList::FindFullName("MediaStreamAudioTrackProcessing"); |
| 493 return group_name == "Enabled" || CommandLine::ForCurrentProcess()->HasSwitch( |
| 494 switches::kEnableAudioTrackProcessing); |
| 495 } |
| 496 |
| 495 } // namespace content | 497 } // namespace content |
| OLD | NEW |