Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(759)

Unified Diff: webrtc/modules/audio_coding/neteq/normal_unittest.cc

Issue 1901633002: Adding 120 ms frame length support in NetEq. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: fixing two errors Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_coding/neteq/normal_unittest.cc
diff --git a/webrtc/modules/audio_coding/neteq/normal_unittest.cc b/webrtc/modules/audio_coding/neteq/normal_unittest.cc
index f98e99a82d8b80a17806206e6fcc257f5af00d77..5e1fc131e50fbd16ecaa19bbb962d9850218e201 100644
--- a/webrtc/modules/audio_coding/neteq/normal_unittest.cc
+++ b/webrtc/modules/audio_coding/neteq/normal_unittest.cc
@@ -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) {
minyue-webrtc 2016/05/02 10:44:53 this is the second fix
+ 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

Powered by Google App Engine
This is Rietveld 408576698