Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: talk/app/webrtc/webrtcsession.cc

Issue 1458023002: Reland Convert internal representation of Srtp cryptos from string to int (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « talk/app/webrtc/statscollector_unittest.cc ('k') | talk/media/base/cryptoparams.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 const std::string& srtp_cipher = stats.channel_stats[0].srtp_cipher; 2160 int srtp_crypto_suite = stats.channel_stats[0].srtp_crypto_suite;
2161 int ssl_cipher = stats.channel_stats[0].ssl_cipher; 2161 int ssl_cipher_suite = stats.channel_stats[0].ssl_cipher_suite;
2162 if (srtp_cipher.empty() && !ssl_cipher) { 2162 if (srtp_crypto_suite == rtc::SRTP_INVALID_CRYPTO_SUITE &&
2163 ssl_cipher_suite == rtc::TLS_NULL_WITH_NULL_NULL) {
2163 return; 2164 return;
2164 } 2165 }
2165 2166
2166 PeerConnectionEnumCounterType srtp_counter_type; 2167 PeerConnectionEnumCounterType srtp_counter_type;
2167 PeerConnectionEnumCounterType ssl_counter_type; 2168 PeerConnectionEnumCounterType ssl_counter_type;
2168 if (stats.transport_name == cricket::CN_AUDIO) { 2169 if (stats.transport_name == cricket::CN_AUDIO) {
2169 srtp_counter_type = kEnumCounterAudioSrtpCipher; 2170 srtp_counter_type = kEnumCounterAudioSrtpCipher;
2170 ssl_counter_type = kEnumCounterAudioSslCipher; 2171 ssl_counter_type = kEnumCounterAudioSslCipher;
2171 } else if (stats.transport_name == cricket::CN_VIDEO) { 2172 } else if (stats.transport_name == cricket::CN_VIDEO) {
2172 srtp_counter_type = kEnumCounterVideoSrtpCipher; 2173 srtp_counter_type = kEnumCounterVideoSrtpCipher;
2173 ssl_counter_type = kEnumCounterVideoSslCipher; 2174 ssl_counter_type = kEnumCounterVideoSslCipher;
2174 } else if (stats.transport_name == cricket::CN_DATA) { 2175 } else if (stats.transport_name == cricket::CN_DATA) {
2175 srtp_counter_type = kEnumCounterDataSrtpCipher; 2176 srtp_counter_type = kEnumCounterDataSrtpCipher;
2176 ssl_counter_type = kEnumCounterDataSslCipher; 2177 ssl_counter_type = kEnumCounterDataSslCipher;
2177 } else { 2178 } else {
2178 RTC_NOTREACHED(); 2179 RTC_NOTREACHED();
2179 return; 2180 return;
2180 } 2181 }
2181 2182
2182 if (!srtp_cipher.empty()) { 2183 if (srtp_crypto_suite != rtc::SRTP_INVALID_CRYPTO_SUITE) {
2183 metrics_observer_->IncrementSparseEnumCounter( 2184 metrics_observer_->IncrementSparseEnumCounter(srtp_counter_type,
2184 srtp_counter_type, rtc::GetSrtpCryptoSuiteFromName(srtp_cipher)); 2185 srtp_crypto_suite);
2185 } 2186 }
2186 if (ssl_cipher) { 2187 if (ssl_cipher_suite != rtc::TLS_NULL_WITH_NULL_NULL) {
2187 metrics_observer_->IncrementSparseEnumCounter(ssl_counter_type, ssl_cipher); 2188 metrics_observer_->IncrementSparseEnumCounter(ssl_counter_type,
2189 ssl_cipher_suite);
2188 } 2190 }
2189 } 2191 }
2190 2192
2191 void WebRtcSession::OnSentPacket_w(cricket::TransportChannel* channel, 2193 void WebRtcSession::OnSentPacket_w(cricket::TransportChannel* channel,
2192 const rtc::SentPacket& sent_packet) { 2194 const rtc::SentPacket& sent_packet) {
2193 RTC_DCHECK(worker_thread()->IsCurrent()); 2195 RTC_DCHECK(worker_thread()->IsCurrent());
2194 media_controller_->call_w()->OnSentPacket(sent_packet); 2196 media_controller_->call_w()->OnSentPacket(sent_packet);
2195 } 2197 }
2196 2198
2197 } // namespace webrtc 2199 } // namespace webrtc
OLDNEW
« no previous file with comments | « talk/app/webrtc/statscollector_unittest.cc ('k') | talk/media/base/cryptoparams.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698