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

Side by Side Diff: webrtc/p2p/base/p2ptransportchannel.h

Issue 2670053002: Allow applications to limit the ICE check rate through RTCConfiguration (Closed)
Patch Set: CR feedback Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « webrtc/p2p/base/jseptransport.h ('k') | webrtc/p2p/base/p2ptransportchannel.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 24 matching lines...) Expand all
35 #include "webrtc/p2p/base/portallocator.h" 35 #include "webrtc/p2p/base/portallocator.h"
36 #include "webrtc/p2p/base/portinterface.h" 36 #include "webrtc/p2p/base/portinterface.h"
37 37
38 namespace cricket { 38 namespace cricket {
39 39
40 // Enum for UMA metrics, used to record whether the channel is 40 // Enum for UMA metrics, used to record whether the channel is
41 // connected/connecting/disconnected when ICE restart happens. 41 // connected/connecting/disconnected when ICE restart happens.
42 enum class IceRestartState { CONNECTING, CONNECTED, DISCONNECTED, MAX_VALUE }; 42 enum class IceRestartState { CONNECTING, CONNECTED, DISCONNECTED, MAX_VALUE };
43 43
44 extern const int WEAK_PING_INTERVAL; 44 extern const int WEAK_PING_INTERVAL;
45 extern const int STRONG_PING_INTERVAL;
45 extern const int WEAK_OR_STABILIZING_WRITABLE_CONNECTION_PING_INTERVAL; 46 extern const int WEAK_OR_STABILIZING_WRITABLE_CONNECTION_PING_INTERVAL;
46 extern const int STRONG_AND_STABLE_WRITABLE_CONNECTION_PING_INTERVAL; 47 extern const int STRONG_AND_STABLE_WRITABLE_CONNECTION_PING_INTERVAL;
47 static const int MIN_PINGS_AT_WEAK_PING_INTERVAL = 3; 48 static const int MIN_PINGS_AT_WEAK_PING_INTERVAL = 3;
48 49
49 // Adds the port on which the candidate originated. 50 // Adds the port on which the candidate originated.
50 class RemoteCandidate : public Candidate { 51 class RemoteCandidate : public Candidate {
51 public: 52 public:
52 RemoteCandidate(const Candidate& c, PortInterface* origin_port) 53 RemoteCandidate(const Candidate& c, PortInterface* origin_port)
53 : Candidate(c), origin_port_(origin_port) {} 54 : Candidate(c), origin_port_(origin_port) {}
54 55
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 return ss.str(); 156 return ss.str();
156 } 157 }
157 158
158 private: 159 private:
159 rtc::Thread* thread() const { return network_thread_; } 160 rtc::Thread* thread() const { return network_thread_; }
160 bool IsGettingPorts() { return allocator_session()->IsGettingPorts(); } 161 bool IsGettingPorts() { return allocator_session()->IsGettingPorts(); }
161 162
162 // A transport channel is weak if the current best connection is either 163 // A transport channel is weak if the current best connection is either
163 // not receiving or not writable, or if there is no best connection at all. 164 // not receiving or not writable, or if there is no best connection at all.
164 bool weak() const; 165 bool weak() const;
166
167 int weak_ping_interval() const {
168 if (config_.ice_check_min_interval &&
169 weak_ping_interval_ < *config_.ice_check_min_interval) {
170 return *config_.ice_check_min_interval;
171 }
172 return weak_ping_interval_;
173 }
174
175 int strong_ping_interval() const {
176 if (config_.ice_check_min_interval &&
177 STRONG_PING_INTERVAL < *config_.ice_check_min_interval) {
178 return *config_.ice_check_min_interval;
179 }
180 return STRONG_PING_INTERVAL;
181 }
182
165 // Returns true if it's possible to send packets on |connection|. 183 // Returns true if it's possible to send packets on |connection|.
166 bool ReadyToSend(Connection* connection) const; 184 bool ReadyToSend(Connection* connection) const;
167 void UpdateConnectionStates(); 185 void UpdateConnectionStates();
168 void RequestSortAndStateUpdate(); 186 void RequestSortAndStateUpdate();
169 // Start pinging if we haven't already started, and we now have a connection 187 // Start pinging if we haven't already started, and we now have a connection
170 // that's pingable. 188 // that's pingable.
171 void MaybeStartPinging(); 189 void MaybeStartPinging();
172 190
173 // The methods below return a positive value if |a| is preferable to |b|, 191 // The methods below return a positive value if |a| is preferable to |b|,
174 // a negative value if |b| is preferable, and 0 if they're equally preferable. 192 // a negative value if |b| is preferable, and 0 if they're equally preferable.
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 bool writable_ = false; 385 bool writable_ = false;
368 386
369 webrtc::MetricsObserverInterface* metrics_observer_ = nullptr; 387 webrtc::MetricsObserverInterface* metrics_observer_ = nullptr;
370 388
371 RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); 389 RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel);
372 }; 390 };
373 391
374 } // namespace cricket 392 } // namespace cricket
375 393
376 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ 394 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_
OLDNEW
« no previous file with comments | « webrtc/p2p/base/jseptransport.h ('k') | webrtc/p2p/base/p2ptransportchannel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698