| Index: webrtc/p2p/base/p2ptransportchannel.cc
|
| diff --git a/webrtc/p2p/base/p2ptransportchannel.cc b/webrtc/p2p/base/p2ptransportchannel.cc
|
| index 085185b172fffe7191a4117ff28fe809c29ca7cb..b16667da04bc3c83d666319cd1064193d744ab0c 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,
|
| @@ -1522,7 +1532,8 @@ bool P2PTransportChannel::IsPingable(const Connection* conn,
|
| // Always ping active connections regardless whether the channel is completed
|
| // or not, but backup connections are pinged at a slower rate.
|
| if (IsBackupConnection(conn)) {
|
| - return (now >= conn->last_ping_response_received() +
|
| + return conn->rtt_samples() == 0 ||
|
| + (now >= conn->last_ping_response_received() +
|
| config_.backup_connection_ping_interval);
|
| }
|
| // Don't ping inactive non-backup connections.
|
|
|