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

Unified Diff: webrtc/logging/rtc_event_log/rtc_event_log_unittest.cc

Issue 2644863002: Reland of "Log audio network adapter decisions in event log." (Closed)
Patch Set: rebase Created 3 years, 11 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/logging/rtc_event_log/rtc_event_log_unittest.cc
diff --git a/webrtc/logging/rtc_event_log/rtc_event_log_unittest.cc b/webrtc/logging/rtc_event_log/rtc_event_log_unittest.cc
index 15404667856ed9bace4c3eb173061e2fc0921635..f0ee973a136fad18308332f033ab6ff02b1d6dd8 100644
--- a/webrtc/logging/rtc_event_log/rtc_event_log_unittest.cc
+++ b/webrtc/logging/rtc_event_log/rtc_event_log_unittest.cc
@@ -228,6 +228,19 @@ void GenerateAudioSendConfig(uint32_t extensions_bitvector,
}
}
+void GenerateAudioNetworkAdaptation(
+ uint32_t extensions_bitvector,
+ AudioNetworkAdaptor::EncoderRuntimeConfig* config,
+ Random* prng) {
+ config->bitrate_bps = rtc::Optional<int>(prng->Rand(0, 3000000));
+ config->enable_fec = rtc::Optional<bool>(prng->Rand<bool>());
+ config->enable_dtx = rtc::Optional<bool>(prng->Rand<bool>());
+ config->frame_length_ms = rtc::Optional<int>(prng->Rand(10, 120));
+ config->num_channels = rtc::Optional<size_t>(prng->Rand(1, 2));
+ config->uplink_packet_loss_fraction =
+ rtc::Optional<float>(prng->Rand<float>());
+}
+
// Test for the RtcEventLog class. Dumps some RTP packets and other events
// to disk, then reads them back to see if they match.
void LogSessionAndReadBack(size_t rtp_count,
@@ -604,6 +617,22 @@ class VideoSendConfigReadWriteTest : public ConfigReadWriteTest {
VideoSendStream::Config config;
};
+class AudioNetworkAdaptationReadWriteTest : public ConfigReadWriteTest {
+ public:
+ void GenerateConfig(uint32_t extensions_bitvector) override {
+ GenerateAudioNetworkAdaptation(extensions_bitvector, &config, &prng);
+ }
+ void LogConfig(RtcEventLog* event_log) override {
+ event_log->LogAudioNetworkAdaptation(config);
+ }
+ void VerifyConfig(const ParsedRtcEventLog& parsed_log,
+ size_t index) override {
+ RtcEventLogTestHelper::VerifyAudioNetworkAdaptation(parsed_log, index,
+ config);
+ }
+ AudioNetworkAdaptor::EncoderRuntimeConfig config;
+};
+
TEST(RtcEventLogTest, LogAudioReceiveConfig) {
AudioReceiveConfigReadWriteTest test;
test.DoTest();
@@ -623,4 +652,10 @@ TEST(RtcEventLogTest, LogVideoSendConfig) {
VideoSendConfigReadWriteTest test;
test.DoTest();
}
+
+TEST(RtcEventLogTest, LogAudioNetworkAdaptation) {
+ AudioNetworkAdaptationReadWriteTest test;
+ test.DoTest();
+}
+
} // namespace webrtc
« no previous file with comments | « webrtc/logging/rtc_event_log/rtc_event_log_parser.cc ('k') | webrtc/logging/rtc_event_log/rtc_event_log_unittest_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698