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 <mflodman@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28801}
This commit is contained in:
Tommi 2019-08-06 11:30:11 +02:00 committed by Commit Bot
parent aaaf804187
commit 891d393b80
2 changed files with 16 additions and 7 deletions

View File

@ -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_;

View File

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