Chromium Code Reviews| Index: content/renderer/media/media_stream_audio_processor_options.cc |
| diff --git a/content/renderer/media/media_stream_audio_processor_options.cc b/content/renderer/media/media_stream_audio_processor_options.cc |
| index 392bde66b37252d0446cd3e2b98c6618578cd849..6753d54e8fde66b26cba2a0a9d15b60ebc1dfac4 100644 |
| --- a/content/renderer/media/media_stream_audio_processor_options.cc |
| +++ b/content/renderer/media/media_stream_audio_processor_options.cc |
| @@ -19,7 +19,6 @@ |
| #include "build/build_config.h" |
| #include "content/common/media/media_stream_options.h" |
| #include "content/renderer/media/media_stream_source.h" |
| -#include "content/renderer/media/rtc_media_constraints.h" |
| #include "media/audio/audio_parameters.h" |
| #include "third_party/webrtc/modules/audio_processing/include/audio_processing.h" |
| #include "third_party/webrtc/modules/audio_processing/typing_detection.h" |
| @@ -137,24 +136,32 @@ bool ScanConstraintsForBoolean( |
| return the_default; |
| } |
| +void SetIfNotSet(rtc::Optional<bool>* field, bool value) { |
| + if (!*field) { |
|
Guido Urdaneta
2016/03/11 14:53:30
should this be !field? Otherwise you are testing t
hta - Chromium
2016/03/11 15:06:44
No, field is a pointer (and will always be non-nul
|
| + *field = rtc::Optional<bool>(value); |
| + } |
| +} |
| + |
| } // namespace |
| // TODO(xians): Remove this method after the APM in WebRtc is deprecated. |
| void MediaAudioConstraints::ApplyFixedAudioConstraints( |
| - RTCMediaConstraints* constraints) { |
| - for (size_t i = 0; i < arraysize(kDefaultAudioConstraints); ++i) { |
| - bool already_set_value; |
| - if (!webrtc::FindConstraint(constraints, kDefaultAudioConstraints[i].key, |
| - &already_set_value, NULL)) { |
| - const std::string value = kDefaultAudioConstraints[i].value ? |
| - webrtc::MediaConstraintsInterface::kValueTrue : |
| - webrtc::MediaConstraintsInterface::kValueFalse; |
| - constraints->AddOptional(kDefaultAudioConstraints[i].key, value, false); |
| - } else { |
| - DVLOG(1) << "Constraint " << kDefaultAudioConstraints[i].key |
| - << " already set to " << already_set_value; |
| - } |
| - } |
| + cricket::AudioOptions* options) { |
| + SetIfNotSet(&options->echo_cancellation, true); |
| +// TODO(hta): Figure out correct values for options.extended_filter_aec, |
| +// delay_agnostic_aec - names don't quite match. |
| +#if defined(OS_ANDROID) || defined(OS_IOS) |
| + SetIfNotSet(&options->extended_filter_aec, false); |
| +#else |
| + // Enable the extended filter mode AEC on all non-mobile platforms. |
| + SetIfNotSet(&options->extended_filter_aec, true); |
| +#endif |
| + SetIfNotSet(&options->auto_gain_control, true); |
| + SetIfNotSet(&options->experimental_agc, true); |
| + SetIfNotSet(&options->noise_suppression, true); |
| + SetIfNotSet(&options->highpass_filter, true); |
| + SetIfNotSet(&options->typing_detection, true); |
| + SetIfNotSet(&options->experimental_ns, true); |
| } |
| MediaAudioConstraints::MediaAudioConstraints( |