Adding 120 ms frame length support in NetEq.

BUG=webrtc:1015

Review-Url: https://codereview.webrtc.org/1901633002
Cr-Commit-Position: refs/heads/master@{#12592}
This commit is contained in:
minyue
2016-05-02 04:46:11 -07:00
committed by Commit bot
parent e4246b61b6
commit 5bd3397e53
6 changed files with 288 additions and 20 deletions

View File

@ -27,9 +27,20 @@
#include "webrtc/modules/audio_coding/neteq/sync_buffer.h"
using ::testing::_;
using ::testing::Invoke;
namespace webrtc {
namespace {
int ExpandProcess120ms(AudioMultiVector* output) {
AudioMultiVector dummy_audio(1, 11520u);
dummy_audio.CopyTo(output);
return 0;
}
} // namespace
TEST(Normal, CreateAndDestroy) {
MockDecoderDatabase db;
int fs = 8000;
@ -121,6 +132,45 @@ TEST(Normal, InputLengthAndChannelsDoNotMatch) {
EXPECT_CALL(expand, Die()); // Called when |expand| goes out of scope.
}
TEST(Normal, LastModeExpand120msPacket) {
WebRtcSpl_Init();
MockDecoderDatabase db;
const int kFs = 48000;
const size_t kPacketsizeBytes = 11520u;
const size_t kChannels = 1;
BackgroundNoise bgn(kChannels);
SyncBuffer sync_buffer(kChannels, 1000);
RandomVector random_vector;
StatisticsCalculator statistics;
MockExpand expand(&bgn, &sync_buffer, &random_vector, &statistics, kFs,
kChannels);
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());
EXPECT_CALL(expand, Process(_)).WillOnce(Invoke(ExpandProcess120ms));
EXPECT_CALL(expand, Reset());
EXPECT_EQ(static_cast<int>(kPacketsizeBytes),
normal.Process(input,
kPacketsizeBytes,
kModeExpand,
mute_factor_array.get(),
&output));
EXPECT_EQ(kPacketsizeBytes, output.Size());
EXPECT_CALL(db, Die()); // Called when |db| goes out of scope.
EXPECT_CALL(expand, Die()); // Called when |expand| goes out of scope.
}
// TODO(hlundin): Write more tests.
} // namespace webrtc