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

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

Issue 1648813004: Remove candidates when doing continual gathering (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Address Alex's comments Created 4 years, 9 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/transportchannelimpl.h ('k') | webrtc/p2p/base/transportcontroller.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 2015 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2015 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
11 #ifndef WEBRTC_P2P_BASE_TRANSPORTCONTROLLER_H_ 11 #ifndef WEBRTC_P2P_BASE_TRANSPORTCONTROLLER_H_
12 #define WEBRTC_P2P_BASE_TRANSPORTCONTROLLER_H_ 12 #define WEBRTC_P2P_BASE_TRANSPORTCONTROLLER_H_
13 13
14 #include <map> 14 #include <map>
15 #include <string> 15 #include <string>
16 #include <vector> 16 #include <vector>
17 17
18 #include "webrtc/base/asyncinvoker.h"
18 #include "webrtc/base/sigslot.h" 19 #include "webrtc/base/sigslot.h"
19 #include "webrtc/base/sslstreamadapter.h" 20 #include "webrtc/base/sslstreamadapter.h"
20 #include "webrtc/p2p/base/candidate.h" 21 #include "webrtc/p2p/base/candidate.h"
21 #include "webrtc/p2p/base/transport.h" 22 #include "webrtc/p2p/base/transport.h"
22 23
23 namespace rtc { 24 namespace rtc {
24 class Thread; 25 class Thread;
25 } 26 }
26 27
27 namespace cricket { 28 namespace cricket {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 bool SetRemoteTransportDescription(const std::string& transport_name, 68 bool SetRemoteTransportDescription(const std::string& transport_name,
68 const TransportDescription& tdesc, 69 const TransportDescription& tdesc,
69 ContentAction action, 70 ContentAction action,
70 std::string* err); 71 std::string* err);
71 // Start gathering candidates for any new transports, or transports doing an 72 // Start gathering candidates for any new transports, or transports doing an
72 // ICE restart. 73 // ICE restart.
73 void MaybeStartGathering(); 74 void MaybeStartGathering();
74 bool AddRemoteCandidates(const std::string& transport_name, 75 bool AddRemoteCandidates(const std::string& transport_name,
75 const Candidates& candidates, 76 const Candidates& candidates,
76 std::string* err); 77 std::string* err);
78 bool RemoveRemoteCandidates(const Candidates& candidates, std::string* err);
77 bool ReadyForRemoteCandidates(const std::string& transport_name); 79 bool ReadyForRemoteCandidates(const std::string& transport_name);
78 bool GetStats(const std::string& transport_name, TransportStats* stats); 80 bool GetStats(const std::string& transport_name, TransportStats* stats);
79 81
80 // Creates a channel if it doesn't exist. Otherwise, increments a reference 82 // Creates a channel if it doesn't exist. Otherwise, increments a reference
81 // count and returns an existing channel. 83 // count and returns an existing channel.
82 virtual TransportChannel* CreateTransportChannel_w( 84 virtual TransportChannel* CreateTransportChannel_w(
83 const std::string& transport_name, 85 const std::string& transport_name,
84 int component); 86 int component);
85 87
86 // Decrements a channel's reference count, and destroys the channel if 88 // Decrements a channel's reference count, and destroys the channel if
(...skipping 14 matching lines...) Expand all
101 103
102 // If all transports done gathering => complete, 104 // If all transports done gathering => complete,
103 // Else if any are gathering => gathering, 105 // Else if any are gathering => gathering,
104 // Else => new 106 // Else => new
105 sigslot::signal1<IceGatheringState> SignalGatheringState; 107 sigslot::signal1<IceGatheringState> SignalGatheringState;
106 108
107 // (transport_name, candidates) 109 // (transport_name, candidates)
108 sigslot::signal2<const std::string&, const Candidates&> 110 sigslot::signal2<const std::string&, const Candidates&>
109 SignalCandidatesGathered; 111 SignalCandidatesGathered;
110 112
113 sigslot::signal1<const Candidates&> SignalCandidatesRemoved;
114
111 // for unit test 115 // for unit test
112 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate_for_testing(); 116 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate_for_testing();
113 117
114 protected: 118 protected:
115 // Protected and virtual so we can override it in unit tests. 119 // Protected and virtual so we can override it in unit tests.
116 virtual Transport* CreateTransport_w(const std::string& transport_name); 120 virtual Transport* CreateTransport_w(const std::string& transport_name);
117 121
118 // For unit tests 122 // For unit tests
119 const std::map<std::string, Transport*>& transports() { return transports_; } 123 const std::map<std::string, Transport*>& transports() { return transports_; }
120 Transport* GetTransport_w(const std::string& transport_name); 124 Transport* GetTransport_w(const std::string& transport_name);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 ContentAction action, 173 ContentAction action,
170 std::string* err); 174 std::string* err);
171 bool SetRemoteTransportDescription_w(const std::string& transport_name, 175 bool SetRemoteTransportDescription_w(const std::string& transport_name,
172 const TransportDescription& tdesc, 176 const TransportDescription& tdesc,
173 ContentAction action, 177 ContentAction action,
174 std::string* err); 178 std::string* err);
175 void MaybeStartGathering_w(); 179 void MaybeStartGathering_w();
176 bool AddRemoteCandidates_w(const std::string& transport_name, 180 bool AddRemoteCandidates_w(const std::string& transport_name,
177 const Candidates& candidates, 181 const Candidates& candidates,
178 std::string* err); 182 std::string* err);
183 bool RemoveRemoteCandidates_w(const Candidates& candidates, std::string* err);
179 bool ReadyForRemoteCandidates_w(const std::string& transport_name); 184 bool ReadyForRemoteCandidates_w(const std::string& transport_name);
180 bool GetStats_w(const std::string& transport_name, TransportStats* stats); 185 bool GetStats_w(const std::string& transport_name, TransportStats* stats);
181 186
182 // Handlers for signals from Transport. 187 // Handlers for signals from Transport.
183 void OnChannelWritableState_w(TransportChannel* channel); 188 void OnChannelWritableState_w(TransportChannel* channel);
184 void OnChannelReceivingState_w(TransportChannel* channel); 189 void OnChannelReceivingState_w(TransportChannel* channel);
185 void OnChannelGatheringState_w(TransportChannelImpl* channel); 190 void OnChannelGatheringState_w(TransportChannelImpl* channel);
186 void OnChannelCandidateGathered_w(TransportChannelImpl* channel, 191 void OnChannelCandidateGathered_w(TransportChannelImpl* channel,
187 const Candidate& candidate); 192 const Candidate& candidate);
193 void OnChannelCandidatesRemoved(const Candidates& candidates);
194 void OnChannelCandidatesRemoved_w(TransportChannelImpl* channel,
195 const Candidates& candidates);
188 void OnChannelRoleConflict_w(TransportChannelImpl* channel); 196 void OnChannelRoleConflict_w(TransportChannelImpl* channel);
189 void OnChannelConnectionRemoved_w(TransportChannelImpl* channel); 197 void OnChannelConnectionRemoved_w(TransportChannelImpl* channel);
190 198
191 void UpdateAggregateStates_w(); 199 void UpdateAggregateStates_w();
192 200
193 rtc::Thread* const signaling_thread_ = nullptr; 201 rtc::Thread* const signaling_thread_ = nullptr;
194 rtc::Thread* const worker_thread_ = nullptr; 202 rtc::Thread* const worker_thread_ = nullptr;
195 typedef std::map<std::string, Transport*> TransportMap; 203 typedef std::map<std::string, Transport*> TransportMap;
196 TransportMap transports_; 204 TransportMap transports_;
197 205
198 std::vector<RefCountedChannel> channels_; 206 std::vector<RefCountedChannel> channels_;
199 207
200 PortAllocator* const port_allocator_ = nullptr; 208 PortAllocator* const port_allocator_ = nullptr;
201 rtc::SSLProtocolVersion ssl_max_version_ = rtc::SSL_PROTOCOL_DTLS_12; 209 rtc::SSLProtocolVersion ssl_max_version_ = rtc::SSL_PROTOCOL_DTLS_12;
202 210
203 // Aggregate state for TransportChannelImpls. 211 // Aggregate state for TransportChannelImpls.
204 IceConnectionState connection_state_ = kIceConnectionConnecting; 212 IceConnectionState connection_state_ = kIceConnectionConnecting;
205 bool receiving_ = false; 213 bool receiving_ = false;
206 IceGatheringState gathering_state_ = kIceGatheringNew; 214 IceGatheringState gathering_state_ = kIceGatheringNew;
207 215
208 // TODO(deadbeef): Move the fields below down to the transports themselves 216 // TODO(deadbeef): Move the fields below down to the transports themselves
209 IceConfig ice_config_; 217 IceConfig ice_config_;
210 IceRole ice_role_ = ICEROLE_CONTROLLING; 218 IceRole ice_role_ = ICEROLE_CONTROLLING;
211 // Flag which will be set to true after the first role switch 219 // Flag which will be set to true after the first role switch
212 bool ice_role_switch_ = false; 220 bool ice_role_switch_ = false;
213 uint64_t ice_tiebreaker_ = rtc::CreateRandomId64(); 221 uint64_t ice_tiebreaker_ = rtc::CreateRandomId64();
214 rtc::scoped_refptr<rtc::RTCCertificate> certificate_; 222 rtc::scoped_refptr<rtc::RTCCertificate> certificate_;
223 rtc::AsyncInvoker invoker_;
215 }; 224 };
216 225
217 } // namespace cricket 226 } // namespace cricket
218 227
219 #endif // WEBRTC_P2P_BASE_TRANSPORTCONTROLLER_H_ 228 #endif // WEBRTC_P2P_BASE_TRANSPORTCONTROLLER_H_
OLDNEW
« no previous file with comments | « webrtc/p2p/base/transportchannelimpl.h ('k') | webrtc/p2p/base/transportcontroller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698