From 891d393b805e2c332953178b2f1e276862bc39cd Mon Sep 17 00:00:00 2001 From: Tommi Date: Tue, 6 Aug 2019 11:30:11 +0200 Subject: [PATCH] Call Call::GetStats() from the correct thread in ProbingEndToEndTest. Also removing the stop_event_ from the RampUpTester class, which I missed in review 148067. Bug: webrtc:10847 Change-Id: I102cc75287503915b51e37ea4ee01dfcc2437699 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/148062 Reviewed-by: Magnus Flodman Commit-Queue: Tommi Cr-Commit-Position: refs/heads/master@{#28801} --- call/rampup_tests.h | 1 - video/end_to_end_tests/probing_tests.cc | 22 ++++++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/call/rampup_tests.h b/call/rampup_tests.h index 3170f7175b..9c2f57dd00 100644 --- a/call/rampup_tests.h +++ b/call/rampup_tests.h @@ -66,7 +66,6 @@ class RampUpTester : public test::EndToEndTest { const std::string& units) const; void TriggerTestDone(); - rtc::Event stop_event_; Clock* const clock_; BuiltInNetworkBehaviorConfig forward_transport_config_; const size_t num_video_streams_; diff --git a/video/end_to_end_tests/probing_tests.cc b/video/end_to_end_tests/probing_tests.cc index df2caf9fb6..3e5feaffd1 100644 --- a/video/end_to_end_tests/probing_tests.cc +++ b/video/end_to_end_tests/probing_tests.cc @@ -63,10 +63,13 @@ TEST_F(ProbingEndToEndTest, DISABLED_InitialProbing) { #else TEST_F(ProbingEndToEndTest, InitialProbing) { #endif + class InitialProbingTest : public ProbingTest { public: - explicit InitialProbingTest(bool* success) - : ProbingTest(300000), success_(success) { + explicit InitialProbingTest( + bool* success, + test::SingleThreadedTaskQueueForTesting* task_queue) + : ProbingTest(300000), success_(success), task_queue_(task_queue) { *success_ = false; } @@ -76,7 +79,9 @@ TEST_F(ProbingEndToEndTest, InitialProbing) { if (clock_->TimeInMilliseconds() - start_time_ms > kTimeoutMs) break; - Call::Stats stats = sender_call_->GetStats(); + Call::Stats stats; + task_queue_->SendTask( + [this, &stats]() { stats = sender_call_->GetStats(); }); // Initial probing is done with a x3 and x6 multiplier of the start // bitrate, so a x4 multiplier is a high enough threshold. if (stats.send_bandwidth_bps > 4 * 300000) { @@ -89,12 +94,13 @@ TEST_F(ProbingEndToEndTest, InitialProbing) { private: const int kTimeoutMs = 1000; bool* const success_; + test::SingleThreadedTaskQueueForTesting* const task_queue_; }; bool success = false; const int kMaxAttempts = 3; for (int i = 0; i < kMaxAttempts; ++i) { - InitialProbingTest test(&success); + InitialProbingTest test(&success, &task_queue_); RunBaseTest(&test); if (success) return; @@ -127,7 +133,9 @@ TEST_F(ProbingEndToEndTest, TriggerMidCallProbing) { if (clock_->TimeInMilliseconds() - start_time_ms > kTimeoutMs) break; - Call::Stats stats = sender_call_->GetStats(); + Call::Stats stats; + task_queue_->SendTask( + [this, &stats]() { stats = sender_call_->GetStats(); }); switch (state_) { case 0: @@ -230,7 +238,9 @@ TEST_F(ProbingEndToEndTest, ProbeOnVideoEncoderReconfiguration) { if (clock_->TimeInMilliseconds() - start_time_ms > kTimeoutMs) break; - Call::Stats stats = sender_call_->GetStats(); + Call::Stats stats; + task_queue_->SendTask( + [this, &stats]() { stats = sender_call_->GetStats(); }); switch (state_) { case 0: