| 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 5c61a055cc47fd2e1bc014e2e385ad4af4710c9d..bd730c3f8fe9dd2185f614fa47e40d0e461e6a0e 100644
|
| --- a/content/renderer/media/media_stream_audio_processor_options.cc
|
| +++ b/content/renderer/media/media_stream_audio_processor_options.cc
|
| @@ -51,22 +51,24 @@ struct {
|
| const char* key;
|
| bool value;
|
| } const kDefaultAudioConstraints[] = {
|
| - { MediaAudioConstraints::kEchoCancellation, true },
|
| - { MediaAudioConstraints::kGoogEchoCancellation, true },
|
| + {MediaAudioConstraints::kEchoCancellation, true},
|
| + {MediaAudioConstraints::kGoogEchoCancellation, true},
|
| #if defined(OS_ANDROID) || defined(OS_IOS)
|
| - { MediaAudioConstraints::kGoogExperimentalEchoCancellation, false },
|
| + {MediaAudioConstraints::kGoogExperimentalEchoCancellation, false},
|
| #else
|
| - // Enable the extended filter mode AEC on all non-mobile platforms.
|
| - { MediaAudioConstraints::kGoogExperimentalEchoCancellation, true },
|
| + // Enable the extended filter mode AEC on all non-mobile platforms.
|
| + {MediaAudioConstraints::kGoogExperimentalEchoCancellation, true},
|
| #endif
|
| - { MediaAudioConstraints::kGoogAutoGainControl, true },
|
| - { MediaAudioConstraints::kGoogExperimentalAutoGainControl, true },
|
| - { MediaAudioConstraints::kGoogNoiseSuppression, true },
|
| - { MediaAudioConstraints::kGoogHighpassFilter, true },
|
| - { MediaAudioConstraints::kGoogTypingNoiseDetection, true },
|
| - { MediaAudioConstraints::kGoogExperimentalNoiseSuppression, false },
|
| - { MediaAudioConstraints::kGoogBeamforming, false },
|
| - { kMediaStreamAudioHotword, false },
|
| + {MediaAudioConstraints::kGoogAutoGainControl, true},
|
| + {MediaAudioConstraints::kGoogExperimentalAutoGainControl, true},
|
| + {MediaAudioConstraints::kGoogNoiseSuppression, true},
|
| + {MediaAudioConstraints::kGoogHighpassFilter, true},
|
| + {MediaAudioConstraints::kGoogTypingNoiseDetection, true},
|
| + {MediaAudioConstraints::kGoogExperimentalNoiseSuppression, false},
|
| + // Beamforming will only be enabled if we are also provided with a
|
| + // multi-microphone geometry.
|
| + {MediaAudioConstraints::kGoogBeamforming, false},
|
| + {kMediaStreamAudioHotword, false},
|
| };
|
|
|
| // Used to log echo quality based on delay estimates.
|
| @@ -99,6 +101,20 @@ DelayBasedEchoQuality EchoDelayFrequencyToQuality(float delay_frequency) {
|
| return DELAY_BASED_ECHO_QUALITY_BAD;
|
| }
|
|
|
| +webrtc::Point WebrtcPointFromMediaPoint(const media::Point& point) {
|
| + return webrtc::Point(point.x(), point.y(), point.z());
|
| +}
|
| +
|
| +std::vector<webrtc::Point> WebrtcPointsFromMediaPoints(
|
| + const std::vector<media::Point>& points) {
|
| + std::vector<webrtc::Point> webrtc_points;
|
| + webrtc_points.reserve(webrtc_points.size());
|
| + for (const auto& point : points) {
|
| + webrtc_points.push_back(WebrtcPointFromMediaPoint(point));
|
| + }
|
| + return webrtc_points;
|
| +}
|
| +
|
| } // namespace
|
|
|
| // TODO(xians): Remove this method after the APM in WebRtc is deprecated.
|
| @@ -377,36 +393,19 @@ void GetAecStats(webrtc::EchoCancellation* echo_cancellation,
|
| }
|
| }
|
|
|
| -CONTENT_EXPORT std::vector<webrtc::Point> ParseArrayGeometry(
|
| - const std::string& geometry_string) {
|
| - const auto& tokens =
|
| - base::SplitString(geometry_string, base::kWhitespaceASCII,
|
| - base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
|
| - std::vector<webrtc::Point> geometry;
|
| - if (tokens.size() < 3 || tokens.size() % 3 != 0) {
|
| - LOG(ERROR) << "Malformed geometry string: " << geometry_string;
|
| - return geometry;
|
| - }
|
| -
|
| - std::vector<float> float_tokens;
|
| - float_tokens.reserve(tokens.size());
|
| - for (const auto& token : tokens) {
|
| - double float_token;
|
| - if (!base::StringToDouble(token, &float_token)) {
|
| - LOG(ERROR) << "Unable to convert token=" << token
|
| - << " to double from geometry string: " << geometry_string;
|
| - return geometry;
|
| - }
|
| - float_tokens.push_back(float_token);
|
| - }
|
| -
|
| - geometry.reserve(float_tokens.size() / 3);
|
| - for (size_t i = 0; i < float_tokens.size(); i += 3) {
|
| - geometry.push_back(webrtc::Point(float_tokens[i + 0], float_tokens[i + 1],
|
| - float_tokens[i + 2]));
|
| - }
|
| -
|
| - return geometry;
|
| +std::vector<webrtc::Point> GetArrayGeometryPreferringConstraints(
|
| + const MediaAudioConstraints& audio_constraints,
|
| + const MediaStreamDevice::AudioDeviceParameters& input_params) {
|
| + const std::string& constraints_geometry =
|
| + audio_constraints.GetPropertyAsString(
|
| + MediaAudioConstraints::kGoogArrayGeometry);
|
| +
|
| + // Give preference to the audio constraint over the device-supplied mic
|
| + // positions. This is mainly for testing purposes.
|
| + return WebrtcPointsFromMediaPoints(
|
| + constraints_geometry.empty()
|
| + ? input_params.mic_positions
|
| + : media::ParsePointsFromString(constraints_geometry));
|
| }
|
|
|
| } // namespace content
|
|
|