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

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

Issue 1967473004: NetEq: Implement Expand::Muted (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « webrtc/modules/audio_coding/neteq/expand.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_coding/neteq/expand_unittest.cc
diff --git a/webrtc/modules/audio_coding/neteq/expand_unittest.cc b/webrtc/modules/audio_coding/neteq/expand_unittest.cc
index 1441704102dd41d8179d3ffc8d05a568fc1d43a3..3b0efb63d3a59af2cd55c08cf25b9eed702a9992 100644
--- a/webrtc/modules/audio_coding/neteq/expand_unittest.cc
+++ b/webrtc/modules/audio_coding/neteq/expand_unittest.cc
@@ -169,6 +169,38 @@ TEST_F(ExpandTest, CheckOutageStatsAfterReset) {
statistics_.last_outage_duration_ms());
}
+namespace {
+// Runs expand until Muted() returns true. Times out after 1000 calls.
+void ExpandUntilMuted(size_t num_channels, Expand* expand) {
+ EXPECT_FALSE(expand->Muted()) << "Instance is muted from the start";
+ AudioMultiVector output(num_channels);
+ int num_calls = 0;
+ while (!expand->Muted()) {
+ ASSERT_LT(num_calls++, 1000) << "Test timed out";
+ EXPECT_EQ(0, expand->Process(&output));
+ }
+}
+} // namespace
+
+// Verifies that Muted() returns true after a long expand period. Also verifies
+// that Muted() is reset to false after calling Reset(),
+// SetParametersForMergeAfterExpand() and SetParametersForNormalAfterExpand().
+TEST_F(ExpandTest, Muted) {
+ EXPECT_FALSE(expand_.Muted()); // Should start unmuted.
minyue-webrtc 2016/05/10 11:43:12 not needed, since checked in 175 also.
hlundin-webrtc 2016/05/10 11:52:39 Done.
+ ExpandUntilMuted(num_channels_, &expand_);
+ expand_.Reset();
+ EXPECT_FALSE(expand_.Muted()); // Should be back to unmuted.
+
+ ExpandUntilMuted(num_channels_, &expand_);
+ expand_.SetParametersForMergeAfterExpand();
+ EXPECT_FALSE(expand_.Muted()); // Should be back to unmuted.
+
+ expand_.Reset(); // Must reset in order to start a new expand period.
+ ExpandUntilMuted(num_channels_, &expand_);
+ expand_.SetParametersForNormalAfterExpand();
+ EXPECT_FALSE(expand_.Muted()); // Should be back to unmuted.
+}
+
// TODO(hlundin): Write more tests.
} // namespace webrtc
« no previous file with comments | « webrtc/modules/audio_coding/neteq/expand.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698