Fix thread usage in PC level tests for getting to the IceConnected state
Bug: webrtc:11743 Change-Id: I18a6318c35b350b3d729bbd5ac1d25f035e6ad9d Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178809 Reviewed-by: Tommi <tommi@webrtc.org> Reviewed-by: Andrey Logvin <landrey@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#31658}
This commit is contained in:
parent
ce1ff6f8a7
commit
656efbee6f
@ -60,6 +60,8 @@ class TimeController {
|
||||
|
||||
// Waits until condition() == true, polling condition() in small time
|
||||
// intervals.
|
||||
// Returns true if condition() was evaluated to true before |max_duration|
|
||||
// elapsed and false otherwise.
|
||||
bool Wait(const std::function<bool()>& condition,
|
||||
TimeDelta max_duration = TimeDelta::Seconds(5));
|
||||
};
|
||||
|
||||
@ -578,15 +578,18 @@ void PeerConnectionE2EQualityTest::WaitUntilIceCandidatesGathered(
|
||||
void PeerConnectionE2EQualityTest::WaitUntilPeersAreConnected(
|
||||
rtc::Thread* signaling_thread) {
|
||||
// This means that ICE and DTLS are connected.
|
||||
time_controller_.Wait(
|
||||
alice_connected_ = time_controller_.Wait(
|
||||
[&]() {
|
||||
return signaling_thread->Invoke<bool>(RTC_FROM_HERE, [&]() {
|
||||
return alice_->IsIceConnected() && bob_->IsIceConnected();
|
||||
});
|
||||
return signaling_thread->Invoke<bool>(
|
||||
RTC_FROM_HERE, [&]() { return alice_->IsIceConnected(); });
|
||||
},
|
||||
2 * kDefaultTimeout);
|
||||
alice_connected_ = alice_->IsIceConnected();
|
||||
bob_connected_ = bob_->IsIceConnected();
|
||||
kDefaultTimeout);
|
||||
bob_connected_ = time_controller_.Wait(
|
||||
[&]() {
|
||||
return signaling_thread->Invoke<bool>(
|
||||
RTC_FROM_HERE, [&]() { return bob_->IsIceConnected(); });
|
||||
},
|
||||
kDefaultTimeout);
|
||||
}
|
||||
|
||||
void PeerConnectionE2EQualityTest::ExchangeOfferAnswer(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user