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