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

Side by Side Diff: content/renderer/media/media_stream_audio_processor_options.cc

Issue 1891953003: Fix selection of "no audio processing" mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
OLDNEW
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"
11 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
15 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
16 #include "base/strings/string_split.h" 16 #include "base/strings/string_split.h"
17 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
18 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
19 #include "build/build_config.h" 19 #include "build/build_config.h"
20 #include "content/common/media/media_stream_options.h" 20 #include "content/common/media/media_stream_options.h"
21 #include "content/renderer/media/media_stream_constraints_util.h"
21 #include "content/renderer/media/media_stream_source.h" 22 #include "content/renderer/media/media_stream_source.h"
22 #include "media/audio/audio_parameters.h" 23 #include "media/audio/audio_parameters.h"
23 #include "third_party/webrtc/modules/audio_processing/include/audio_processing.h " 24 #include "third_party/webrtc/modules/audio_processing/include/audio_processing.h "
24 #include "third_party/webrtc/modules/audio_processing/typing_detection.h" 25 #include "third_party/webrtc/modules/audio_processing/typing_detection.h"
25 26
26 namespace content { 27 namespace content {
27 28
28 const char MediaAudioConstraints::kEchoCancellation[] = "echoCancellation"; 29 const char MediaAudioConstraints::kEchoCancellation[] = "echoCancellation";
29 const char MediaAudioConstraints::kGoogEchoCancellation[] = 30 const char MediaAudioConstraints::kGoogEchoCancellation[] =
30 "googEchoCancellation"; 31 "googEchoCancellation";
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 165
165 MediaAudioConstraints::MediaAudioConstraints( 166 MediaAudioConstraints::MediaAudioConstraints(
166 const blink::WebMediaConstraints& constraints, int effects) 167 const blink::WebMediaConstraints& constraints, int effects)
167 : constraints_(constraints), 168 : constraints_(constraints),
168 effects_(effects), 169 effects_(effects),
169 default_audio_processing_constraint_value_(true) { 170 default_audio_processing_constraint_value_(true) {
170 // The default audio processing constraints are turned off when 171 // The default audio processing constraints are turned off when
171 // - gUM has a specific kMediaStreamSource, which is used by tab capture 172 // - gUM has a specific kMediaStreamSource, which is used by tab capture
172 // and screen capture. 173 // and screen capture.
173 // - |kEchoCancellation| is explicitly set to false. 174 // - |kEchoCancellation| is explicitly set to false.
174 std::string value_str; 175 bool echo_constraint;
175 if (!constraints.basic().mediaStreamSource.isEmpty() || 176 if (!constraints.basic().mediaStreamSource.isEmpty() ||
176 !constraints.basic().echoCancellation.matches(true)) { 177 (GetConstraintValueAsBoolean(
178 constraints, &blink::WebMediaTrackConstraintSet::echoCancellation,
179 &echo_constraint) &&
180 echo_constraint == false)) {
177 default_audio_processing_constraint_value_ = false; 181 default_audio_processing_constraint_value_ = false;
178 } 182 }
179 } 183 }
180 184
181 MediaAudioConstraints::~MediaAudioConstraints() {} 185 MediaAudioConstraints::~MediaAudioConstraints() {}
182 186
183 bool MediaAudioConstraints::GetEchoCancellationProperty() const { 187 bool MediaAudioConstraints::GetEchoCancellationProperty() const {
184 // If platform echo canceller is enabled, disable the software AEC. 188 // If platform echo canceller is enabled, disable the software AEC.
185 if (effects_ & media::AudioParameters::ECHO_CANCELLER) 189 if (effects_ & media::AudioParameters::ECHO_CANCELLER)
186 return false; 190 return false;
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 473
470 // Give preference to the audio constraint over the device-supplied mic 474 // Give preference to the audio constraint over the device-supplied mic
471 // positions. This is mainly for testing purposes. 475 // positions. This is mainly for testing purposes.
472 return WebrtcPointsFromMediaPoints( 476 return WebrtcPointsFromMediaPoints(
473 constraints_geometry.empty() 477 constraints_geometry.empty()
474 ? input_params.mic_positions 478 ? input_params.mic_positions
475 : media::ParsePointsFromString(constraints_geometry)); 479 : media::ParsePointsFromString(constraints_geometry));
476 } 480 }
477 481
478 } // namespace content 482 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698