Commit 267932b7 authored by Armando Miraglia's avatar Armando Miraglia Committed by Commit Bot

[getUserMedia] Merge googAutoGainControl and googAutoGainControl2.

Internally, the Audio Processing Module (APM) needs to treat both Auto
Gain Control (AGC) settings as they were one since the implementation does
allow to configure different types of AGCs, but rather a single "best
possible" AGC.

For this reason, this CL merges the two constraints to generate a single
AGC setting. The behavior might break applications only when these two
conditions are meat:
a) both constraints are provided as required, and
b) they contradict each other.

A followup CL will take care of entirely removing the internal property
"goog_experimental_auto_gain_control" when APM does not rely on it any
longer.

Bug: 924485
Change-Id: I280dff85870e0ce8cf557265f22ec98b6cf0acfa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2041758Reviewed-by: default avatarGuido Urdaneta <guidou@chromium.org>
Commit-Queue: Armando Miraglia <armax@chromium.org>
Cr-Commit-Position: refs/heads/master@{#739398}
parent badd596f
...@@ -213,7 +213,23 @@ class MediaStreamConstraintsUtilAudioTestBase { ...@@ -213,7 +213,23 @@ class MediaStreamConstraintsUtilAudioTestBase {
} }
if (!Contains(exclude_audio_properties, if (!Contains(exclude_audio_properties,
&AudioProcessingProperties::goog_auto_gain_control)) { &AudioProcessingProperties::goog_auto_gain_control)) {
EXPECT_TRUE(properties.goog_auto_gain_control); EXPECT_EQ(properties.goog_auto_gain_control,
properties.goog_experimental_auto_gain_control);
if (!Contains(exclude_audio_properties,
&AudioProcessingProperties::
goog_experimental_auto_gain_control)) {
EXPECT_TRUE(properties.goog_auto_gain_control);
}
}
if (!Contains(
exclude_audio_properties,
&AudioProcessingProperties::goog_experimental_auto_gain_control)) {
EXPECT_EQ(properties.goog_auto_gain_control,
properties.goog_experimental_auto_gain_control);
if (!Contains(exclude_audio_properties,
&AudioProcessingProperties::goog_auto_gain_control)) {
EXPECT_TRUE(properties.goog_experimental_auto_gain_control);
}
} }
if (!Contains( if (!Contains(
exclude_audio_properties, exclude_audio_properties,
...@@ -233,11 +249,6 @@ class MediaStreamConstraintsUtilAudioTestBase { ...@@ -233,11 +249,6 @@ class MediaStreamConstraintsUtilAudioTestBase {
&AudioProcessingProperties::goog_highpass_filter)) { &AudioProcessingProperties::goog_highpass_filter)) {
EXPECT_TRUE(properties.goog_highpass_filter); EXPECT_TRUE(properties.goog_highpass_filter);
} }
if (!Contains(
exclude_audio_properties,
&AudioProcessingProperties::goog_experimental_auto_gain_control)) {
EXPECT_TRUE(properties.goog_experimental_auto_gain_control);
}
} }
void CheckBoolDefaultsContentCapture( void CheckBoolDefaultsContentCapture(
...@@ -261,7 +272,23 @@ class MediaStreamConstraintsUtilAudioTestBase { ...@@ -261,7 +272,23 @@ class MediaStreamConstraintsUtilAudioTestBase {
} }
if (!Contains(exclude_audio_properties, if (!Contains(exclude_audio_properties,
&AudioProcessingProperties::goog_auto_gain_control)) { &AudioProcessingProperties::goog_auto_gain_control)) {
EXPECT_FALSE(properties.goog_auto_gain_control); EXPECT_EQ(properties.goog_auto_gain_control,
properties.goog_experimental_auto_gain_control);
if (!Contains(exclude_audio_properties,
&AudioProcessingProperties::
goog_experimental_auto_gain_control)) {
EXPECT_FALSE(properties.goog_auto_gain_control);
}
}
if (!Contains(
exclude_audio_properties,
&AudioProcessingProperties::goog_experimental_auto_gain_control)) {
EXPECT_EQ(properties.goog_auto_gain_control,
properties.goog_experimental_auto_gain_control);
if (!Contains(exclude_audio_properties,
&AudioProcessingProperties::goog_auto_gain_control)) {
EXPECT_FALSE(properties.goog_experimental_auto_gain_control);
}
} }
if (!Contains( if (!Contains(
exclude_audio_properties, exclude_audio_properties,
...@@ -281,11 +308,6 @@ class MediaStreamConstraintsUtilAudioTestBase { ...@@ -281,11 +308,6 @@ class MediaStreamConstraintsUtilAudioTestBase {
&AudioProcessingProperties::goog_highpass_filter)) { &AudioProcessingProperties::goog_highpass_filter)) {
EXPECT_FALSE(properties.goog_highpass_filter); EXPECT_FALSE(properties.goog_highpass_filter);
} }
if (!Contains(
exclude_audio_properties,
&AudioProcessingProperties::goog_experimental_auto_gain_control)) {
EXPECT_FALSE(properties.goog_experimental_auto_gain_control);
}
} }
void CheckBoolDefaults( void CheckBoolDefaults(
...@@ -1446,6 +1468,23 @@ TEST_P(MediaStreamConstraintsUtilAudioTest, ContradictoryEchoCancellation) { ...@@ -1446,6 +1468,23 @@ TEST_P(MediaStreamConstraintsUtilAudioTest, ContradictoryEchoCancellation) {
} }
} }
// Test that having differing mandatory values for googAutoGainControl and
// googAutoGainControl2 fails. This test is valid to correctly support the
// old syntax.
TEST_P(MediaStreamConstraintsUtilAudioTest, ContradictoryAutoGainControl) {
// TODO(armax): fix this.
for (bool value : kBoolValues) {
constraint_factory_.basic().goog_auto_gain_control.SetExact(value);
constraint_factory_.basic().goog_experimental_auto_gain_control.SetExact(
!value);
auto result = SelectSettings();
EXPECT_FALSE(result.HasValue());
EXPECT_EQ(result.failed_constraint_name(),
constraint_factory_.basic()
.goog_experimental_auto_gain_control.GetName());
}
}
// Tests that individual boolean audio-processing constraints override the // Tests that individual boolean audio-processing constraints override the
// default value set by the echoCancellation constraint. // default value set by the echoCancellation constraint.
TEST_P(MediaStreamConstraintsUtilAudioTest, TEST_P(MediaStreamConstraintsUtilAudioTest,
...@@ -1488,6 +1527,15 @@ TEST_P(MediaStreamConstraintsUtilAudioTest, ...@@ -1488,6 +1527,15 @@ TEST_P(MediaStreamConstraintsUtilAudioTest,
for (size_t j = 0; j < kAudioProcessingProperties.size(); ++j) { for (size_t j = 0; j < kAudioProcessingProperties.size(); ++j) {
if (i == j) if (i == j)
continue; continue;
// goog_auto_gain_control and goog_experimental_auto_gain_control
// should always match in value.
if ((i == 1 && j == 6) || (i == 6 && j == 1)) {
EXPECT_EQ(result.audio_processing_properties().*
kAudioProcessingProperties[i],
result.audio_processing_properties().*
kAudioProcessingProperties[j]);
continue;
}
EXPECT_FALSE(result.audio_processing_properties().* EXPECT_FALSE(result.audio_processing_properties().*
kAudioProcessingProperties[j]); kAudioProcessingProperties[j]);
} }
......
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