Fix CallPerfTests to call Call::GetStats() from the right thread.

Bug: webrtc:10847
Change-Id: Ic44d9b644aff981ec570c98c2486bb8be787ac68
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/148066
Reviewed-by: Magnus Flodman <mflodman@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28785}
This commit is contained in:
Tommi 2019-08-05 15:23:45 +02:00 committed by Commit Bot
parent c653172e74
commit c24a5b18ba

View file

@ -860,19 +860,22 @@ void CallPerfTest::TestMinAudioVideoBitrate(int test_bitrate_from,
class MinVideoAndAudioBitrateTester : public test::EndToEndTest {
public:
MinVideoAndAudioBitrateTester(int test_bitrate_from,
MinVideoAndAudioBitrateTester(
int test_bitrate_from,
int test_bitrate_to,
int test_bitrate_step,
int min_bwe,
int start_bwe,
int max_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);
}