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

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

Issue 2063823008: Adding IceConfig option to assume TURN/TURN candidate pairs will work. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Formatting. Created 4 years, 6 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
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 void MaybeStartGathering() override; 95 void MaybeStartGathering() override;
96 IceGatheringState gathering_state() const override { 96 IceGatheringState gathering_state() const override {
97 return gathering_state_; 97 return gathering_state_;
98 } 98 }
99 void AddRemoteCandidate(const Candidate& candidate) override; 99 void AddRemoteCandidate(const Candidate& candidate) override;
100 void RemoveRemoteCandidate(const Candidate& candidate) override; 100 void RemoveRemoteCandidate(const Candidate& candidate) override;
101 // Sets the parameters in IceConfig. We do not set them blindly. Instead, we 101 // Sets the parameters in IceConfig. We do not set them blindly. Instead, we
102 // only update the parameter if it is considered set in |config|. For example, 102 // only update the parameter if it is considered set in |config|. For example,
103 // a negative value of receiving_timeout will be considered "not set" and we 103 // a negative value of receiving_timeout will be considered "not set" and we
104 // will not use it to update the respective parameter in |config_|. 104 // will not use it to update the respective parameter in |config_|.
105 // TODO(deadbeef): Use rtc::Optional instead of negative values.
105 void SetIceConfig(const IceConfig& config) override; 106 void SetIceConfig(const IceConfig& config) override;
106 const IceConfig& config() const; 107 const IceConfig& config() const;
107 108
108 // From TransportChannel: 109 // From TransportChannel:
109 int SendPacket(const char* data, 110 int SendPacket(const char* data,
110 size_t len, 111 size_t len,
111 const rtc::PacketOptions& options, 112 const rtc::PacketOptions& options,
112 int flags) override; 113 int flags) override;
113 int SetOption(rtc::Socket::Option opt, int value) override; 114 int SetOption(rtc::Socket::Option opt, int value) override;
114 bool GetOption(rtc::Socket::Option opt, int* value) override; 115 bool GetOption(rtc::Socket::Option opt, int* value) override;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 201
201 private: 202 private:
202 rtc::Thread* thread() { return worker_thread_; } 203 rtc::Thread* thread() { return worker_thread_; }
203 bool IsGettingPorts() { return allocator_session()->IsGettingPorts(); } 204 bool IsGettingPorts() { return allocator_session()->IsGettingPorts(); }
204 205
205 // A transport channel is weak if the current best connection is either 206 // A transport channel is weak if the current best connection is either
206 // not receiving or not writable, or if there is no best connection at all. 207 // not receiving or not writable, or if there is no best connection at all.
207 bool weak() const; 208 bool weak() const;
208 void UpdateConnectionStates(); 209 void UpdateConnectionStates();
209 void RequestSort(); 210 void RequestSort();
211
212 // Returns an expanded write state based on Connection::write_state and other
213 // factors. Lower values are preferable.
214 int MappedWriteState(const cricket::Connection* a) const;
215
216 // The methods below return a positive value if a is preferable to b,
217 // a negative value if b is preferable, and 0 if they're equally preferable.
218 int CompareConnectionStates(const cricket::Connection* a,
219 const cricket::Connection* b) const;
220 int CompareConnectionCandidates(const cricket::Connection* a,
221 const cricket::Connection* b) const;
222 // Compares first on states, then on candidates, then on RTT.
223 int CompareConnections(const cricket::Connection* a,
224 const cricket::Connection* b) const;
225
226 bool ShouldSwitch(const cricket::Connection* a,
227 const cricket::Connection* b) const;
210 void SortConnections(); 228 void SortConnections();
211 void SwitchBestConnectionTo(Connection* conn); 229 void SwitchBestConnectionTo(Connection* conn);
212 void UpdateState(); 230 void UpdateState();
213 void HandleAllTimedOut(); 231 void HandleAllTimedOut();
214 void MaybeStopPortAllocatorSessions(); 232 void MaybeStopPortAllocatorSessions();
215 TransportChannelState ComputeState() const; 233 TransportChannelState ComputeState() const;
216 234
217 Connection* GetBestConnectionOnNetwork(rtc::Network* network) const; 235 Connection* GetBestConnectionOnNetwork(rtc::Network* network) const;
218 bool CreateConnections(const Candidate& remote_candidate, 236 bool CreateConnections(const Candidate& remote_candidate,
219 PortInterface* origin_port); 237 PortInterface* origin_port);
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 TransportChannelState state_ = TransportChannelState::STATE_INIT; 350 TransportChannelState state_ = TransportChannelState::STATE_INIT;
333 IceConfig config_; 351 IceConfig config_;
334 int last_sent_packet_id_ = -1; // -1 indicates no packet was sent before. 352 int last_sent_packet_id_ = -1; // -1 indicates no packet was sent before.
335 353
336 RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); 354 RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel);
337 }; 355 };
338 356
339 } // namespace cricket 357 } // namespace cricket
340 358
341 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ 359 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698