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 20 matching lines...) Expand all Loading... |
31 #include "webrtc/p2p/base/candidatepairinterface.h" | 31 #include "webrtc/p2p/base/candidatepairinterface.h" |
32 #include "webrtc/p2p/base/p2ptransport.h" | 32 #include "webrtc/p2p/base/p2ptransport.h" |
33 #include "webrtc/p2p/base/portallocator.h" | 33 #include "webrtc/p2p/base/portallocator.h" |
34 #include "webrtc/p2p/base/portinterface.h" | 34 #include "webrtc/p2p/base/portinterface.h" |
35 #include "webrtc/p2p/base/transportchannelimpl.h" | 35 #include "webrtc/p2p/base/transportchannelimpl.h" |
36 #include "webrtc/base/asyncpacketsocket.h" | 36 #include "webrtc/base/asyncpacketsocket.h" |
37 #include "webrtc/base/sigslot.h" | 37 #include "webrtc/base/sigslot.h" |
38 | 38 |
39 namespace cricket { | 39 namespace cricket { |
40 | 40 |
| 41 // Enum for UMA metrics, used to record whether the channel is |
| 42 // connected/connecting/disconnected when ICE restart happens. |
| 43 enum class IceRestartState { CONNECTING, CONNECTED, DISCONNECTED, MAX_VALUE }; |
| 44 |
41 extern const int WEAK_PING_INTERVAL; | 45 extern const int WEAK_PING_INTERVAL; |
42 extern const int STABILIZING_WRITABLE_CONNECTION_PING_INTERVAL; | 46 extern const int STABILIZING_WRITABLE_CONNECTION_PING_INTERVAL; |
43 extern const int STABLE_WRITABLE_CONNECTION_PING_INTERVAL; | 47 extern const int STABLE_WRITABLE_CONNECTION_PING_INTERVAL; |
44 static const int MIN_PINGS_AT_WEAK_PING_INTERVAL = 3; | 48 static const int MIN_PINGS_AT_WEAK_PING_INTERVAL = 3; |
45 | 49 |
46 // Adds the port on which the candidate originated. | 50 // Adds the port on which the candidate originated. |
47 class RemoteCandidate : public Candidate { | 51 class RemoteCandidate : public Candidate { |
48 public: | 52 public: |
49 RemoteCandidate(const Candidate& c, PortInterface* origin_port) | 53 RemoteCandidate(const Candidate& c, PortInterface* origin_port) |
50 : Candidate(c), origin_port_(origin_port) {} | 54 : Candidate(c), origin_port_(origin_port) {} |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 } | 92 } |
89 void AddRemoteCandidate(const Candidate& candidate) override; | 93 void AddRemoteCandidate(const Candidate& candidate) override; |
90 void RemoveRemoteCandidate(const Candidate& candidate) override; | 94 void RemoveRemoteCandidate(const Candidate& candidate) override; |
91 // Sets the parameters in IceConfig. We do not set them blindly. Instead, we | 95 // Sets the parameters in IceConfig. We do not set them blindly. Instead, we |
92 // only update the parameter if it is considered set in |config|. For example, | 96 // only update the parameter if it is considered set in |config|. For example, |
93 // a negative value of receiving_timeout will be considered "not set" and we | 97 // a negative value of receiving_timeout will be considered "not set" and we |
94 // will not use it to update the respective parameter in |config_|. | 98 // will not use it to update the respective parameter in |config_|. |
95 // TODO(deadbeef): Use rtc::Optional instead of negative values. | 99 // TODO(deadbeef): Use rtc::Optional instead of negative values. |
96 void SetIceConfig(const IceConfig& config) override; | 100 void SetIceConfig(const IceConfig& config) override; |
97 const IceConfig& config() const; | 101 const IceConfig& config() const; |
| 102 void SetMetricsObserver(webrtc::MetricsObserverInterface* observer) override; |
98 | 103 |
99 // From TransportChannel: | 104 // From TransportChannel: |
100 int SendPacket(const char* data, | 105 int SendPacket(const char* data, |
101 size_t len, | 106 size_t len, |
102 const rtc::PacketOptions& options, | 107 const rtc::PacketOptions& options, |
103 int flags) override; | 108 int flags) override; |
104 int SetOption(rtc::Socket::Option opt, int value) override; | 109 int SetOption(rtc::Socket::Option opt, int value) override; |
105 bool GetOption(rtc::Socket::Option opt, int* value) override; | 110 bool GetOption(rtc::Socket::Option opt, int* value) override; |
106 int GetError() override { return error_; } | 111 int GetError() override { return error_; } |
107 bool GetStats(std::vector<ConnectionInfo>* stats) override; | 112 bool GetStats(std::vector<ConnectionInfo>* stats) override; |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 int64_t last_ping_sent_ms_ = 0; | 392 int64_t last_ping_sent_ms_ = 0; |
388 int weak_ping_interval_ = WEAK_PING_INTERVAL; | 393 int weak_ping_interval_ = WEAK_PING_INTERVAL; |
389 TransportChannelState state_ = TransportChannelState::STATE_INIT; | 394 TransportChannelState state_ = TransportChannelState::STATE_INIT; |
390 IceConfig config_; | 395 IceConfig config_; |
391 int last_sent_packet_id_ = -1; // -1 indicates no packet was sent before. | 396 int last_sent_packet_id_ = -1; // -1 indicates no packet was sent before. |
392 bool started_pinging_ = false; | 397 bool started_pinging_ = false; |
393 // The value put in the "nomination" attribute for the next nominated | 398 // The value put in the "nomination" attribute for the next nominated |
394 // connection. A zero-value indicates the connection will not be nominated. | 399 // connection. A zero-value indicates the connection will not be nominated. |
395 uint32_t nomination_ = 0; | 400 uint32_t nomination_ = 0; |
396 | 401 |
| 402 webrtc::MetricsObserverInterface* metrics_observer_ = nullptr; |
| 403 |
397 RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); | 404 RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); |
398 }; | 405 }; |
399 | 406 |
400 } // namespace cricket | 407 } // namespace cricket |
401 | 408 |
402 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ | 409 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ |
OLD | NEW |