From a050e982b02b2faf59202a71b86a70328f372e97 Mon Sep 17 00:00:00 2001 From: sprang Date: Fri, 2 Oct 2015 06:51:48 -0700 Subject: [PATCH] Avoid race in RampUpTest Poller thread is currently started in the constructor, so the first call to PollStats() may happen even before the streams have been configured. This will blow up on RTC_DCHECK_GT(expected_bitrate_bps_, 0); Thread should instead be started on PerformTest() call. BUG= Review URL: https://codereview.webrtc.org/1378303004 Cr-Commit-Position: refs/heads/master@{#10149} --- webrtc/video/rampup_tests.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webrtc/video/rampup_tests.cc b/webrtc/video/rampup_tests.cc index 25352e47ed..526f4a4f76 100644 --- a/webrtc/video/rampup_tests.cc +++ b/webrtc/video/rampup_tests.cc @@ -68,12 +68,10 @@ RampUpTester::RampUpTester(size_t num_streams, for (size_t i = 0; i < ssrcs_.size(); ++i) rtx_ssrc_map_[rtx_ssrcs_[i]] = ssrcs_[i]; } - poller_thread_->Start(); } RampUpTester::~RampUpTester() { event_.Set(); - poller_thread_->Stop(); } Call::Config RampUpTester::GetSenderCallConfig() { @@ -264,11 +262,13 @@ void RampUpTester::TriggerTestDone() { } void RampUpTester::PerformTest() { + poller_thread_->Start(); if (Wait() != kEventSignaled) { printf("Timed out while waiting for ramp-up to complete."); return; } TriggerTestDone(); + poller_thread_->Stop(); } RampUpDownUpTester::RampUpDownUpTester(size_t num_streams,