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}
This commit is contained in:
sprang 2015-10-02 06:51:48 -07:00 committed by Commit bot
parent 7e319372ab
commit a050e982b0

View File

@ -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,