Chromium Code Reviews

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

Issue 1998813002: Fixing the behavior of the candidate filter with pooled candidates. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
1 /* 1 /*
2 * Copyright 2010 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2010 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 86 matching lines...)
97 ice_ufrag, 97 ice_ufrag,
98 ice_pwd, 98 ice_pwd,
99 allocator->flags()), 99 allocator->flags()),
100 worker_thread_(worker_thread), 100 worker_thread_(worker_thread),
101 factory_(factory), 101 factory_(factory),
102 network_("network", "unittest", rtc::IPAddress(INADDR_LOOPBACK), 8), 102 network_("network", "unittest", rtc::IPAddress(INADDR_LOOPBACK), 8),
103 port_(), 103 port_(),
104 running_(false), 104 running_(false),
105 port_config_count_(0), 105 port_config_count_(0),
106 stun_servers_(allocator->stun_servers()), 106 stun_servers_(allocator->stun_servers()),
107 turn_servers_(allocator->turn_servers()), 107 turn_servers_(allocator->turn_servers()) {
108 candidate_filter_(allocator->candidate_filter()) {
109 network_.AddIP(rtc::IPAddress(INADDR_LOOPBACK)); 108 network_.AddIP(rtc::IPAddress(INADDR_LOOPBACK));
110 } 109 }
111 110
111 void SetCandidateFilter(uint32_t filter) override {
112 candidate_filter_ = filter;
113 }
114
112 void StartGettingPorts() override { 115 void StartGettingPorts() override {
113 if (!port_) { 116 if (!port_) {
114 port_.reset(TestUDPPort::Create(worker_thread_, factory_, &network_, 117 port_.reset(TestUDPPort::Create(worker_thread_, factory_, &network_,
115 network_.GetBestIP(), 0, 0, username(), 118 network_.GetBestIP(), 0, 0, username(),
116 password(), std::string(), false)); 119 password(), std::string(), false));
117 AddPort(port_.get()); 120 AddPort(port_.get());
118 } 121 }
119 ++port_config_count_; 122 ++port_config_count_;
120 running_ = true; 123 running_ = true;
121 } 124 }
(...skipping 53 matching lines...)
175 rtc::PacketSocketFactory* factory_; 178 rtc::PacketSocketFactory* factory_;
176 rtc::Network network_; 179 rtc::Network network_;
177 std::unique_ptr<cricket::Port> port_; 180 std::unique_ptr<cricket::Port> port_;
178 bool running_; 181 bool running_;
179 int port_config_count_; 182 int port_config_count_;
180 std::vector<Candidate> candidates_; 183 std::vector<Candidate> candidates_;
181 std::vector<PortInterface*> ready_ports_; 184 std::vector<PortInterface*> ready_ports_;
182 bool allocation_done_ = false; 185 bool allocation_done_ = false;
183 ServerAddresses stun_servers_; 186 ServerAddresses stun_servers_;
184 std::vector<RelayServerConfig> turn_servers_; 187 std::vector<RelayServerConfig> turn_servers_;
185 uint32_t candidate_filter_;
186 int transport_info_update_count_ = 0; 188 int transport_info_update_count_ = 0;
189 uint32_t candidate_filter_ = CF_ALL;
187 }; 190 };
188 191
189 class FakePortAllocator : public cricket::PortAllocator { 192 class FakePortAllocator : public cricket::PortAllocator {
190 public: 193 public:
191 FakePortAllocator(rtc::Thread* worker_thread, 194 FakePortAllocator(rtc::Thread* worker_thread,
192 rtc::PacketSocketFactory* factory) 195 rtc::PacketSocketFactory* factory)
193 : worker_thread_(worker_thread), factory_(factory) { 196 : worker_thread_(worker_thread), factory_(factory) {
194 if (factory_ == NULL) { 197 if (factory_ == NULL) {
195 owned_factory_.reset(new rtc::BasicPacketSocketFactory(worker_thread_)); 198 owned_factory_.reset(new rtc::BasicPacketSocketFactory(worker_thread_));
196 factory_ = owned_factory_.get(); 199 factory_ = owned_factory_.get();
(...skipping 14 matching lines...)
211 214
212 private: 215 private:
213 rtc::Thread* worker_thread_; 216 rtc::Thread* worker_thread_;
214 rtc::PacketSocketFactory* factory_; 217 rtc::PacketSocketFactory* factory_;
215 std::unique_ptr<rtc::BasicPacketSocketFactory> owned_factory_; 218 std::unique_ptr<rtc::BasicPacketSocketFactory> owned_factory_;
216 }; 219 };
217 220
218 } // namespace cricket 221 } // namespace cricket
219 222
220 #endif // WEBRTC_P2P_BASE_FAKEPORTALLOCATOR_H_ 223 #endif // WEBRTC_P2P_BASE_FAKEPORTALLOCATOR_H_
OLDNEW

Powered by Google App Engine