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