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

Unified Diff: webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus_unittest.cc

Issue 2594563002: Add a unit test for Opus complexity adaptation (Closed)
Patch Set: Created 4 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus_unittest.cc
diff --git a/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus_unittest.cc b/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus_unittest.cc
index 9f2c3186bdf2085d0a69bbdcf643d84c5752669e..e8bfaf6830cca7dff72f7ef749b9b46ad8173634 100644
--- a/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus_unittest.cc
+++ b/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus_unittest.cc
@@ -421,4 +421,26 @@ TEST(AudioEncoderOpusTest, BitrateBounded) {
EXPECT_EQ(kMaxBitrateBps, states.encoder->GetTargetBitrate());
}
+// Verifies that the complexity adaptation in the config works as intended.
+TEST(AudioEncoderOpusTest, ConfigComplexityAdaptation) {
+ AudioEncoderOpus::Config config;
+ config.low_rate_complexity = 8;
+ config.complexity = 6;
+
+ // Bitrate within hysteresis window. Expect empty output.
+ config.bitrate_bps = rtc::Optional<int>(12500);
+ EXPECT_EQ(rtc::Optional<int>(), config.GetNewComplexity());
+
+ // Bitrate below hysteresis window. Expect higher complexity.
+ config.bitrate_bps = rtc::Optional<int>(10999);
+ EXPECT_EQ(rtc::Optional<int>(8), config.GetNewComplexity());
+
+ // Bitrate within hysteresis window. Expect empty output.
+ config.bitrate_bps = rtc::Optional<int>(12500);
+ EXPECT_EQ(rtc::Optional<int>(), config.GetNewComplexity());
+
+ // Bitrate above hysteresis window. Expect lower complexity.
+ config.bitrate_bps = rtc::Optional<int>(14001);
+ EXPECT_EQ(rtc::Optional<int>(6), config.GetNewComplexity());
+}
} // namespace webrtc
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698