Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1930)

Unified Diff: content/renderer/media/media_stream_audio_processor_options.cc

Issue 1729683002: Remove old-style constraints from Chrome internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Complete the interface change Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..52c7aace878cbe24ca297bd71a80d09ba2e4ae0c 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,30 @@ bool ScanConstraintsForBoolean(
return the_default;
}
+void SetIfNotSet(rtc::Optional<bool>* field, bool value) {
+ if (!*field) {
+ *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);
+#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(
« no previous file with comments | « content/renderer/media/media_stream_audio_processor_options.h ('k') | content/renderer/media/media_stream_constraints_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698