NetEq: Change NetEq's ramp-up behavior after expansions
NetEq tapers down the audio produced through loss concealment when the
expansion has been going on for some time. When the audio packets starts
coming in again, there is a ramp-up that happens. This ramp-up could
before this change extend over more than one 10 ms block, which made
keeping track of the scaling factor necessary. With this change, we make
this ramp-up quicker in the rare cases when it lasted more than 10 ms,
so that it always ramps up to 100% within one block. This way, we can
remove the mute_factor_array.
This change breaks bit-exactness, but careful listening could not reveal
an audible difference.
This change is a part of a larger refactoring of NetEq's PLC code.
Bug: webrtc:9180
Change-Id: I4c513ce3ed8d66f9beec2abfb1f0c7ffaac7a21e
Reviewed-on: https://webrtc-review.googlesource.com/77180
Commit-Queue: Henrik Lundin <henrik.lundin@webrtc.org>
Reviewed-by: Minyue Li <minyue@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23342}
diff --git a/modules/audio_coding/neteq/normal_unittest.cc b/modules/audio_coding/neteq/normal_unittest.cc
index b0655d9..ab99d9a 100644
--- a/modules/audio_coding/neteq/normal_unittest.cc
+++ b/modules/audio_coding/neteq/normal_unittest.cc
@@ -68,16 +68,10 @@
Normal normal(fs, &db, bgn, &expand);
int16_t input[1000] = {0};
- std::unique_ptr<int16_t[]> mute_factor_array(new int16_t[channels]);
- for (size_t i = 0; i < channels; ++i) {
- mute_factor_array[i] = 16384;
- }
AudioMultiVector output(channels);
// Zero input length.
- EXPECT_EQ(
- 0,
- normal.Process(input, 0, kModeExpand, mute_factor_array.get(), &output));
+ EXPECT_EQ(0, normal.Process(input, 0, kModeExpand, &output));
EXPECT_EQ(0u, output.Size());
// Try to make energy_length >> scaling = 0;
@@ -93,7 +87,6 @@
normal.Process(input,
input_size_samples,
kModeExpand,
- mute_factor_array.get(),
&output));
EXPECT_CALL(db, Die()); // Called when |db| goes out of scope.
@@ -114,18 +107,11 @@
Normal normal(fs, &db, bgn, &expand);
int16_t input[1000] = {0};
- std::unique_ptr<int16_t[]> mute_factor_array(new int16_t[channels]);
- for (size_t i = 0; i < channels; ++i) {
- mute_factor_array[i] = 16384;
- }
AudioMultiVector output(channels);
// Let the number of samples be one sample less than 80 samples per channel.
size_t input_len = 80 * channels - 1;
- EXPECT_EQ(
- 0,
- normal.Process(
- input, input_len, kModeExpand, mute_factor_array.get(), &output));
+ EXPECT_EQ(0, normal.Process(input, input_len, kModeExpand, &output));
EXPECT_EQ(0u, output.Size());
EXPECT_CALL(db, Die()); // Called when |db| goes out of scope.
@@ -147,12 +133,6 @@
Normal normal(kFs, &db, bgn, &expand);
int16_t input[kPacketsizeBytes] = {0};
-
- std::unique_ptr<int16_t[]> mute_factor_array(new int16_t[kChannels]);
- for (size_t i = 0; i < kChannels; ++i) {
- mute_factor_array[i] = 16384;
- }
-
AudioMultiVector output(kChannels);
EXPECT_CALL(expand, SetParametersForNormalAfterExpand());
@@ -162,7 +142,6 @@
normal.Process(input,
kPacketsizeBytes,
kModeExpand,
- mute_factor_array.get(),
&output));
EXPECT_EQ(kPacketsizeBytes, output.Size());