Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1321)

Unified Diff: webrtc/p2p/base/port.cc

Issue 2143653005: Dampening connection switch. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Add tests and fix an issue Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/p2p/base/port.cc
diff --git a/webrtc/p2p/base/port.cc b/webrtc/p2p/base/port.cc
index 903f13d7a6ad360187efeb81f0a745d53c225e94..6164c3505b6aa83c0c21e8be1877f03922f87207 100644
--- a/webrtc/p2p/base/port.cc
+++ b/webrtc/p2p/base/port.cc
@@ -950,6 +950,9 @@ void Connection::OnReadPacket(
// This is a data packet, pass it along.
set_receiving(true);
last_data_received_ = rtc::TimeMillis();
+ if (first_received_since_channel_weak_ == 0) {
+ first_received_since_channel_weak_ = last_data_received_;
+ }
recv_rate_tracker_.AddSamples(size);
SignalReadPacket(this, data, size, packet_time);
@@ -1188,6 +1191,9 @@ void Connection::Ping(int64_t now) {
void Connection::ReceivedPing() {
set_receiving(true);
last_ping_received_ = rtc::TimeMillis();
+ if (first_received_since_channel_weak_ == 0) {
+ first_received_since_channel_weak_ = last_ping_received_;
+ }
}
void Connection::ReceivedPingResponse(int rtt) {
@@ -1203,6 +1209,9 @@ void Connection::ReceivedPingResponse(int rtt) {
last_ping_response_received_ = rtc::TimeMillis();
rtt_samples_++;
rtt_ = (RTT_RATIO * rtt_ + rtt) / (RTT_RATIO + 1);
+ if (first_received_since_channel_weak_ == 0) {
+ first_received_since_channel_weak_ = last_ping_response_received_;
+ }
pthatcher1 2016/07/13 21:17:22 I think this would be more clear if we had a metho
honghaiz3 2016/07/14 04:54:20 Done. I think it does not matter what value is set
}
bool Connection::dead(int64_t now) const {

Powered by Google App Engine
This is Rietveld 408576698