| 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 "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
| 10 #include "content/renderer/media/media_stream_audio_processor_options.h" | 11 #include "content/renderer/media/media_stream_audio_processor_options.h" |
| 11 #include "content/renderer/media/rtc_media_constraints.h" | 12 #include "content/renderer/media/rtc_media_constraints.h" |
| 12 #include "media/audio/audio_parameters.h" | 13 #include "media/audio/audio_parameters.h" |
| 13 #include "media/base/audio_converter.h" | 14 #include "media/base/audio_converter.h" |
| 14 #include "media/base/audio_fifo.h" | 15 #include "media/base/audio_fifo.h" |
| 15 #include "media/base/channel_layout.h" | 16 #include "media/base/channel_layout.h" |
| 16 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" | 17 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" |
| 17 #include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface
.h" | 18 #include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface
.h" |
| 18 #include "third_party/webrtc/modules/audio_processing/typing_detection.h" | 19 #include "third_party/webrtc/modules/audio_processing/typing_detection.h" |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 void MediaStreamAudioProcessor::GetStats(AudioProcessorStats* stats) { | 258 void MediaStreamAudioProcessor::GetStats(AudioProcessorStats* stats) { |
| 258 stats->typing_noise_detected = | 259 stats->typing_noise_detected = |
| 259 (base::subtle::Acquire_Load(&typing_detected_) != false); | 260 (base::subtle::Acquire_Load(&typing_detected_) != false); |
| 260 GetAecStats(audio_processing_.get(), stats); | 261 GetAecStats(audio_processing_.get(), stats); |
| 261 } | 262 } |
| 262 | 263 |
| 263 void MediaStreamAudioProcessor::InitializeAudioProcessingModule( | 264 void MediaStreamAudioProcessor::InitializeAudioProcessingModule( |
| 264 const blink::WebMediaConstraints& constraints, int effects, | 265 const blink::WebMediaConstraints& constraints, int effects, |
| 265 MediaStreamType type) { | 266 MediaStreamType type) { |
| 266 DCHECK(!audio_processing_); | 267 DCHECK(!audio_processing_); |
| 268 const std::string group_name = |
| 269 base::FieldTrialList::FindFullName("MediaStreamAudioTrackProcessing"); |
| 267 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 270 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 268 switches::kEnableAudioTrackProcessing)) { | 271 switches::kEnableAudioTrackProcessing) && |
| 272 group_name != "Enabled") { |
| 269 return; | 273 return; |
| 270 } | 274 } |
| 271 | 275 |
| 272 RTCMediaConstraints native_constraints(constraints); | 276 RTCMediaConstraints native_constraints(constraints); |
| 273 | 277 |
| 274 // Only apply the fixed constraints for gUM of MEDIA_DEVICE_AUDIO_CAPTURE. | 278 // Only apply the fixed constraints for gUM of MEDIA_DEVICE_AUDIO_CAPTURE. |
| 275 DCHECK(IsAudioMediaType(type)); | 279 DCHECK(IsAudioMediaType(type)); |
| 276 if (type == MEDIA_DEVICE_AUDIO_CAPTURE) | 280 if (type == MEDIA_DEVICE_AUDIO_CAPTURE) |
| 277 ApplyFixedAudioConstraints(&native_constraints); | 281 ApplyFixedAudioConstraints(&native_constraints); |
| 278 | 282 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 | 486 |
| 483 StopAecDump(); | 487 StopAecDump(); |
| 484 | 488 |
| 485 if (playout_data_source_) | 489 if (playout_data_source_) |
| 486 playout_data_source_->RemovePlayoutSink(this); | 490 playout_data_source_->RemovePlayoutSink(this); |
| 487 | 491 |
| 488 audio_processing_.reset(); | 492 audio_processing_.reset(); |
| 489 } | 493 } |
| 490 | 494 |
| 491 } // namespace content | 495 } // namespace content |
| OLD | NEW |