Commit 0ab64718 authored by Max Morin's avatar Max Morin Committed by Commit Bot

Remove googBeamforming and googArrayGeometry.

Drive-by fix some lint.

Bug: 851940, 856176
Change-Id: Ia42c0902b58cd278afc2c4703a50982204ef75b8
Reviewed-on: https://chromium-review.googlesource.com/1099235
Commit-Queue: Max Morin <maxmorin@chromium.org>
Reviewed-by: default avatarGuido Urdaneta <guidou@chromium.org>
Reviewed-by: default avatarPhilip Jägenstedt <foolip@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570088}
parent d82fcd88
......@@ -412,8 +412,9 @@ void MediaStreamAudioProcessor::OnAecDumpFile(
// webrtc::AudioProcessing instance is destroyed.
StartEchoCancellationDump(audio_processing_.get(), std::move(file),
worker_queue_.get());
} else
} else {
file.Close();
}
}
void MediaStreamAudioProcessor::OnDisableAecDump() {
......
......@@ -67,11 +67,6 @@ AudioProcessingProperties::AudioProcessingProperties(
const AudioProcessingProperties& other) = default;
AudioProcessingProperties& AudioProcessingProperties::operator=(
const AudioProcessingProperties& other) = default;
AudioProcessingProperties::AudioProcessingProperties(
AudioProcessingProperties&& other) = default;
AudioProcessingProperties& AudioProcessingProperties::operator=(
AudioProcessingProperties&& other) = default;
AudioProcessingProperties::~AudioProcessingProperties() = default;
void AudioProcessingProperties::DisableDefaultProperties() {
enable_sw_echo_cancellation = false;
......@@ -81,7 +76,6 @@ void AudioProcessingProperties::DisableDefaultProperties() {
goog_typing_noise_detection = false;
goog_noise_suppression = false;
goog_experimental_noise_suppression = false;
goog_beamforming = false;
goog_highpass_filter = false;
goog_experimental_auto_gain_control = false;
}
......
......@@ -38,9 +38,6 @@ struct CONTENT_EXPORT AudioProcessingProperties {
AudioProcessingProperties();
AudioProcessingProperties(const AudioProcessingProperties& other);
AudioProcessingProperties& operator=(const AudioProcessingProperties& other);
AudioProcessingProperties(AudioProcessingProperties&& other);
AudioProcessingProperties& operator=(AudioProcessingProperties&& other);
~AudioProcessingProperties();
// Disables properties that are enabled by default.
void DisableDefaultProperties();
......@@ -60,10 +57,8 @@ struct CONTENT_EXPORT AudioProcessingProperties {
bool goog_typing_noise_detection = true;
bool goog_noise_suppression = true;
bool goog_experimental_noise_suppression = true;
bool goog_beamforming = true;
bool goog_highpass_filter = true;
bool goog_experimental_auto_gain_control = true;
std::vector<media::Point> goog_array_geometry;
};
// A helper class to log echo information in general and Echo Cancellation
......
......@@ -44,7 +44,6 @@ enum BoolConstraint {
GOOG_TYPING_NOISE_DETECTION,
GOOG_NOISE_SUPPRESSION,
GOOG_EXPERIMENTAL_NOISE_SUPPRESSION,
GOOG_BEAMFORMING,
GOOG_HIGHPASS_FILTER,
GOOG_EXPERIMENTAL_AUTO_GAIN_CONTROL,
NUM_BOOL_CONSTRAINTS
......@@ -70,37 +69,10 @@ const AudioPropertyConstraintPair kAudioPropertyConstraintMap[] = {
GOOG_NOISE_SUPPRESSION},
{&AudioProcessingProperties::goog_experimental_noise_suppression,
GOOG_EXPERIMENTAL_NOISE_SUPPRESSION},
{&AudioProcessingProperties::goog_beamforming, GOOG_BEAMFORMING},
{&AudioProcessingProperties::goog_highpass_filter, GOOG_HIGHPASS_FILTER},
{&AudioProcessingProperties::goog_experimental_auto_gain_control,
GOOG_EXPERIMENTAL_AUTO_GAIN_CONTROL}};
// TODO(guidou): Remove this function. http://crbug.com/796955
std::string MediaPointToString(const media::Point& point) {
std::string point_string;
point_string.append(base::NumberToString(point.x()));
point_string.append(" ");
point_string.append(base::NumberToString(point.y()));
point_string.append(" ");
point_string.append(base::NumberToString(point.z()));
return point_string;
}
// TODO(guidou): Remove this function. http://crbug.com/796955
std::string MediaPointsToString(const std::vector<media::Point>& points) {
std::string points_string;
if (!points.empty()) {
for (size_t i = 0; i < points.size() - 1; ++i) {
points_string.append(MediaPointToString(points[i]));
points_string.append(" ");
}
points_string.append(MediaPointToString(points.back()));
}
return points_string;
}
// Selects the best value from the nonempty |set|, subject to |constraint|. The
// first selection criteria is equality to |constraint.Ideal()|, followed by
// equality to |default_value|. There is always a single best value.
......@@ -156,27 +128,6 @@ std::string SelectString(const DiscreteSet<std::string>& set,
return set.FirstElement();
}
// Selects the best value from the nonempty |set|, subject to |constraint|. The
// only decision criteria is inclusion in |constraint.Ideal()|. If there is no
// single best value in |set|, returns nullopt.
base::Optional<std::string> SelectOptionalString(
const DiscreteSet<std::string>& set,
const blink::StringConstraint& constraint) {
DCHECK(!set.IsEmpty());
if (constraint.HasIdeal()) {
for (const auto& ideal_candidate : constraint.Ideal()) {
std::string candidate = ideal_candidate.Utf8();
if (set.Contains(candidate))
return candidate;
}
}
if (set.is_universal())
return base::Optional<std::string>();
return set.FirstElement();
}
bool SelectUseEchoCancellation(base::Optional<bool> echo_cancellation,
base::Optional<bool> goog_echo_cancellation,
bool is_device_capture) {
......@@ -291,15 +242,6 @@ class SingleDeviceCandidateSet {
DCHECK(!bool_set.IsEmpty());
}
#endif
// This fails with input strings that are equivalent to
// |properties.goog_array_geometry|, but not exactly equal to the string
// returned by MediaPointsToString().
// TODO(guidou): Change |goog_array_geometry_set_| to be a set of vectors of
// points instead of a set of strings. http://crbug.com/796955
std::string mic_positions =
MediaPointsToString(properties.goog_array_geometry);
goog_array_geometry_set_ = DiscreteSet<std::string>({mic_positions});
}
// Accessors
......@@ -326,14 +268,6 @@ class SingleDeviceCandidateSet {
return;
}
goog_array_geometry_set_ = goog_array_geometry_set_.Intersection(
media_constraints::StringSetFromConstraint(
constraint_set.goog_array_geometry));
if (goog_array_geometry_set_.IsEmpty()) {
failed_constraint_name_ = constraint_set.goog_array_geometry.GetName();
return;
}
for (size_t i = 0; i < NUM_BOOL_CONSTRAINTS; ++i) {
bool_sets_[i] =
bool_sets_[i].Intersection(media_constraints::BoolSetFromConstraint(
......@@ -407,16 +341,6 @@ class SingleDeviceCandidateSet {
}
}
if (constraint_set.goog_array_geometry.HasIdeal()) {
for (const blink::WebString& ideal_value :
constraint_set.goog_array_geometry.Ideal()) {
if (goog_array_geometry_set_.Contains(ideal_value.Utf8())) {
fitness += 1.0;
break;
}
}
}
// If echo cancellation constraint is not set to true, the type shall be
// ignored.
if ((constraint_set.*kBlinkBoolConstraintFields[ECHO_CANCELLATION])
......@@ -564,18 +488,6 @@ class SingleDeviceCandidateSet {
default_audio_processing_value && properties.*entry.audio_property);
}
base::Optional<std::string> array_geometry = SelectOptionalString(
goog_array_geometry_set_, basic_constraint_set.goog_array_geometry);
std::vector<media::Point> parsed_positions;
if (array_geometry)
parsed_positions = media::ParsePointsFromString(*array_geometry);
bool are_valid_parsed_positions =
!parsed_positions.empty() ||
(array_geometry && array_geometry->empty());
properties.goog_array_geometry = are_valid_parsed_positions
? std::move(parsed_positions)
: parameters_.mic_positions();
return properties;
}
......@@ -595,7 +507,6 @@ class SingleDeviceCandidateSet {
&blink::WebMediaTrackConstraintSet::goog_noise_suppression,
&blink::WebMediaTrackConstraintSet::
goog_experimental_noise_suppression,
&blink::WebMediaTrackConstraintSet::goog_beamforming,
&blink::WebMediaTrackConstraintSet::goog_highpass_filter,
&blink::WebMediaTrackConstraintSet::
goog_experimental_auto_gain_control};
......@@ -604,7 +515,6 @@ class SingleDeviceCandidateSet {
DiscreteSet<std::string> device_id_set_;
DiscreteSet<std::string> group_id_set_;
std::array<DiscreteSet<bool>, NUM_BOOL_CONSTRAINTS> bool_sets_;
DiscreteSet<std::string> goog_array_geometry_set_;
DiscreteSet<std::string> echo_cancellation_type_set_;
media::AudioParameters parameters_;
};
......
......@@ -39,7 +39,6 @@ void MockConstraintFactory::DisableDefaultAudioConstraints() {
basic_.goog_highpass_filter.SetExact(false);
basic_.goog_typing_noise_detection.SetExact(false);
basic_.goog_experimental_noise_suppression.SetExact(false);
basic_.goog_beamforming.SetExact(false);
}
void MockConstraintFactory::DisableAecAudioConstraints() {
......
......@@ -870,10 +870,8 @@ TEST_F(UserMediaClientImplTest, DefaultConstraintsPropagate) {
EXPECT_TRUE(properties.goog_typing_noise_detection);
EXPECT_TRUE(properties.goog_noise_suppression);
EXPECT_TRUE(properties.goog_experimental_noise_suppression);
EXPECT_TRUE(properties.goog_beamforming);
EXPECT_TRUE(properties.goog_highpass_filter);
EXPECT_TRUE(properties.goog_experimental_auto_gain_control);
EXPECT_TRUE(properties.goog_array_geometry.empty());
EXPECT_TRUE(video_capture_settings.HasValue());
EXPECT_EQ(video_capture_settings.Width(),
......@@ -936,10 +934,8 @@ TEST_F(UserMediaClientImplTest, DefaultTabCapturePropagate) {
EXPECT_FALSE(properties.goog_typing_noise_detection);
EXPECT_FALSE(properties.goog_noise_suppression);
EXPECT_FALSE(properties.goog_experimental_noise_suppression);
EXPECT_FALSE(properties.goog_beamforming);
EXPECT_FALSE(properties.goog_highpass_filter);
EXPECT_FALSE(properties.goog_experimental_auto_gain_control);
EXPECT_TRUE(properties.goog_array_geometry.empty());
EXPECT_TRUE(video_capture_settings.HasValue());
EXPECT_EQ(video_capture_settings.Width(), kDefaultScreenCastWidth);
......@@ -999,10 +995,8 @@ TEST_F(UserMediaClientImplTest, DefaultDesktopCapturePropagate) {
EXPECT_FALSE(properties.goog_typing_noise_detection);
EXPECT_FALSE(properties.goog_noise_suppression);
EXPECT_FALSE(properties.goog_experimental_noise_suppression);
EXPECT_FALSE(properties.goog_beamforming);
EXPECT_FALSE(properties.goog_highpass_filter);
EXPECT_FALSE(properties.goog_experimental_auto_gain_control);
EXPECT_TRUE(properties.goog_array_geometry.empty());
EXPECT_TRUE(video_capture_settings.HasValue());
EXPECT_EQ(video_capture_settings.Width(), kDefaultScreenCastWidth);
......@@ -1038,8 +1032,6 @@ TEST_F(UserMediaClientImplTest, NonDefaultAudioConstraintsPropagate) {
factory.basic().echo_cancellation.SetExact(false);
factory.basic().goog_audio_mirroring.SetExact(true);
factory.basic().goog_typing_noise_detection.SetExact(true);
factory.basic().goog_array_geometry.SetExact(
blink::WebString::FromASCII("1 1 1"));
blink::WebMediaConstraints audio_constraints =
factory.CreateWebMediaConstraints();
// Request contains only audio
......@@ -1071,11 +1063,8 @@ TEST_F(UserMediaClientImplTest, NonDefaultAudioConstraintsPropagate) {
EXPECT_TRUE(properties.goog_typing_noise_detection);
EXPECT_FALSE(properties.goog_noise_suppression);
EXPECT_FALSE(properties.goog_experimental_noise_suppression);
EXPECT_FALSE(properties.goog_beamforming);
EXPECT_FALSE(properties.goog_highpass_filter);
EXPECT_FALSE(properties.goog_experimental_auto_gain_control);
const std::vector<media::Point> kGeometry = {{1.0, 1.0, 1.0}};
EXPECT_EQ(kGeometry, properties.goog_array_geometry);
}
TEST_F(UserMediaClientImplTest, CreateWithMandatoryInvalidAudioDeviceId) {
......
......@@ -6,12 +6,6 @@
#include <stddef.h>
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
namespace media {
std::string PointsToString(const std::vector<Point>& points) {
......@@ -26,38 +20,4 @@ std::string PointsToString(const std::vector<Point>& points) {
return points_string;
}
std::vector<Point> ParsePointsFromString(const std::string& points_string) {
std::vector<Point> points;
if (points_string.empty())
return points;
const auto& tokens =
base::SplitString(points_string, base::kWhitespaceASCII,
base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
if (tokens.size() < 3 || tokens.size() % 3 != 0) {
LOG(ERROR) << "Malformed points string: " << points_string;
return points;
}
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 points string: " << points_string;
return points;
}
float_tokens.push_back(float_token);
}
points.reserve(float_tokens.size() / 3);
for (size_t i = 0; i < float_tokens.size(); i += 3) {
points.push_back(
Point(float_tokens[i + 0], float_tokens[i + 1], float_tokens[i + 2]));
}
return points;
}
} // namespace media
......@@ -15,13 +15,6 @@ namespace media {
using Point = gfx::Point3F;
// Returns a vector of points parsed from a whitespace-separated string
// formatted as: "x1 y1 z1 ... zn yn zn" for n points.
//
// Returns an empty vector if |points_string| is empty or isn't parseable.
MEDIA_SHMEM_EXPORT std::vector<Point> ParsePointsFromString(
const std::string& points_string);
// Returns |points| as a human-readable string. (Not necessarily in the format
// required by ParsePointsFromString).
MEDIA_SHMEM_EXPORT std::string PointsToString(const std::vector<Point>& points);
......
......@@ -19,23 +19,5 @@ TEST(PointTest, PointsToString) {
EXPECT_EQ("", PointsToString(std::vector<Point>()));
}
TEST(PointTest, ParsePointString) {
const std::vector<Point> expected_empty;
EXPECT_EQ(expected_empty, ParsePointsFromString(""));
EXPECT_EQ(expected_empty, ParsePointsFromString("0 0 a"));
EXPECT_EQ(expected_empty, ParsePointsFromString("1 2"));
EXPECT_EQ(expected_empty, ParsePointsFromString("1 2 3 4"));
{
std::vector<Point> expected(1, Point(-0.02f, 0, 0));
expected.push_back(Point(0.02f, 0, 0));
EXPECT_EQ(expected, ParsePointsFromString("-0.02 0 0 0.02 0 0"));
}
{
std::vector<Point> expected(1, Point(1, 2, 3));
EXPECT_EQ(expected, ParsePointsFromString("1 2 3"));
}
}
} // namespace
} // namespace media
......@@ -257,8 +257,6 @@ struct WebMediaTrackConstraintSet {
BooleanConstraint goog_highpass_filter;
BooleanConstraint goog_typing_noise_detection;
BooleanConstraint goog_experimental_noise_suppression;
BooleanConstraint goog_beamforming;
StringConstraint goog_array_geometry;
BooleanConstraint goog_audio_mirroring;
BooleanConstraint goog_da_echo_cancellation;
BooleanConstraint goog_noise_reduction;
......
......@@ -340,10 +340,6 @@ static void ParseOldStyleNames(
} else if (constraint.name_.Equals(kGoogExperimentalNoiseSuppression)) {
result.goog_experimental_noise_suppression.SetExact(
ToBoolean(constraint.value_));
} else if (constraint.name_.Equals(kGoogBeamforming)) {
result.goog_beamforming.SetExact(ToBoolean(constraint.value_));
} else if (constraint.name_.Equals(kGoogArrayGeometry)) {
result.goog_array_geometry.SetExact(constraint.value_);
} else if (constraint.name_.Equals(kGoogHighpassFilter)) {
result.goog_highpass_filter.SetExact(ToBoolean(constraint.value_));
} else if (constraint.name_.Equals(kGoogTypingNoiseDetection)) {
......@@ -435,7 +431,11 @@ static void ParseOldStyleNames(
} else if (constraint.name_.Equals(kPowerLineFrequency)) {
result.goog_power_line_frequency.SetExact(
atoi(constraint.value_.Utf8().c_str()));
} else if (constraint.name_.Equals(kGoogLeakyBucket)) {
} else if (constraint.name_.Equals(kGoogLeakyBucket) ||
constraint.name_.Equals(kGoogBeamforming) ||
constraint.name_.Equals(kGoogArrayGeometry)) {
// TODO(crbug.com/856176): Remove the kGoogBeamforming and
// kGoogArrayGeometry special cases.
context->AddConsoleMessage(ConsoleMessage::Create(
kDeprecationMessageSource, kWarningMessageLevel,
"Obsolete constraint named " + String(constraint.name_) +
......@@ -464,6 +464,7 @@ static void ParseOldStyleNames(
kDeprecationMessageSource, kWarningMessageLevel,
"Unknown constraint named " + String(constraint.name_) +
" rejected"));
// TODO(crbug.com/856176): Don't throw an error.
error_state.ThrowConstraintError("Unknown name of constraint detected",
constraint.name_);
}
......
......@@ -106,7 +106,7 @@ class FeatureCounter {
WTF_MAKE_NONCOPYABLE(FeatureCounter);
public:
FeatureCounter(ExecutionContext* context)
explicit FeatureCounter(ExecutionContext* context)
: context_(context), is_unconstrained_(true) {}
void Count(WebFeature feature) {
UseCounter::Count(context_, feature);
......@@ -206,14 +206,6 @@ void CountAudioConstraintUses(ExecutionContext* context,
counter.Count(
WebFeature::kMediaStreamConstraintsGoogExperimentalNoiseSuppression);
}
if (RequestUsesDiscreteConstraint(
constraints, &WebMediaTrackConstraintSet::goog_beamforming)) {
counter.Count(WebFeature::kMediaStreamConstraintsGoogBeamforming);
}
if (RequestUsesDiscreteConstraint(
constraints, &WebMediaTrackConstraintSet::goog_array_geometry)) {
counter.Count(WebFeature::kMediaStreamConstraintsGoogArrayGeometry);
}
if (RequestUsesDiscreteConstraint(
constraints, &WebMediaTrackConstraintSet::goog_audio_mirroring)) {
counter.Count(WebFeature::kMediaStreamConstraintsGoogAudioMirroring);
......
......@@ -377,8 +377,6 @@ WebMediaTrackConstraintSet::WebMediaTrackConstraintSet()
goog_highpass_filter("googHighpassFilter"),
goog_typing_noise_detection("googTypingNoiseDetection"),
goog_experimental_noise_suppression("googExperimentalNoiseSuppression"),
goog_beamforming("googBeamforming"),
goog_array_geometry("googArrayGeometry"),
goog_audio_mirroring("googAudioMirroring"),
goog_da_echo_cancellation("googDAEchoCancellation"),
goog_noise_reduction("googNoiseReduction"),
......@@ -441,8 +439,6 @@ std::vector<const BaseConstraint*> WebMediaTrackConstraintSet::AllConstraints()
&goog_highpass_filter,
&goog_typing_noise_detection,
&goog_experimental_noise_suppression,
&goog_beamforming,
&goog_array_geometry,
&goog_audio_mirroring,
&goog_da_echo_cancellation,
&goog_noise_reduction,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment