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 2139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2150 } | 2150 } |
2151 } | 2151 } |
2152 | 2152 |
2153 void WebRtcSession::ReportNegotiatedCiphers( | 2153 void WebRtcSession::ReportNegotiatedCiphers( |
2154 const cricket::TransportStats& stats) { | 2154 const cricket::TransportStats& stats) { |
2155 RTC_DCHECK(metrics_observer_ != NULL); | 2155 RTC_DCHECK(metrics_observer_ != NULL); |
2156 if (!dtls_enabled_ || stats.channel_stats.empty()) { | 2156 if (!dtls_enabled_ || stats.channel_stats.empty()) { |
2157 return; | 2157 return; |
2158 } | 2158 } |
2159 | 2159 |
2160 int srtp_crypto_suite = stats.channel_stats[0].srtp_crypto_suite; | 2160 const std::string& srtp_cipher = stats.channel_stats[0].srtp_cipher; |
2161 int ssl_cipher_suite = stats.channel_stats[0].ssl_cipher_suite; | 2161 int ssl_cipher = stats.channel_stats[0].ssl_cipher; |
2162 if (srtp_crypto_suite == rtc::SRTP_INVALID_CRYPTO_SUITE && | 2162 if (srtp_cipher.empty() && !ssl_cipher) { |
2163 ssl_cipher_suite == rtc::TLS_NULL_WITH_NULL_NULL) { | |
2164 return; | 2163 return; |
2165 } | 2164 } |
2166 | 2165 |
2167 PeerConnectionEnumCounterType srtp_counter_type; | 2166 PeerConnectionEnumCounterType srtp_counter_type; |
2168 PeerConnectionEnumCounterType ssl_counter_type; | 2167 PeerConnectionEnumCounterType ssl_counter_type; |
2169 if (stats.transport_name == cricket::CN_AUDIO) { | 2168 if (stats.transport_name == cricket::CN_AUDIO) { |
2170 srtp_counter_type = kEnumCounterAudioSrtpCipher; | 2169 srtp_counter_type = kEnumCounterAudioSrtpCipher; |
2171 ssl_counter_type = kEnumCounterAudioSslCipher; | 2170 ssl_counter_type = kEnumCounterAudioSslCipher; |
2172 } else if (stats.transport_name == cricket::CN_VIDEO) { | 2171 } else if (stats.transport_name == cricket::CN_VIDEO) { |
2173 srtp_counter_type = kEnumCounterVideoSrtpCipher; | 2172 srtp_counter_type = kEnumCounterVideoSrtpCipher; |
2174 ssl_counter_type = kEnumCounterVideoSslCipher; | 2173 ssl_counter_type = kEnumCounterVideoSslCipher; |
2175 } else if (stats.transport_name == cricket::CN_DATA) { | 2174 } else if (stats.transport_name == cricket::CN_DATA) { |
2176 srtp_counter_type = kEnumCounterDataSrtpCipher; | 2175 srtp_counter_type = kEnumCounterDataSrtpCipher; |
2177 ssl_counter_type = kEnumCounterDataSslCipher; | 2176 ssl_counter_type = kEnumCounterDataSslCipher; |
2178 } else { | 2177 } else { |
2179 RTC_NOTREACHED(); | 2178 RTC_NOTREACHED(); |
2180 return; | 2179 return; |
2181 } | 2180 } |
2182 | 2181 |
2183 if (srtp_crypto_suite != rtc::SRTP_INVALID_CRYPTO_SUITE) { | 2182 if (!srtp_cipher.empty()) { |
2184 metrics_observer_->IncrementSparseEnumCounter(srtp_counter_type, | 2183 metrics_observer_->IncrementSparseEnumCounter( |
2185 srtp_crypto_suite); | 2184 srtp_counter_type, rtc::GetSrtpCryptoSuiteFromName(srtp_cipher)); |
2186 } | 2185 } |
2187 if (ssl_cipher_suite != rtc::TLS_NULL_WITH_NULL_NULL) { | 2186 if (ssl_cipher) { |
2188 metrics_observer_->IncrementSparseEnumCounter(ssl_counter_type, | 2187 metrics_observer_->IncrementSparseEnumCounter(ssl_counter_type, ssl_cipher); |
2189 ssl_cipher_suite); | |
2190 } | 2188 } |
2191 } | 2189 } |
2192 | 2190 |
2193 void WebRtcSession::OnSentPacket_w(cricket::TransportChannel* channel, | 2191 void WebRtcSession::OnSentPacket_w(cricket::TransportChannel* channel, |
2194 const rtc::SentPacket& sent_packet) { | 2192 const rtc::SentPacket& sent_packet) { |
2195 RTC_DCHECK(worker_thread()->IsCurrent()); | 2193 RTC_DCHECK(worker_thread()->IsCurrent()); |
2196 media_controller_->call_w()->OnSentPacket(sent_packet); | 2194 media_controller_->call_w()->OnSentPacket(sent_packet); |
2197 } | 2195 } |
2198 | 2196 |
2199 } // namespace webrtc | 2197 } // namespace webrtc |
OLD | NEW |