| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 const blink::WebMediaConstraints& constraints, | 127 const blink::WebMediaConstraints& constraints, |
| 128 blink::BooleanConstraint blink::WebMediaTrackConstraintSet::*picker, | 128 blink::BooleanConstraint blink::WebMediaTrackConstraintSet::*picker, |
| 129 bool the_default) { | 129 bool the_default) { |
| 130 bool value; | 130 bool value; |
| 131 if (GetConstraintValueAsBoolean(constraints, picker, &value)) { | 131 if (GetConstraintValueAsBoolean(constraints, picker, &value)) { |
| 132 return value; | 132 return value; |
| 133 } | 133 } |
| 134 return the_default; | 134 return the_default; |
| 135 } | 135 } |
| 136 | 136 |
| 137 void SetIfNotSet(rtc::Optional<bool>* field, bool value) { | |
| 138 if (!*field) { | |
| 139 *field = rtc::Optional<bool>(value); | |
| 140 } | |
| 141 } | |
| 142 | |
| 143 } // namespace | 137 } // namespace |
| 144 | 138 |
| 145 // TODO(xians): Remove this method after the APM in WebRtc is deprecated. | |
| 146 void MediaAudioConstraints::ApplyFixedAudioConstraints( | |
| 147 cricket::AudioOptions* options) { | |
| 148 SetIfNotSet(&options->echo_cancellation, true); | |
| 149 #if defined(OS_ANDROID) | |
| 150 SetIfNotSet(&options->extended_filter_aec, false); | |
| 151 #else | |
| 152 // Enable the extended filter mode AEC on all non-mobile platforms. | |
| 153 SetIfNotSet(&options->extended_filter_aec, true); | |
| 154 #endif | |
| 155 SetIfNotSet(&options->auto_gain_control, true); | |
| 156 SetIfNotSet(&options->experimental_agc, true); | |
| 157 SetIfNotSet(&options->noise_suppression, true); | |
| 158 SetIfNotSet(&options->highpass_filter, true); | |
| 159 SetIfNotSet(&options->typing_detection, true); | |
| 160 SetIfNotSet(&options->experimental_ns, true); | |
| 161 } | |
| 162 | |
| 163 MediaAudioConstraints::MediaAudioConstraints( | 139 MediaAudioConstraints::MediaAudioConstraints( |
| 164 const blink::WebMediaConstraints& constraints, int effects) | 140 const blink::WebMediaConstraints& constraints, int effects) |
| 165 : constraints_(constraints), | 141 : constraints_(constraints), |
| 166 effects_(effects), | 142 effects_(effects), |
| 167 default_audio_processing_constraint_value_(true) { | 143 default_audio_processing_constraint_value_(true) { |
| 168 // The default audio processing constraints are turned off when | 144 // The default audio processing constraints are turned off when |
| 169 // - gUM has a specific kMediaStreamSource, which is used by tab capture | 145 // - gUM has a specific kMediaStreamSource, which is used by tab capture |
| 170 // and screen capture. | 146 // and screen capture. |
| 171 // - |kEchoCancellation| is explicitly set to false. | 147 // - |kEchoCancellation| is explicitly set to false. |
| 172 bool echo_constraint; | 148 bool echo_constraint; |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 | 481 |
| 506 // Give preference to the audio constraint over the device-supplied mic | 482 // Give preference to the audio constraint over the device-supplied mic |
| 507 // positions. This is mainly for testing purposes. | 483 // positions. This is mainly for testing purposes. |
| 508 return WebrtcPointsFromMediaPoints( | 484 return WebrtcPointsFromMediaPoints( |
| 509 constraints_geometry.empty() | 485 constraints_geometry.empty() |
| 510 ? input_params.mic_positions | 486 ? input_params.mic_positions |
| 511 : media::ParsePointsFromString(constraints_geometry)); | 487 : media::ParsePointsFromString(constraints_geometry)); |
| 512 } | 488 } |
| 513 | 489 |
| 514 } // namespace content | 490 } // namespace content |
| OLD | NEW |