| Index: webrtc/p2p/base/p2ptransportchannel.cc
|
| diff --git a/webrtc/p2p/base/p2ptransportchannel.cc b/webrtc/p2p/base/p2ptransportchannel.cc
|
| index ec1dfc733f80ed3275038b17608f9cd6531aff9f..69f6c1eaed8331bf5885cc034d7941a3a7313fbd 100644
|
| --- a/webrtc/p2p/base/p2ptransportchannel.cc
|
| +++ b/webrtc/p2p/base/p2ptransportchannel.cc
|
| @@ -183,6 +183,8 @@ void P2PTransportChannel::AddConnection(Connection* connection) {
|
| // b) last data received time.
|
| // iii) Lower cost / higher priority.
|
| // iv) rtt.
|
| +// To further prevent switching to high-cost networks, does not switch to
|
| +// a high-cost connection if it is not receiving.
|
| // TODO(honghaiz): Stop the aggressive nomination on the controlling side and
|
| // implement the ice-renomination option.
|
| bool P2PTransportChannel::ShouldSwitchSelectedConnection(
|
| @@ -196,6 +198,14 @@ bool P2PTransportChannel::ShouldSwitchSelectedConnection(
|
| return true;
|
| }
|
|
|
| + // Do not switch to a connection that is not receiving if it has higher cost
|
| + // because it may be just spuriously better.
|
| + if (new_connection->ComputeNetworkCost() >
|
| + selected_connection_->ComputeNetworkCost() &&
|
| + !new_connection->receiving()) {
|
| + return false;
|
| + }
|
| +
|
| rtc::Optional<int64_t> receiving_unchanged_threshold(
|
| rtc::TimeMillis() - config_.receiving_switching_delay.value_or(0));
|
| int cmp = CompareConnections(selected_connection_, new_connection,
|
|
|