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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 } | 64 } |
65 target_pooled_session_count_ = candidate_pool_size; | 65 target_pooled_session_count_ = candidate_pool_size; |
66 } | 66 } |
67 | 67 |
68 std::unique_ptr<PortAllocatorSession> PortAllocator::CreateSession( | 68 std::unique_ptr<PortAllocatorSession> PortAllocator::CreateSession( |
69 const std::string& sid, | 69 const std::string& sid, |
70 const std::string& content_name, | 70 const std::string& content_name, |
71 int component, | 71 int component, |
72 const std::string& ice_ufrag, | 72 const std::string& ice_ufrag, |
73 const std::string& ice_pwd) { | 73 const std::string& ice_pwd) { |
74 return std::unique_ptr<PortAllocatorSession>( | 74 auto session = std::unique_ptr<PortAllocatorSession>( |
75 CreateSessionInternal(content_name, component, ice_ufrag, ice_pwd)); | 75 CreateSessionInternal(content_name, component, ice_ufrag, ice_pwd)); |
| 76 session->SetCandidateFilter(candidate_filter()); |
| 77 return session; |
76 } | 78 } |
77 | 79 |
78 std::unique_ptr<PortAllocatorSession> PortAllocator::TakePooledSession( | 80 std::unique_ptr<PortAllocatorSession> PortAllocator::TakePooledSession( |
79 const std::string& content_name, | 81 const std::string& content_name, |
80 int component, | 82 int component, |
81 const std::string& ice_ufrag, | 83 const std::string& ice_ufrag, |
82 const std::string& ice_pwd) { | 84 const std::string& ice_pwd) { |
83 RTC_DCHECK(!ice_ufrag.empty()); | 85 RTC_DCHECK(!ice_ufrag.empty()); |
84 RTC_DCHECK(!ice_pwd.empty()); | 86 RTC_DCHECK(!ice_pwd.empty()); |
85 if (pooled_sessions_.empty()) { | 87 if (pooled_sessions_.empty()) { |
86 return nullptr; | 88 return nullptr; |
87 } | 89 } |
88 std::unique_ptr<PortAllocatorSession> ret = | 90 std::unique_ptr<PortAllocatorSession> ret = |
89 std::move(pooled_sessions_.front()); | 91 std::move(pooled_sessions_.front()); |
90 ret->SetIceParameters(content_name, component, ice_ufrag, ice_pwd); | 92 ret->SetIceParameters(content_name, component, ice_ufrag, ice_pwd); |
| 93 // According to JSEP, a pooled session should filter candidates only after |
| 94 // it's taken out of the pool. |
| 95 ret->SetCandidateFilter(candidate_filter()); |
91 pooled_sessions_.pop_front(); | 96 pooled_sessions_.pop_front(); |
92 return ret; | 97 return ret; |
93 } | 98 } |
94 | 99 |
95 const PortAllocatorSession* PortAllocator::GetPooledSession() const { | 100 const PortAllocatorSession* PortAllocator::GetPooledSession() const { |
96 if (pooled_sessions_.empty()) { | 101 if (pooled_sessions_.empty()) { |
97 return nullptr; | 102 return nullptr; |
98 } | 103 } |
99 return pooled_sessions_.front().get(); | 104 return pooled_sessions_.front().get(); |
100 } | 105 } |
101 | 106 |
102 } // namespace cricket | 107 } // namespace cricket |
OLD | NEW |