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

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, 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.h
diff --git a/webrtc/p2p/base/port.h b/webrtc/p2p/base/port.h
index 37926c955603a3f27918270b5b43b177cdccddf9..88a2f84b25d1b513a69f3468dd8a913104733153 100644
--- a/webrtc/p2p/base/port.h
+++ b/webrtc/p2p/base/port.h
@@ -412,11 +412,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_value)
+ : id(id), sent_time(sent_time), nomination_value(nomination_value) {}
std::string id;
int64_t sent_time;
+ int nomination_value;
};
// States are from RFC 5245. http://tools.ietf.org/html/rfc5245#section-5.7.4
@@ -506,8 +507,21 @@ 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; }
+ int nominating_value() const { return nominating_value_; }
+ void set_nominating_value(int value) {
+ if (value > nominating_value_) {
+ nominating_value_ = value;
+ nomination_acknowledged_ = false;
+ }
Taylor Brandstetter 2016/07/22 17:36:01 RTC_DCHECK if value < nominating_value_? Or have t
honghaiz3 2016/07/22 22:50:11 It may set a zero-value. If we are not using the
Taylor Brandstetter 2016/07/22 23:48:29 I'm suggesting to use the return value in a DCHECK
honghaiz3 2016/07/25 22:24:41 I changed the implementation a little. Basically w
+ }
+ bool nomination_acknowledged() const { return nomination_acknowledged_; }
+
+ int nominated_value() const { return nominated_value_; }
+ void set_nominated_value(int nominated_value) {
Taylor Brandstetter 2016/07/22 17:36:01 Why is this public? Isn't it only set internally u
honghaiz3 2016/07/22 22:50:11 This is made public for testing. I am really repl
Taylor Brandstetter 2016/07/22 23:48:28 If this is public only for unit tests, can you mak
honghaiz3 2016/07/25 22:24:40 Done.
+ if (nominated_value > nominated_value_) {
+ nominated_value_ = nominated_value;
+ }
+ }
void set_remote_ice_mode(IceMode mode) {
remote_ice_mode_ = mode;
@@ -534,7 +548,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_;
}
@@ -640,9 +654,21 @@ 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 if 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.
+ // It should start from zero to indicate not nominating this connection yet.
+ int nominating_value_ = 0;
+ // Whether the current nominating_value has been acknowledged by the peer.
+ // If yes, no nomination-value attribute is needed in the ping request on the
+ // same connection.
+ bool nomination_acknowledged_;
+ // 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 is nominated.
+ int nominated_value_ = 0;
+
IceMode remote_ice_mode_;
StunRequestManager requests_;
int rtt_;

Powered by Google App Engine
This is Rietveld 408576698