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

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

Issue 2163403002: Prepare for ICE-renomination (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: . Created 4 years, 4 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.h
diff --git a/webrtc/p2p/base/port.h b/webrtc/p2p/base/port.h
index 081e81af1d0c32db9a88510181745dd4ce18b673..f958f56380ddfa5013c61bb5b5787b5827b5ea88 100644
--- a/webrtc/p2p/base/port.h
+++ b/webrtc/p2p/base/port.h
@@ -417,11 +417,12 @@ class Connection : public CandidatePairInterface,
public sigslot::has_slots<> {
public:
struct SentPing {
- SentPing(const std::string id, int64_t sent_time)
- : id(id), sent_time(sent_time) {}
+ SentPing(const std::string id, int64_t sent_time, int nomination)
+ : id(id), sent_time(sent_time), nomination(nomination) {}
std::string id;
int64_t sent_time;
+ int nomination;
};
// States are from RFC 5245. http://tools.ietf.org/html/rfc5245#section-5.7.4
@@ -511,8 +512,20 @@ class Connection : public CandidatePairInterface,
bool use_candidate_attr() const { return use_candidate_attr_; }
void set_use_candidate_attr(bool enable);
- bool nominated() const { return nominated_; }
- void set_nominated(bool nominated) { nominated_ = nominated; }
+ void set_nomination(int value) { nomination_ = value; }
+
+ int remote_nomination() const { return remote_nomination_; }
+ bool nominated() const { return remote_nomination_ > 0; }
+ // Public for unit tests.
+ void set_remote_nomination(int remote_nomination) {
+ // We don't un-nominate a connection, so we will keep the maximum
+ // nominated value.
+ if (remote_nomination > remote_nomination_) {
+ remote_nomination_ = remote_nomination;
+ }
+ }
+ // Public for unit tests.
+ int acked_nomination() const { return acked_nomination_; }
void set_remote_ice_mode(IceMode mode) {
remote_ice_mode_ = mode;
@@ -539,7 +552,7 @@ class Connection : public CandidatePairInterface,
// Called when this connection should try checking writability again.
int64_t last_ping_sent() const { return last_ping_sent_; }
void Ping(int64_t now);
- void ReceivedPingResponse(int rtt);
+ void ReceivedPingResponse(int rtt, const std::string& request_id);
int64_t last_ping_response_received() const {
return last_ping_response_received_;
}
@@ -631,11 +644,19 @@ class Connection : public CandidatePairInterface,
void set_state(State state);
void set_connected(bool value);
+ int nomination() const { return nomination_; }
+
void OnMessage(rtc::Message *pmsg);
Port* port_;
size_t local_candidate_index_;
Candidate remote_candidate_;
+
+ ConnectionInfo stats_;
+ rtc::RateTracker recv_rate_tracker_;
+ rtc::RateTracker send_rate_tracker_;
+
+ private:
WriteState write_state_;
bool receiving_;
bool connected_;
@@ -645,9 +666,19 @@ class Connection : public CandidatePairInterface,
// But when peer is ice-lite, this flag "must" be initialized to false and
// turn on when connection becomes "best connection".
bool use_candidate_attr_;
- // Whether this connection has been nominated by the controlling side via
- // the use_candidate attribute.
- bool nominated_;
+ // Used by the controlling side to indicate that this connection will be
+ // selected for transmission if the peer supports ICE-renomination when this
+ // value is positive. A larger-value indicates that a connection is nominated
+ // later and should be selected by the controlled side with higher precedence.
+ // A zero-value indicates not nominating this connection.
+ int nomination_ = 0;
+ // The last nominating value that has been acknowledged.
+ int acked_nomination_ = 0;
+ // Used by the controlled side to remember the nomination value received from
+ // the controlling side. When the peer does not support ICE re-nomination,
+ // its value will be 1 if the connection has been nominated.
+ int remote_nomination_ = 0;
+
IceMode remote_ice_mode_;
StunRequestManager requests_;
int rtt_;
@@ -660,12 +691,6 @@ class Connection : public CandidatePairInterface,
int64_t receiving_unchanged_since_ = 0;
std::vector<SentPing> pings_since_last_response_;
- rtc::RateTracker recv_rate_tracker_;
- rtc::RateTracker send_rate_tracker_;
-
- ConnectionInfo stats_;
-
- private:
void MaybeAddPrflxCandidate(ConnectionRequest* request,
StunMessage* response);

Powered by Google App Engine
This is Rietveld 408576698