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

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

Issue 1246913005: TransportController refactoring (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Set media engine on voice channel Created 5 years, 4 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 }; 47 };
48 48
49 // P2PTransportChannel manages the candidates and connection process to keep 49 // P2PTransportChannel manages the candidates and connection process to keep
50 // two P2P clients connected to each other. 50 // two P2P clients connected to each other.
51 class P2PTransportChannel : public TransportChannelImpl, 51 class P2PTransportChannel : public TransportChannelImpl,
52 public rtc::MessageHandler { 52 public rtc::MessageHandler {
53 public: 53 public:
54 P2PTransportChannel(const std::string& content_name, 54 P2PTransportChannel(const std::string& content_name,
55 int component, 55 int component,
56 P2PTransport* transport, 56 P2PTransport* transport,
57 PortAllocator *allocator); 57 PortAllocator* allocator);
58 virtual ~P2PTransportChannel(); 58 virtual ~P2PTransportChannel();
59 59
60 // From TransportChannelImpl: 60 // From TransportChannelImpl:
61 virtual Transport* GetTransport() { return transport_; } 61 virtual Transport* GetTransport() { return transport_; }
62 virtual TransportChannelState GetState() const; 62 virtual TransportChannelState GetState() const;
63 virtual void SetIceRole(IceRole role); 63 virtual void SetIceRole(IceRole role);
64 virtual IceRole GetIceRole() const { return ice_role_; } 64 virtual IceRole GetIceRole() const { return ice_role_; }
65 virtual void SetIceTiebreaker(uint64 tiebreaker); 65 virtual void SetIceTiebreaker(uint64 tiebreaker);
66 virtual bool GetIceProtocolType(IceProtocolType* type) const; 66 virtual bool GetIceProtocolType(IceProtocolType* type) const;
67 virtual void SetIceProtocolType(IceProtocolType type); 67 virtual void SetIceProtocolType(IceProtocolType type);
68 virtual void SetIceCredentials(const std::string& ice_ufrag, 68 virtual void SetIceCredentials(const std::string& ice_ufrag,
69 const std::string& ice_pwd); 69 const std::string& ice_pwd);
70 virtual void SetRemoteIceCredentials(const std::string& ice_ufrag, 70 virtual void SetRemoteIceCredentials(const std::string& ice_ufrag,
71 const std::string& ice_pwd); 71 const std::string& ice_pwd);
72 virtual void SetRemoteIceMode(IceMode mode); 72 virtual void SetRemoteIceMode(IceMode mode);
73 virtual void Connect(); 73 virtual void Connect();
74 virtual void OnSignalingReady(); 74 virtual GatheringState gathering_state() const { return gathering_state_; }
75 virtual void OnCandidate(const Candidate& candidate); 75 virtual void OnCandidate(const Candidate& candidate);
76 // Sets the receiving timeout in milliseconds. 76 // Sets the receiving timeout in milliseconds.
77 // This also sets the check_receiving_delay proportionally. 77 // This also sets the check_receiving_delay proportionally.
78 virtual void SetReceivingTimeout(int receiving_timeout_ms); 78 virtual void SetReceivingTimeout(int receiving_timeout_ms);
79 79
80 // From TransportChannel: 80 // From TransportChannel:
81 virtual int SendPacket(const char *data, size_t len, 81 virtual int SendPacket(const char *data, size_t len,
82 const rtc::PacketOptions& options, int flags); 82 const rtc::PacketOptions& options, int flags);
83 virtual int SetOption(rtc::Socket::Option opt, int value); 83 virtual int SetOption(rtc::Socket::Option opt, int value);
84 virtual bool GetOption(rtc::Socket::Option opt, int* value); 84 virtual bool GetOption(rtc::Socket::Option opt, int* value);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 161
162 // Public for unit tests. 162 // Public for unit tests.
163 Connection* FindNextPingableConnection(); 163 Connection* FindNextPingableConnection();
164 164
165 private: 165 private:
166 rtc::Thread* thread() { return worker_thread_; } 166 rtc::Thread* thread() { return worker_thread_; }
167 PortAllocatorSession* allocator_session() { 167 PortAllocatorSession* allocator_session() {
168 return allocator_sessions_.back(); 168 return allocator_sessions_.back();
169 } 169 }
170 170
171 void Allocate(); 171 void StartGatheringCandidates();
172 void UpdateConnectionStates(); 172 void UpdateConnectionStates();
173 void RequestSort(); 173 void RequestSort();
174 void SortConnections(); 174 void SortConnections();
175 void SwitchBestConnectionTo(Connection* conn); 175 void SwitchBestConnectionTo(Connection* conn);
176 void UpdateChannelState(); 176 void UpdateChannelState();
177 void HandleWritable(); 177 void HandleWritable();
178 void HandleNotWritable(); 178 void HandleNotWritable();
179 void HandleAllTimedOut(); 179 void HandleAllTimedOut();
180 180
181 Connection* GetBestConnectionOnNetwork(rtc::Network* network) const; 181 Connection* GetBestConnectionOnNetwork(rtc::Network* network) const;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 215
216 void OnUseCandidate(Connection* conn); 216 void OnUseCandidate(Connection* conn);
217 217
218 virtual void OnMessage(rtc::Message *pmsg); 218 virtual void OnMessage(rtc::Message *pmsg);
219 void OnSort(); 219 void OnSort();
220 void OnPing(); 220 void OnPing();
221 221
222 void OnCheckReceiving(); 222 void OnCheckReceiving();
223 223
224 P2PTransport* transport_; 224 P2PTransport* transport_;
225 PortAllocator *allocator_; 225 PortAllocator* allocator_;
226 rtc::Thread *worker_thread_; 226 rtc::Thread* worker_thread_;
227 bool incoming_only_; 227 bool incoming_only_;
228 bool waiting_for_signaling_;
229 int error_; 228 int error_;
230 std::vector<PortAllocatorSession*> allocator_sessions_; 229 std::vector<PortAllocatorSession*> allocator_sessions_;
231 std::vector<PortInterface *> ports_; 230 std::vector<PortInterface *> ports_;
232 std::vector<Connection *> connections_; 231 std::vector<Connection *> connections_;
233 Connection* best_connection_; 232 Connection* best_connection_;
234 // Connection selected by the controlling agent. This should be used only 233 // Connection selected by the controlling agent. This should be used only
235 // at controlled side when protocol type is RFC5245. 234 // at controlled side when protocol type is RFC5245.
236 Connection* pending_best_connection_; 235 Connection* pending_best_connection_;
237 std::vector<RemoteCandidate> remote_candidates_; 236 std::vector<RemoteCandidate> remote_candidates_;
238 bool sort_dirty_; // indicates whether another sort is needed right now 237 bool sort_dirty_; // indicates whether another sort is needed right now
239 bool was_writable_; 238 bool was_writable_;
240 typedef std::map<rtc::Socket::Option, int> OptionMap; 239 typedef std::map<rtc::Socket::Option, int> OptionMap;
241 OptionMap options_; 240 OptionMap options_;
242 std::string ice_ufrag_; 241 std::string ice_ufrag_;
243 std::string ice_pwd_; 242 std::string ice_pwd_;
244 std::string remote_ice_ufrag_; 243 std::string remote_ice_ufrag_;
245 std::string remote_ice_pwd_; 244 std::string remote_ice_pwd_;
246 IceProtocolType protocol_type_; 245 IceProtocolType protocol_type_;
247 IceMode remote_ice_mode_; 246 IceMode remote_ice_mode_;
248 IceRole ice_role_; 247 IceRole ice_role_;
249 uint64 tiebreaker_; 248 uint64 tiebreaker_;
250 uint32 remote_candidate_generation_; 249 uint32 remote_candidate_generation_;
250 GatheringState gathering_state_;
251 251
252 int check_receiving_delay_; 252 int check_receiving_delay_;
253 int receiving_timeout_; 253 int receiving_timeout_;
254 254
255 DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); 255 DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel);
256 }; 256 };
257 257
258 } // namespace cricket 258 } // namespace cricket
259 259
260 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ 260 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698