diff --git a/call/call_perf_tests.cc b/call/call_perf_tests.cc index 43af881aa1..421444f228 100644 --- a/call/call_perf_tests.cc +++ b/call/call_perf_tests.cc @@ -860,19 +860,22 @@ void CallPerfTest::TestMinAudioVideoBitrate(int test_bitrate_from, class MinVideoAndAudioBitrateTester : public test::EndToEndTest { public: - MinVideoAndAudioBitrateTester(int test_bitrate_from, - int test_bitrate_to, - int test_bitrate_step, - int min_bwe, - int start_bwe, - int max_bwe) + MinVideoAndAudioBitrateTester( + int test_bitrate_from, + int test_bitrate_to, + int test_bitrate_step, + int min_bwe, + int start_bwe, + int max_bwe, + test::SingleThreadedTaskQueueForTesting* task_queue) : EndToEndTest(), test_bitrate_from_(test_bitrate_from), test_bitrate_to_(test_bitrate_to), test_bitrate_step_(test_bitrate_step), min_bwe_(min_bwe), start_bwe_(start_bwe), - max_bwe_(max_bwe) {} + max_bwe_(max_bwe), + task_queue_(task_queue) {} protected: BuiltInNetworkBehaviorConfig GetFakeNetworkPipeConfig() { @@ -922,15 +925,17 @@ void CallPerfTest::TestMinAudioVideoBitrate(int test_bitrate_from, send_simulated_network_->SetConfig(pipe_config); receive_simulated_network_->SetConfig(pipe_config); - rtc::ThreadManager::Instance()->CurrentThread()->SleepMs( - quick_perf_test ? kShortDelayMs : kBitrateStabilizationMs); + rtc::Thread::SleepMs(quick_perf_test ? kShortDelayMs + : kBitrateStabilizationMs); int64_t avg_rtt = 0; for (int i = 0; i < kBitrateMeasurements; i++) { - Call::Stats call_stats = sender_call_->GetStats(); + Call::Stats call_stats; + task_queue_->SendTask( + [this, &call_stats]() { call_stats = sender_call_->GetStats(); }); avg_rtt += call_stats.rtt_ms; - rtc::ThreadManager::Instance()->CurrentThread()->SleepMs( - quick_perf_test ? kShortDelayMs : kBitrateMeasurementMs); + rtc::Thread::SleepMs(quick_perf_test ? kShortDelayMs + : kBitrateMeasurementMs); } avg_rtt = avg_rtt / kBitrateMeasurements; if (avg_rtt > kMinGoodRttMs) { @@ -976,8 +981,9 @@ void CallPerfTest::TestMinAudioVideoBitrate(int test_bitrate_from, SimulatedNetwork* send_simulated_network_; SimulatedNetwork* receive_simulated_network_; Call* sender_call_; + test::SingleThreadedTaskQueueForTesting* const task_queue_; } test(test_bitrate_from, test_bitrate_to, test_bitrate_step, min_bwe, - start_bwe, max_bwe); + start_bwe, max_bwe, &task_queue_); RunBaseTest(&test); }