Add field trial and test for NetEq extra delay

Adding field trial WebRTC-Audio-NetEqExtraDelay with a parameter value
to set the extra delay in NetEq. This overrides the
extra_output_delay_ms parameter in NetEq::Config.

Bug: b/156734419
Change-Id: Iae7d439fafa3059494249959ac13a02de63d6b7a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176858
Commit-Queue: Henrik Lundin <henrik.lundin@webrtc.org>
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31493}
This commit is contained in:
Henrik Lundin
2020-06-10 18:19:27 +02:00
committed by Commit Bot
parent 9276e2c39b
commit f7cba9f132
3 changed files with 55 additions and 6 deletions

View File

@ -1253,5 +1253,35 @@ TEST(NetEqOutputDelayTest, RunTest) {
}
}
// Tests the extra output delay functionality of NetEq when configured via
// field trial.
TEST(NetEqOutputDelayTest, RunTestWithFieldTrial) {
test::ScopedFieldTrials field_trial(
"WebRTC-Audio-NetEqExtraDelay/Enabled-50/");
constexpr int kExpectedDelayMs = 50;
std::vector<int16_t> output;
const auto result = DelayLineNetEqTest(0, &output);
// The base delay values are taken from the resuts of the non-delayed case in
// NetEqOutputDelayTest.RunTest above.
EXPECT_EQ(10 + kExpectedDelayMs, result.target_delay_ms);
EXPECT_EQ(24 + kExpectedDelayMs, result.filtered_current_delay_ms);
}
// Set a non-multiple-of-10 value in the field trial, and verify that we don't
// crash, and that the result is rounded down.
TEST(NetEqOutputDelayTest, RunTestWithFieldTrialOddValue) {
test::ScopedFieldTrials field_trial(
"WebRTC-Audio-NetEqExtraDelay/Enabled-103/");
constexpr int kRoundedDelayMs = 100;
std::vector<int16_t> output;
const auto result = DelayLineNetEqTest(0, &output);
// The base delay values are taken from the resuts of the non-delayed case in
// NetEqOutputDelayTest.RunTest above.
EXPECT_EQ(10 + kRoundedDelayMs, result.target_delay_ms);
EXPECT_EQ(24 + kRoundedDelayMs, result.filtered_current_delay_ms);
}
} // namespace test
} // namespace webrtc