OLD | NEW |
---|---|
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 #include "webrtc/base/stringencode.h" | 50 #include "webrtc/base/stringencode.h" |
51 #include "webrtc/base/stringutils.h" | 51 #include "webrtc/base/stringutils.h" |
52 #include "webrtc/p2p/base/portallocator.h" | 52 #include "webrtc/p2p/base/portallocator.h" |
53 | 53 |
54 using cricket::ContentInfo; | 54 using cricket::ContentInfo; |
55 using cricket::ContentInfos; | 55 using cricket::ContentInfos; |
56 using cricket::MediaContentDescription; | 56 using cricket::MediaContentDescription; |
57 using cricket::SessionDescription; | 57 using cricket::SessionDescription; |
58 using cricket::TransportInfo; | 58 using cricket::TransportInfo; |
59 | 59 |
60 using cricket::LOCAL_PORT_TYPE; | |
61 using cricket::STUN_PORT_TYPE; | |
62 using cricket::RELAY_PORT_TYPE; | |
63 using cricket::PRFLX_PORT_TYPE; | |
64 using webrtc::IceEndpointType; | |
65 | |
60 namespace webrtc { | 66 namespace webrtc { |
61 | 67 |
62 // Error messages | 68 // Error messages |
63 const char kBundleWithoutRtcpMux[] = "RTCP-MUX must be enabled when BUNDLE " | 69 const char kBundleWithoutRtcpMux[] = "RTCP-MUX must be enabled when BUNDLE " |
64 "is enabled."; | 70 "is enabled."; |
65 const char kCreateChannelFailed[] = "Failed to create channels."; | 71 const char kCreateChannelFailed[] = "Failed to create channels."; |
66 const char kInvalidCandidates[] = "Description contains invalid candidates."; | 72 const char kInvalidCandidates[] = "Description contains invalid candidates."; |
67 const char kInvalidSdp[] = "Invalid session description."; | 73 const char kInvalidSdp[] = "Invalid session description."; |
68 const char kMlineMismatch[] = | 74 const char kMlineMismatch[] = |
69 "Offer and answer descriptions m-lines are not matching. Rejecting answer."; | 75 "Offer and answer descriptions m-lines are not matching. Rejecting answer."; |
70 const char kPushDownTDFailed[] = | 76 const char kPushDownTDFailed[] = |
71 "Failed to push down transport description:"; | 77 "Failed to push down transport description:"; |
72 const char kSdpWithoutDtlsFingerprint[] = | 78 const char kSdpWithoutDtlsFingerprint[] = |
73 "Called with SDP without DTLS fingerprint."; | 79 "Called with SDP without DTLS fingerprint."; |
74 const char kSdpWithoutSdesCrypto[] = | 80 const char kSdpWithoutSdesCrypto[] = |
75 "Called with SDP without SDES crypto."; | 81 "Called with SDP without SDES crypto."; |
76 const char kSdpWithoutIceUfragPwd[] = | 82 const char kSdpWithoutIceUfragPwd[] = |
77 "Called with SDP without ice-ufrag and ice-pwd."; | 83 "Called with SDP without ice-ufrag and ice-pwd."; |
78 const char kSessionError[] = "Session error code: "; | 84 const char kSessionError[] = "Session error code: "; |
79 const char kSessionErrorDesc[] = "Session error description: "; | 85 const char kSessionErrorDesc[] = "Session error description: "; |
80 const char kDtlsSetupFailureRtp[] = | 86 const char kDtlsSetupFailureRtp[] = |
81 "Couldn't set up DTLS-SRTP on RTP channel."; | 87 "Couldn't set up DTLS-SRTP on RTP channel."; |
82 const char kDtlsSetupFailureRtcp[] = | 88 const char kDtlsSetupFailureRtcp[] = |
83 "Couldn't set up DTLS-SRTP on RTCP channel."; | 89 "Couldn't set up DTLS-SRTP on RTCP channel."; |
84 const int kMaxUnsignalledRecvStreams = 20; | 90 const int kMaxUnsignalledRecvStreams = 20; |
85 | 91 |
92 #define DECLARE_ENDPOINT_TYPE_ENTRY(local_type, remote_type, endpoint_type) \ | |
93 if (local.type() == local_type##_PORT_TYPE && \ | |
94 remote.type() == remote_type##_PORT_TYPE) { \ | |
95 return endpoint_type; \ | |
96 } | |
97 | |
98 IceEndpointType GetIceEndpointType(const cricket::Candidate& local, | |
99 const cricket::Candidate& remote) { | |
100 DECLARE_ENDPOINT_TYPE_ENTRY(LOCAL, LOCAL, kIceEndpoint_Host_Host); | |
101 DECLARE_ENDPOINT_TYPE_ENTRY(LOCAL, STUN, kIceEndpoint_Host_Srflx); | |
102 DECLARE_ENDPOINT_TYPE_ENTRY(LOCAL, RELAY, kIceEndpoint_Host_Relay); | |
103 DECLARE_ENDPOINT_TYPE_ENTRY(LOCAL, PRFLX, kIceEndpoint_Host_Prflx); | |
104 DECLARE_ENDPOINT_TYPE_ENTRY(STUN, LOCAL, kIceEndpoint_Srflx_Host); | |
105 DECLARE_ENDPOINT_TYPE_ENTRY(STUN, STUN, kIceEndpoint_Srflx_Srflx); | |
106 DECLARE_ENDPOINT_TYPE_ENTRY(STUN, RELAY, kIceEndpoint_Srflx_Relay); | |
107 DECLARE_ENDPOINT_TYPE_ENTRY(STUN, PRFLX, kIceEndpoint_Srflx_Prflx); | |
108 DECLARE_ENDPOINT_TYPE_ENTRY(RELAY, LOCAL, kIceEndpoint_Relay_Host); | |
109 DECLARE_ENDPOINT_TYPE_ENTRY(RELAY, STUN, kIceEndpoint_Relay_Srflx); | |
110 DECLARE_ENDPOINT_TYPE_ENTRY(RELAY, RELAY, kIceEndpoint_Relay_Relay); | |
111 DECLARE_ENDPOINT_TYPE_ENTRY(RELAY, PRFLX, kIceEndpoint_Relay_Prflx); | |
112 DECLARE_ENDPOINT_TYPE_ENTRY(PRFLX, LOCAL, kIceEndpoint_Prflx_Host); | |
113 DECLARE_ENDPOINT_TYPE_ENTRY(PRFLX, STUN, kIceEndpoint_Prflx_Srflx); | |
114 DECLARE_ENDPOINT_TYPE_ENTRY(PRFLX, RELAY, kIceEndpoint_Prflx_Relay); | |
115 return kIceEndpoint_Max; | |
116 } | |
117 | |
86 // Compares |answer| against |offer|. Comparision is done | 118 // Compares |answer| against |offer|. Comparision is done |
87 // for number of m-lines in answer against offer. If matches true will be | 119 // for number of m-lines in answer against offer. If matches true will be |
88 // returned otherwise false. | 120 // returned otherwise false. |
89 static bool VerifyMediaDescriptions( | 121 static bool VerifyMediaDescriptions( |
90 const SessionDescription* answer, const SessionDescription* offer) { | 122 const SessionDescription* answer, const SessionDescription* offer) { |
91 if (offer->contents().size() != answer->contents().size()) | 123 if (offer->contents().size() != answer->contents().size()) |
92 return false; | 124 return false; |
93 | 125 |
94 for (size_t i = 0; i < offer->contents().size(); ++i) { | 126 for (size_t i = 0; i < offer->contents().size(); ++i) { |
95 if ((offer->contents()[i].name) != answer->contents()[i].name) { | 127 if ((offer->contents()[i].name) != answer->contents()[i].name) { |
(...skipping 1813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1909 DCHECK(metrics_observer_ != NULL); | 1941 DCHECK(metrics_observer_ != NULL); |
1910 for (cricket::TransportChannelStatsList::const_iterator it = | 1942 for (cricket::TransportChannelStatsList::const_iterator it = |
1911 stats.channel_stats.begin(); | 1943 stats.channel_stats.begin(); |
1912 it != stats.channel_stats.end(); ++it) { | 1944 it != stats.channel_stats.end(); ++it) { |
1913 for (cricket::ConnectionInfos::const_iterator it_info = | 1945 for (cricket::ConnectionInfos::const_iterator it_info = |
1914 it->connection_infos.begin(); | 1946 it->connection_infos.begin(); |
1915 it_info != it->connection_infos.end(); ++it_info) { | 1947 it_info != it->connection_infos.end(); ++it_info) { |
1916 if (!it_info->best_connection) { | 1948 if (!it_info->best_connection) { |
1917 continue; | 1949 continue; |
1918 } | 1950 } |
1951 | |
1952 // Get the PeerConnectionEnumCounterType. | |
1953 PeerConnectionEnumCounterType counter = kPeerConnectionEnumCounter_Max; | |
juberti1
2015/08/14 21:26:04
looks like this code needs to be updated
| |
1954 if (it_info->local_candidate.first_hop_protocol() == | |
1955 cricket::UDP_PROTOCOL_NAME) { | |
1956 counter = kPeerConnectionEnumCounter_IceEndpointTypeUDP; | |
1957 } else if (it_info->local_candidate.first_hop_protocol() == | |
1958 cricket::TCP_PROTOCOL_NAME) { | |
1959 counter = kPeerConnectionEnumCounter_IceEndpointTypeTCP; | |
1960 } else { | |
1961 DCHECK(counter != kPeerConnectionEnumCounter_Max); | |
1962 } | |
1963 | |
1964 metrics_observer_->IncrementEnumCounter( | |
1965 counter, GetIceEndpointType(it_info->local_candidate, | |
1966 it_info->remote_candidate), | |
1967 kIceEndpoint_Max); | |
1919 if (it_info->local_candidate.address().family() == AF_INET) { | 1968 if (it_info->local_candidate.address().family() == AF_INET) { |
1920 metrics_observer_->IncrementCounter(kBestConnections_IPv4); | 1969 metrics_observer_->IncrementCounter(kBestConnections_IPv4); |
1921 } else if (it_info->local_candidate.address().family() == | 1970 } else if (it_info->local_candidate.address().family() == |
1922 AF_INET6) { | 1971 AF_INET6) { |
1923 metrics_observer_->IncrementCounter(kBestConnections_IPv6); | 1972 metrics_observer_->IncrementCounter(kBestConnections_IPv6); |
1924 } else { | 1973 } else { |
1925 RTC_NOTREACHED(); | 1974 RTC_NOTREACHED(); |
1926 } | 1975 } |
1927 return; | 1976 return; |
1928 } | 1977 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1960 | 2009 |
1961 if (!srtp_cipher.empty()) { | 2010 if (!srtp_cipher.empty()) { |
1962 metrics_observer_->AddHistogramSample(srtp_name, srtp_cipher); | 2011 metrics_observer_->AddHistogramSample(srtp_name, srtp_cipher); |
1963 } | 2012 } |
1964 if (!ssl_cipher.empty()) { | 2013 if (!ssl_cipher.empty()) { |
1965 metrics_observer_->AddHistogramSample(ssl_name, ssl_cipher); | 2014 metrics_observer_->AddHistogramSample(ssl_name, ssl_cipher); |
1966 } | 2015 } |
1967 } | 2016 } |
1968 | 2017 |
1969 } // namespace webrtc | 2018 } // namespace webrtc |
OLD | NEW |