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

Unified Diff: webrtc/p2p/base/p2ptransportchannel.h

Issue 2143653005: Dampening connection switch. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Fix some comments 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
« no previous file with comments | « no previous file | webrtc/p2p/base/p2ptransportchannel.cc » ('j') | webrtc/p2p/base/p2ptransportchannel.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/p2ptransportchannel.h
diff --git a/webrtc/p2p/base/p2ptransportchannel.h b/webrtc/p2p/base/p2ptransportchannel.h
index 14cda683f5bf499358c0d77cf7220464e9553745..a268be97e198e2143c717309ec8606b4b5ef6635 100644
--- a/webrtc/p2p/base/p2ptransportchannel.h
+++ b/webrtc/p2p/base/p2ptransportchannel.h
@@ -226,20 +226,32 @@ class P2PTransportChannel : public TransportChannelImpl,
// a negative value if b is preferable, and 0 if they're equally preferable.
int CompareConnectionStates(const cricket::Connection* a,
const cricket::Connection* b) const;
+ int CompareConnectionWriteAndConnectedStates(
+ const cricket::Connection* a,
+ const cricket::Connection* b) const;
int CompareConnectionCandidates(const cricket::Connection* a,
const cricket::Connection* b) const;
// Compares two connections based on the connection states
// (writable/receiving/connected), nomination states, last data received time,
- // and static preferences. Does not include latency. Used by both sorting
- // and ShouldSwitchSelectedConnection().
+ // and static preferences, and latency. Used by sorting connections.
// Returns a positive value if |a| is better than |b|.
int CompareConnections(const cricket::Connection* a,
const cricket::Connection* b) const;
+ int CompareConnectionsWithoutStates(const cricket::Connection* a,
+ const cricket::Connection* b) const;
+ // This is similar to CompareConnectionStates except that if the selected
+ // connection is not receiving and the new connection is receiving, return a
+ // negative value (indicating the new connection is better) only if the new
+ // connection has been in receiving state for |receiving_dampening_interval_|
+ // milliseconds. If the new connection is receiving but is dampened by this
+ // mechanism, set |connection_dampened| to be true.
+ int CompareConnectionStatesWithDampening(
+ const cricket::Connection* selected_conn,
+ const cricket::Connection* new_conn,
+ bool* connection_dampened) const;
bool PresumedWritable(const cricket::Connection* conn) const;
- bool ShouldSwitchSelectedConnection(const cricket::Connection* selected,
- const cricket::Connection* conn) const;
void SortConnectionsAndUpdateState();
void SwitchSelectedConnection(Connection* conn);
void UpdateState();
@@ -307,7 +319,7 @@ class P2PTransportChannel : public TransportChannelImpl,
void OnRegatherOnFailedNetworks();
// Returns true if the new_connection should be selected for transmission.
- bool ShouldSwitchSelectedConnection(Connection* new_connection) const;
+ bool ShouldSwitchSelectedConnection(Connection* new_connection);
void PruneConnections();
bool IsBackupConnection(const Connection* conn) const;
@@ -366,6 +378,7 @@ class P2PTransportChannel : public TransportChannelImpl,
std::set<Connection*> unpinged_connections_;
Connection* selected_connection_ = nullptr;
+ Connection* pending_selected_connection_ = nullptr;
std::vector<RemoteCandidate> remote_candidates_;
bool sort_dirty_; // indicates whether another sort is needed right now
@@ -387,6 +400,7 @@ class P2PTransportChannel : public TransportChannelImpl,
IceConfig config_;
int last_sent_packet_id_ = -1; // -1 indicates no packet was sent before.
bool started_pinging_ = false;
+ bool was_strong_ = false;
RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel);
};
« no previous file with comments | « no previous file | webrtc/p2p/base/p2ptransportchannel.cc » ('j') | webrtc/p2p/base/p2ptransportchannel.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698