| 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_options.h" | 5 #include "content/renderer/media/media_stream_audio_processor_options.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 // Enable the extended filter mode AEC on all non-mobile platforms. | 59 // Enable the extended filter mode AEC on all non-mobile platforms. |
| 60 { MediaAudioConstraints::kGoogExperimentalEchoCancellation, true }, | 60 { MediaAudioConstraints::kGoogExperimentalEchoCancellation, true }, |
| 61 #endif | 61 #endif |
| 62 { MediaAudioConstraints::kGoogAutoGainControl, true }, | 62 { MediaAudioConstraints::kGoogAutoGainControl, true }, |
| 63 { MediaAudioConstraints::kGoogExperimentalAutoGainControl, true }, | 63 { MediaAudioConstraints::kGoogExperimentalAutoGainControl, true }, |
| 64 { MediaAudioConstraints::kGoogNoiseSuppression, true }, | 64 { MediaAudioConstraints::kGoogNoiseSuppression, true }, |
| 65 { MediaAudioConstraints::kGoogHighpassFilter, true }, | 65 { MediaAudioConstraints::kGoogHighpassFilter, true }, |
| 66 { MediaAudioConstraints::kGoogTypingNoiseDetection, true }, | 66 { MediaAudioConstraints::kGoogTypingNoiseDetection, true }, |
| 67 { MediaAudioConstraints::kGoogExperimentalNoiseSuppression, false }, | 67 { MediaAudioConstraints::kGoogExperimentalNoiseSuppression, false }, |
| 68 { MediaAudioConstraints::kGoogBeamforming, false }, | 68 { MediaAudioConstraints::kGoogBeamforming, false }, |
| 69 #if defined(OS_WIN) | |
| 70 { kMediaStreamAudioDucking, true }, | |
| 71 #else | |
| 72 { kMediaStreamAudioDucking, false }, | |
| 73 #endif | |
| 74 { kMediaStreamAudioHotword, false }, | 69 { kMediaStreamAudioHotword, false }, |
| 75 }; | 70 }; |
| 76 | 71 |
| 77 bool IsAudioProcessingConstraint(const std::string& key) { | |
| 78 // |kMediaStreamAudioDucking| does not require audio processing. | |
| 79 return key != kMediaStreamAudioDucking; | |
| 80 } | |
| 81 | |
| 82 // Used to log echo quality based on delay estimates. | 72 // Used to log echo quality based on delay estimates. |
| 83 enum DelayBasedEchoQuality { | 73 enum DelayBasedEchoQuality { |
| 84 DELAY_BASED_ECHO_QUALITY_GOOD = 0, | 74 DELAY_BASED_ECHO_QUALITY_GOOD = 0, |
| 85 DELAY_BASED_ECHO_QUALITY_SPURIOUS, | 75 DELAY_BASED_ECHO_QUALITY_SPURIOUS, |
| 86 DELAY_BASED_ECHO_QUALITY_BAD, | 76 DELAY_BASED_ECHO_QUALITY_BAD, |
| 87 DELAY_BASED_ECHO_QUALITY_INVALID, | 77 DELAY_BASED_ECHO_QUALITY_INVALID, |
| 88 DELAY_BASED_ECHO_QUALITY_MAX | 78 DELAY_BASED_ECHO_QUALITY_MAX |
| 89 }; | 79 }; |
| 90 | 80 |
| 91 DelayBasedEchoQuality EchoDelayFrequencyToQuality(float delay_frequency) { | 81 DelayBasedEchoQuality EchoDelayFrequencyToQuality(float delay_frequency) { |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 return false; | 196 return false; |
| 207 } | 197 } |
| 208 } | 198 } |
| 209 | 199 |
| 210 return true; | 200 return true; |
| 211 } | 201 } |
| 212 | 202 |
| 213 bool MediaAudioConstraints::GetDefaultValueForConstraint( | 203 bool MediaAudioConstraints::GetDefaultValueForConstraint( |
| 214 const blink::WebMediaConstraints& constraints, | 204 const blink::WebMediaConstraints& constraints, |
| 215 const std::string& key) const { | 205 const std::string& key) const { |
| 216 // |kMediaStreamAudioDucking| is not restricted by | 206 if (!default_audio_processing_constraint_value_) |
| 217 // |default_audio_processing_constraint_value_| since it does not require | |
| 218 // audio processing. | |
| 219 if (!default_audio_processing_constraint_value_ && | |
| 220 IsAudioProcessingConstraint(key)) | |
| 221 return false; | 207 return false; |
| 222 | 208 |
| 223 for (size_t i = 0; i < arraysize(kDefaultAudioConstraints); ++i) { | 209 for (size_t i = 0; i < arraysize(kDefaultAudioConstraints); ++i) { |
| 224 if (kDefaultAudioConstraints[i].key == key) | 210 if (kDefaultAudioConstraints[i].key == key) |
| 225 return kDefaultAudioConstraints[i].value; | 211 return kDefaultAudioConstraints[i].value; |
| 226 } | 212 } |
| 227 | 213 |
| 228 return false; | 214 return false; |
| 229 } | 215 } |
| 230 | 216 |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 geometry.reserve(float_tokens.size() / 3); | 403 geometry.reserve(float_tokens.size() / 3); |
| 418 for (size_t i = 0; i < float_tokens.size(); i += 3) { | 404 for (size_t i = 0; i < float_tokens.size(); i += 3) { |
| 419 geometry.push_back(webrtc::Point(float_tokens[i + 0], float_tokens[i + 1], | 405 geometry.push_back(webrtc::Point(float_tokens[i + 0], float_tokens[i + 1], |
| 420 float_tokens[i + 2])); | 406 float_tokens[i + 2])); |
| 421 } | 407 } |
| 422 | 408 |
| 423 return geometry; | 409 return geometry; |
| 424 } | 410 } |
| 425 | 411 |
| 426 } // namespace content | 412 } // namespace content |
| OLD | NEW |