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

Unified Diff: webrtc/video/end_to_end_tests.cc

Issue 2760623002: Probing EndToEndTests. (Closed)
Patch Set: Created 3 years, 9 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/test/rtp_rtcp_observer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video/end_to_end_tests.cc
diff --git a/webrtc/video/end_to_end_tests.cc b/webrtc/video/end_to_end_tests.cc
index 6d56da5e0184c27d2f582ac220213ebc71494047..97a583591b79355b623ba935e9ecff869f84c9a1 100644
--- a/webrtc/video/end_to_end_tests.cc
+++ b/webrtc/video/end_to_end_tests.cc
@@ -2196,6 +2196,107 @@ TEST_F(EndToEndTest, RembWithSendSideBwe) {
RunBaseTest(&test);
}
+class ProbingTest : public test::EndToEndTest {
+ public:
+ explicit ProbingTest(int start_bitrate_bps)
+ : clock_(Clock::GetRealTimeClock()),
+ start_bitrate_bps_(start_bitrate_bps),
+ sender_call_(nullptr) {}
+
+ ~ProbingTest() {}
+
+ Call::Config GetSenderCallConfig() override {
+ Call::Config config(&event_log_);
+ config.bitrate_config.start_bitrate_bps = start_bitrate_bps_;
+ return config;
+ }
+
+ void OnCallsCreated(Call* sender_call, Call* receiver_call) override {
+ sender_call_ = sender_call;
+ }
+
+ protected:
+ Clock* const clock_;
+ int start_bitrate_bps_;
stefan-webrtc 2017/03/17 13:14:26 const
philipel 2017/03/17 13:33:23 Done.
+ Call* sender_call_;
+ int state_ = 0;
stefan-webrtc 2017/03/17 13:14:26 Use an enum for readability. It also seems like th
philipel 2017/03/17 13:33:23 I don't really think an enum adds anything in term
+};
+
+TEST_F(EndToEndTest, InitialProbing) {
+ class InitialProbingTest : public ProbingTest {
+ public:
+ InitialProbingTest() : ProbingTest(300000) {}
+
+ void PerformTest() override {
+ int64_t test_end_ms = clock_->TimeInMilliseconds() + kTimeoutMs;
+ do {
+ if (test_end_ms - clock_->TimeInMilliseconds() <= 0) {
stefan-webrtc 2017/03/17 13:14:26 I would have written this: if (clock_->TimeInMilli
philipel 2017/03/17 13:33:23 Agree, fixed.
+ ADD_FAILURE() << "Timed out while waiting for initial probing.";
+ break;
+ }
+
+ Call::Stats stats = sender_call_->GetStats();
+ // Initial probing is done with a x3 and x6 multiplier of the start
+ // bitrate, so a x5 multiplier is a high enough threshold.
+ if (stats.send_bandwidth_bps > 5 * 300000)
+ break;
+ } while (!observation_complete_.Wait(20));
+ }
+
+ private:
+ const int kTimeoutMs = 1000;
+ } test;
+
+ RunBaseTest(&test);
+}
+
+TEST_F(EndToEndTest, TriggerMidCallProbing) {
+ class TriggerMidCallProbingTest : public ProbingTest {
+ public:
+ TriggerMidCallProbingTest() : ProbingTest(300000) {}
+
+ void PerformTest() override {
+ int64_t test_end_ms = clock_->TimeInMilliseconds() + kTimeoutMs;
+ do {
+ if (test_end_ms - clock_->TimeInMilliseconds() <= 0) {
+ ADD_FAILURE() << "Timed out while waiting for mid-call probing.";
+ break;
+ }
+
+ Call::Stats stats = sender_call_->GetStats();
+
+ switch (state_) {
+ case 0:
+ if (stats.send_bandwidth_bps > 5 * 300000) {
+ Call::Config::BitrateConfig bitrate_config;
+ bitrate_config.max_bitrate_bps = 100000;
+ sender_call_->SetBitrateConfig(bitrate_config);
+ ++state_;
+ }
+ break;
+ case 1:
+ if (stats.send_bandwidth_bps < 110000) {
+ Call::Config::BitrateConfig bitrate_config;
+ bitrate_config.max_bitrate_bps = 2500000;
+ sender_call_->SetBitrateConfig(bitrate_config);
+ ++state_;
+ }
+ break;
+ case 2:
+ if (stats.send_bandwidth_bps > 2300000)
+ observation_complete_.Set();
+ break;
+ }
+ } while (!observation_complete_.Wait(20));
+ }
+
+ private:
+ const int kTimeoutMs = 5000;
+ } test;
+
+ RunBaseTest(&test);
+}
+
TEST_F(EndToEndTest, VerifyNackStats) {
static const int kPacketNumberToDrop = 200;
class NackObserver : public test::EndToEndTest {
« no previous file with comments | « webrtc/test/rtp_rtcp_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698