OLD | NEW |
---|---|
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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
171 // Ports and candidates are not guaranteed to be in the same order as the | 171 // Ports and candidates are not guaranteed to be in the same order as the |
172 // signals were emitted in. | 172 // signals were emitted in. |
173 virtual std::vector<PortInterface*> ReadyPorts() const = 0; | 173 virtual std::vector<PortInterface*> ReadyPorts() const = 0; |
174 virtual std::vector<Candidate> ReadyCandidates() const = 0; | 174 virtual std::vector<Candidate> ReadyCandidates() const = 0; |
175 virtual bool CandidatesAllocationDone() const = 0; | 175 virtual bool CandidatesAllocationDone() const = 0; |
176 | 176 |
177 sigslot::signal2<PortAllocatorSession*, PortInterface*> SignalPortReady; | 177 sigslot::signal2<PortAllocatorSession*, PortInterface*> SignalPortReady; |
178 sigslot::signal2<PortAllocatorSession*, | 178 sigslot::signal2<PortAllocatorSession*, |
179 const std::vector<Candidate>&> SignalCandidatesReady; | 179 const std::vector<Candidate>&> SignalCandidatesReady; |
180 sigslot::signal1<PortAllocatorSession*> SignalCandidatesAllocationDone; | 180 sigslot::signal1<PortAllocatorSession*> SignalCandidatesAllocationDone; |
181 sigslot::signal2<PortAllocatorSession*, PortInterface*> SignalPortDeprecated; | |
pthatcher1
2016/06/27 20:35:54
Can you comment on what it means for a port to be
honghaiz3
2016/06/28 01:49:25
Done.
| |
181 | 182 |
182 virtual uint32_t generation() { return generation_; } | 183 virtual uint32_t generation() { return generation_; } |
183 virtual void set_generation(uint32_t generation) { generation_ = generation; } | 184 virtual void set_generation(uint32_t generation) { generation_ = generation; } |
184 sigslot::signal1<PortAllocatorSession*> SignalDestroyed; | 185 sigslot::signal1<PortAllocatorSession*> SignalDestroyed; |
185 | 186 |
186 protected: | 187 protected: |
187 // This method is called when a pooled session (which doesn't have these | 188 // This method is called when a pooled session (which doesn't have these |
188 // properties initially) is returned by PortAllocator::TakePooledSession, | 189 // properties initially) is returned by PortAllocator::TakePooledSession, |
189 // and the content name, component, and ICE ufrag/pwd are updated. | 190 // and the content name, component, and ICE ufrag/pwd are updated. |
190 // | 191 // |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
239 // Set STUN and TURN servers to be used in future sessions, and set | 240 // Set STUN and TURN servers to be used in future sessions, and set |
240 // candidate pool size, as described in JSEP. | 241 // candidate pool size, as described in JSEP. |
241 // | 242 // |
242 // If the servers are changing and the candidate pool size is nonzero, | 243 // If the servers are changing and the candidate pool size is nonzero, |
243 // existing pooled sessions will be destroyed and new ones created. | 244 // existing pooled sessions will be destroyed and new ones created. |
244 // | 245 // |
245 // If the servers are not changing but the candidate pool size is, | 246 // If the servers are not changing but the candidate pool size is, |
246 // pooled sessions will be either created or destroyed as necessary. | 247 // pooled sessions will be either created or destroyed as necessary. |
247 void SetConfiguration(const ServerAddresses& stun_servers, | 248 void SetConfiguration(const ServerAddresses& stun_servers, |
248 const std::vector<RelayServerConfig>& turn_servers, | 249 const std::vector<RelayServerConfig>& turn_servers, |
249 int candidate_pool_size); | 250 int candidate_pool_size, |
251 bool disable_low_priority_turn_ports); | |
pthatcher1
2016/06/27 20:35:54
Can you comment on what it means to be "low priori
honghaiz3
2016/06/28 01:49:25
Changed to prune_turn_ports and used SignalPortPru
| |
250 | 252 |
251 const ServerAddresses& stun_servers() const { return stun_servers_; } | 253 const ServerAddresses& stun_servers() const { return stun_servers_; } |
252 | 254 |
253 const std::vector<RelayServerConfig>& turn_servers() const { | 255 const std::vector<RelayServerConfig>& turn_servers() const { |
254 return turn_servers_; | 256 return turn_servers_; |
255 } | 257 } |
256 | 258 |
257 int candidate_pool_size() const { return target_pooled_session_count_; } | 259 int candidate_pool_size() const { return target_pooled_session_count_; } |
258 | 260 |
259 // Sets the network types to ignore. | 261 // Sets the network types to ignore. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
313 bool allow_tcp_listen() const { return allow_tcp_listen_; } | 315 bool allow_tcp_listen() const { return allow_tcp_listen_; } |
314 void set_allow_tcp_listen(bool allow_tcp_listen) { | 316 void set_allow_tcp_listen(bool allow_tcp_listen) { |
315 allow_tcp_listen_ = allow_tcp_listen; | 317 allow_tcp_listen_ = allow_tcp_listen; |
316 } | 318 } |
317 | 319 |
318 uint32_t candidate_filter() { return candidate_filter_; } | 320 uint32_t candidate_filter() { return candidate_filter_; } |
319 void set_candidate_filter(uint32_t filter) { | 321 void set_candidate_filter(uint32_t filter) { |
320 candidate_filter_ = filter; | 322 candidate_filter_ = filter; |
321 } | 323 } |
322 | 324 |
325 bool disable_low_priority_turn_ports() const { | |
326 return disable_low_priority_turn_ports_; | |
327 } | |
328 | |
323 // Gets/Sets the Origin value used for WebRTC STUN requests. | 329 // Gets/Sets the Origin value used for WebRTC STUN requests. |
324 const std::string& origin() const { return origin_; } | 330 const std::string& origin() const { return origin_; } |
325 void set_origin(const std::string& origin) { origin_ = origin; } | 331 void set_origin(const std::string& origin) { origin_ = origin; } |
326 | 332 |
327 protected: | 333 protected: |
328 virtual PortAllocatorSession* CreateSessionInternal( | 334 virtual PortAllocatorSession* CreateSessionInternal( |
329 const std::string& content_name, | 335 const std::string& content_name, |
330 int component, | 336 int component, |
331 const std::string& ice_ufrag, | 337 const std::string& ice_ufrag, |
332 const std::string& ice_pwd) = 0; | 338 const std::string& ice_pwd) = 0; |
(...skipping 10 matching lines...) Expand all Loading... | |
343 | 349 |
344 private: | 350 private: |
345 ServerAddresses stun_servers_; | 351 ServerAddresses stun_servers_; |
346 std::vector<RelayServerConfig> turn_servers_; | 352 std::vector<RelayServerConfig> turn_servers_; |
347 // The last size passed into SetConfiguration. | 353 // The last size passed into SetConfiguration. |
348 int target_pooled_session_count_ = 0; | 354 int target_pooled_session_count_ = 0; |
349 // This variable represents the total number of pooled sessions | 355 // This variable represents the total number of pooled sessions |
350 // both owned by this class and taken by TakePooledSession. | 356 // both owned by this class and taken by TakePooledSession. |
351 int allocated_pooled_session_count_ = 0; | 357 int allocated_pooled_session_count_ = 0; |
352 std::deque<std::unique_ptr<PortAllocatorSession>> pooled_sessions_; | 358 std::deque<std::unique_ptr<PortAllocatorSession>> pooled_sessions_; |
359 bool disable_low_priority_turn_ports_; | |
353 }; | 360 }; |
354 | 361 |
355 } // namespace cricket | 362 } // namespace cricket |
356 | 363 |
357 #endif // WEBRTC_P2P_BASE_PORTALLOCATOR_H_ | 364 #endif // WEBRTC_P2P_BASE_PORTALLOCATOR_H_ |
OLD | NEW |