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 2131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2142 } | 2142 } |
2143 | 2143 |
2144 void WebRtcSession::ReportNegotiatedCiphers( | 2144 void WebRtcSession::ReportNegotiatedCiphers( |
2145 const cricket::TransportStats& stats) { | 2145 const cricket::TransportStats& stats) { |
2146 RTC_DCHECK(metrics_observer_ != NULL); | 2146 RTC_DCHECK(metrics_observer_ != NULL); |
2147 if (!dtls_enabled_ || stats.channel_stats.empty()) { | 2147 if (!dtls_enabled_ || stats.channel_stats.empty()) { |
2148 return; | 2148 return; |
2149 } | 2149 } |
2150 | 2150 |
2151 const std::string& srtp_cipher = stats.channel_stats[0].srtp_cipher; | 2151 const std::string& srtp_cipher = stats.channel_stats[0].srtp_cipher; |
2152 const std::string& ssl_cipher = stats.channel_stats[0].ssl_cipher; | 2152 uint16_t ssl_cipher = stats.channel_stats[0].ssl_cipher; |
2153 if (srtp_cipher.empty() && ssl_cipher.empty()) { | 2153 if (srtp_cipher.empty() && !ssl_cipher) { |
2154 return; | 2154 return; |
2155 } | 2155 } |
2156 | 2156 |
2157 PeerConnectionMetricsName srtp_name; | 2157 PeerConnectionEnumCounterType srtp_counter_type; |
2158 PeerConnectionMetricsName ssl_name; | 2158 PeerConnectionEnumCounterType ssl_counter_type; |
2159 if (stats.transport_name == cricket::CN_AUDIO) { | 2159 if (stats.transport_name == cricket::CN_AUDIO) { |
2160 srtp_name = kAudioSrtpCipher; | 2160 srtp_counter_type = kEnumCounterAudioSrtpCipher; |
2161 ssl_name = kAudioSslCipher; | 2161 ssl_counter_type = kEnumCounterAudioSslCipher; |
2162 } else if (stats.transport_name == cricket::CN_VIDEO) { | 2162 } else if (stats.transport_name == cricket::CN_VIDEO) { |
2163 srtp_name = kVideoSrtpCipher; | 2163 srtp_counter_type = kEnumCounterVideoSrtpCipher; |
2164 ssl_name = kVideoSslCipher; | 2164 ssl_counter_type = kEnumCounterVideoSslCipher; |
2165 } else if (stats.transport_name == cricket::CN_DATA) { | 2165 } else if (stats.transport_name == cricket::CN_DATA) { |
2166 srtp_name = kDataSrtpCipher; | 2166 srtp_counter_type = kEnumCounterDataSrtpCipher; |
2167 ssl_name = kDataSslCipher; | 2167 ssl_counter_type = kEnumCounterDataSslCipher; |
2168 } else { | 2168 } else { |
2169 RTC_NOTREACHED(); | 2169 RTC_NOTREACHED(); |
2170 return; | 2170 return; |
2171 } | 2171 } |
2172 | 2172 |
2173 if (!srtp_cipher.empty()) { | 2173 if (!srtp_cipher.empty()) { |
2174 metrics_observer_->AddHistogramSample(srtp_name, srtp_cipher); | 2174 metrics_observer_->IncrementSparseEnumCounter( |
| 2175 srtp_counter_type, rtc::GetSrtpCryptoSuiteFromName(srtp_cipher)); |
2175 } | 2176 } |
2176 if (!ssl_cipher.empty()) { | 2177 if (ssl_cipher) { |
2177 metrics_observer_->AddHistogramSample(ssl_name, ssl_cipher); | 2178 metrics_observer_->IncrementSparseEnumCounter(ssl_counter_type, ssl_cipher); |
2178 } | 2179 } |
2179 } | 2180 } |
2180 | 2181 |
2181 } // namespace webrtc | 2182 } // namespace webrtc |
OLD | NEW |