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

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

Issue 1803063004: Reset the BWE when the network changes (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Removed changes in call dir and leave that in a separate CL. Created 4 years, 8 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/p2ptransportchannel_unittest.cc ('k') | webrtc/p2p/base/port.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 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
11 #ifndef WEBRTC_P2P_BASE_PORT_H_ 11 #ifndef WEBRTC_P2P_BASE_PORT_H_
12 #define WEBRTC_P2P_BASE_PORT_H_ 12 #define WEBRTC_P2P_BASE_PORT_H_
13 13
14 #include <map> 14 #include <map>
15 #include <set> 15 #include <set>
16 #include <string> 16 #include <string>
17 #include <vector> 17 #include <vector>
18 18
19 #include "webrtc/p2p/base/candidate.h" 19 #include "webrtc/p2p/base/candidate.h"
20 #include "webrtc/p2p/base/candidatepairinterface.h"
20 #include "webrtc/p2p/base/packetsocketfactory.h" 21 #include "webrtc/p2p/base/packetsocketfactory.h"
21 #include "webrtc/p2p/base/portinterface.h" 22 #include "webrtc/p2p/base/portinterface.h"
22 #include "webrtc/p2p/base/stun.h" 23 #include "webrtc/p2p/base/stun.h"
23 #include "webrtc/p2p/base/stunrequest.h" 24 #include "webrtc/p2p/base/stunrequest.h"
24 #include "webrtc/p2p/base/transport.h" 25 #include "webrtc/p2p/base/transport.h"
25 #include "webrtc/base/asyncpacketsocket.h" 26 #include "webrtc/base/asyncpacketsocket.h"
26 #include "webrtc/base/network.h" 27 #include "webrtc/base/network.h"
27 #include "webrtc/base/proxyinfo.h" 28 #include "webrtc/base/proxyinfo.h"
28 #include "webrtc/base/ratetracker.h" 29 #include "webrtc/base/ratetracker.h"
29 #include "webrtc/base/sigslot.h" 30 #include "webrtc/base/sigslot.h"
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 // A virtual cost perceived by the user, usually based on the network type 404 // A virtual cost perceived by the user, usually based on the network type
404 // (WiFi. vs. Cellular). It takes precedence over the priority when 405 // (WiFi. vs. Cellular). It takes precedence over the priority when
405 // comparing two connections. 406 // comparing two connections.
406 uint16_t network_cost_; 407 uint16_t network_cost_;
407 408
408 friend class Connection; 409 friend class Connection;
409 }; 410 };
410 411
411 // Represents a communication link between a port on the local client and a 412 // Represents a communication link between a port on the local client and a
412 // port on the remote client. 413 // port on the remote client.
413 class Connection : public rtc::MessageHandler, 414 class Connection : public CandidatePairInterface,
414 public sigslot::has_slots<> { 415 public rtc::MessageHandler,
416 public sigslot::has_slots<> {
415 public: 417 public:
416 struct SentPing { 418 struct SentPing {
417 SentPing(const std::string id, int64_t sent_time) 419 SentPing(const std::string id, int64_t sent_time)
418 : id(id), sent_time(sent_time) {} 420 : id(id), sent_time(sent_time) {}
419 421
420 std::string id; 422 std::string id;
421 int64_t sent_time; 423 int64_t sent_time;
422 }; 424 };
423 425
424 // States are from RFC 5245. http://tools.ietf.org/html/rfc5245#section-5.7.4 426 // States are from RFC 5245. http://tools.ietf.org/html/rfc5245#section-5.7.4
425 enum State { 427 enum State {
426 STATE_WAITING = 0, // Check has not been performed, Waiting pair on CL. 428 STATE_WAITING = 0, // Check has not been performed, Waiting pair on CL.
427 STATE_INPROGRESS, // Check has been sent, transaction is in progress. 429 STATE_INPROGRESS, // Check has been sent, transaction is in progress.
428 STATE_SUCCEEDED, // Check already done, produced a successful result. 430 STATE_SUCCEEDED, // Check already done, produced a successful result.
429 STATE_FAILED // Check for this connection failed. 431 STATE_FAILED // Check for this connection failed.
430 }; 432 };
431 433
432 virtual ~Connection(); 434 virtual ~Connection();
433 435
434 // The local port where this connection sends and receives packets. 436 // The local port where this connection sends and receives packets.
435 Port* port() { return port_; } 437 Port* port() { return port_; }
436 const Port* port() const { return port_; } 438 const Port* port() const { return port_; }
437 439
440 // Implementation of virtual methods in CandidatePairInterface.
438 // Returns the description of the local port 441 // Returns the description of the local port
439 virtual const Candidate& local_candidate() const; 442 virtual const Candidate& local_candidate() const;
440
441 // Returns the description of the remote port to which we communicate. 443 // Returns the description of the remote port to which we communicate.
442 const Candidate& remote_candidate() const { return remote_candidate_; } 444 virtual const Candidate& remote_candidate() const;
443 445
444 // Returns the pair priority. 446 // Returns the pair priority.
445 uint64_t priority() const; 447 uint64_t priority() const;
446 448
447 enum WriteState { 449 enum WriteState {
448 STATE_WRITABLE = 0, // we have received ping responses recently 450 STATE_WRITABLE = 0, // we have received ping responses recently
449 STATE_WRITE_UNRELIABLE = 1, // we have had a few ping failures 451 STATE_WRITE_UNRELIABLE = 1, // we have had a few ping failures
450 STATE_WRITE_INIT = 2, // we have yet to receive a ping response 452 STATE_WRITE_INIT = 2, // we have yet to receive a ping response
451 STATE_WRITE_TIMEOUT = 3, // we have had a large number of ping failures 453 STATE_WRITE_TIMEOUT = 3, // we have had a large number of ping failures
452 }; 454 };
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 const rtc::PacketOptions& options) override; 667 const rtc::PacketOptions& options) override;
666 int GetError() override { return error_; } 668 int GetError() override { return error_; }
667 669
668 private: 670 private:
669 int error_ = 0; 671 int error_ = 0;
670 }; 672 };
671 673
672 } // namespace cricket 674 } // namespace cricket
673 675
674 #endif // WEBRTC_P2P_BASE_PORT_H_ 676 #endif // WEBRTC_P2P_BASE_PORT_H_
OLDNEW
« no previous file with comments | « webrtc/p2p/base/p2ptransportchannel_unittest.cc ('k') | webrtc/p2p/base/port.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698