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

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

Issue 1337673002: Change WebRTC SslCipher to be exposed as number only. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years, 3 months 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
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 30 matching lines...) Expand all
41 #include "talk/app/webrtc/webrtcsessiondescriptionfactory.h" 41 #include "talk/app/webrtc/webrtcsessiondescriptionfactory.h"
42 #include "talk/media/base/constants.h" 42 #include "talk/media/base/constants.h"
43 #include "talk/media/base/videocapturer.h" 43 #include "talk/media/base/videocapturer.h"
44 #include "talk/session/media/channel.h" 44 #include "talk/session/media/channel.h"
45 #include "talk/session/media/channelmanager.h" 45 #include "talk/session/media/channelmanager.h"
46 #include "talk/session/media/mediasession.h" 46 #include "talk/session/media/mediasession.h"
47 #include "webrtc/base/basictypes.h" 47 #include "webrtc/base/basictypes.h"
48 #include "webrtc/base/checks.h" 48 #include "webrtc/base/checks.h"
49 #include "webrtc/base/helpers.h" 49 #include "webrtc/base/helpers.h"
50 #include "webrtc/base/logging.h" 50 #include "webrtc/base/logging.h"
51 #include "webrtc/base/sslstrings.h"
51 #include "webrtc/base/stringencode.h" 52 #include "webrtc/base/stringencode.h"
52 #include "webrtc/base/stringutils.h" 53 #include "webrtc/base/stringutils.h"
53 #include "webrtc/p2p/base/portallocator.h" 54 #include "webrtc/p2p/base/portallocator.h"
54 55
55 using cricket::ContentInfo; 56 using cricket::ContentInfo;
56 using cricket::ContentInfos; 57 using cricket::ContentInfos;
57 using cricket::MediaContentDescription; 58 using cricket::MediaContentDescription;
58 using cricket::SessionDescription; 59 using cricket::SessionDescription;
59 using cricket::TransportInfo; 60 using cricket::TransportInfo;
60 61
(...skipping 22 matching lines...) Expand all
83 "Called with SDP without ice-ufrag and ice-pwd."; 84 "Called with SDP without ice-ufrag and ice-pwd.";
84 const char kSessionError[] = "Session error code: "; 85 const char kSessionError[] = "Session error code: ";
85 const char kSessionErrorDesc[] = "Session error description: "; 86 const char kSessionErrorDesc[] = "Session error description: ";
86 const char kDtlsSetupFailureRtp[] = 87 const char kDtlsSetupFailureRtp[] =
87 "Couldn't set up DTLS-SRTP on RTP channel."; 88 "Couldn't set up DTLS-SRTP on RTP channel.";
88 const char kDtlsSetupFailureRtcp[] = 89 const char kDtlsSetupFailureRtcp[] =
89 "Couldn't set up DTLS-SRTP on RTCP channel."; 90 "Couldn't set up DTLS-SRTP on RTCP channel.";
90 const char kEnableBundleFailed[] = "Failed to enable BUNDLE."; 91 const char kEnableBundleFailed[] = "Failed to enable BUNDLE.";
91 const int kMaxUnsignalledRecvStreams = 20; 92 const int kMaxUnsignalledRecvStreams = 20;
92 93
94 SrtpCipherType GetSrtpCipherType(const std::string& cipher) {
95 if (cipher == rtc::AES_CM_128_HMAC_SHA1_32_NAME)
96 return SrtpCipher_AES_CM_128_HMAC_SHA1_32;
97 if (cipher == rtc::AES_CM_128_HMAC_SHA1_80_NAME)
98 return SrtpCipher_AES_CM_128_HMAC_SHA1_80;
99 return SrtpCipher_Unknown;
100 }
101
93 IceCandidatePairType GetIceCandidatePairCounter( 102 IceCandidatePairType GetIceCandidatePairCounter(
94 const cricket::Candidate& local, 103 const cricket::Candidate& local,
95 const cricket::Candidate& remote) { 104 const cricket::Candidate& remote) {
96 const auto& l = local.type(); 105 const auto& l = local.type();
97 const auto& r = remote.type(); 106 const auto& r = remote.type();
98 const auto& host = LOCAL_PORT_TYPE; 107 const auto& host = LOCAL_PORT_TYPE;
99 const auto& srflx = STUN_PORT_TYPE; 108 const auto& srflx = STUN_PORT_TYPE;
100 const auto& relay = RELAY_PORT_TYPE; 109 const auto& relay = RELAY_PORT_TYPE;
101 const auto& prflx = PRFLX_PORT_TYPE; 110 const auto& prflx = PRFLX_PORT_TYPE;
102 if (l == host && r == host) { 111 if (l == host && r == host) {
(...skipping 2031 matching lines...) Expand 10 before | Expand all | Expand 10 after
2134 } 2143 }
2135 2144
2136 void WebRtcSession::ReportNegotiatedCiphers( 2145 void WebRtcSession::ReportNegotiatedCiphers(
2137 const cricket::TransportStats& stats) { 2146 const cricket::TransportStats& stats) {
2138 RTC_DCHECK(metrics_observer_ != NULL); 2147 RTC_DCHECK(metrics_observer_ != NULL);
2139 if (!dtls_enabled_ || stats.channel_stats.empty()) { 2148 if (!dtls_enabled_ || stats.channel_stats.empty()) {
2140 return; 2149 return;
2141 } 2150 }
2142 2151
2143 const std::string& srtp_cipher = stats.channel_stats[0].srtp_cipher; 2152 const std::string& srtp_cipher = stats.channel_stats[0].srtp_cipher;
2144 const std::string& ssl_cipher = stats.channel_stats[0].ssl_cipher; 2153 const rtc::SslCipher& ssl_cipher = stats.channel_stats[0].ssl_cipher;
2145 if (srtp_cipher.empty() && ssl_cipher.empty()) { 2154 if (srtp_cipher.empty() && ssl_cipher.name.empty()) {
2146 return; 2155 return;
2147 } 2156 }
2148 2157
2149 PeerConnectionMetricsName srtp_name; 2158 PeerConnectionEnumCounterType srtp_counter_type;
2150 PeerConnectionMetricsName ssl_name; 2159 PeerConnectionEnumCounterType ssl_counter_type;
2151 if (stats.transport_name == cricket::CN_AUDIO) { 2160 if (stats.transport_name == cricket::CN_AUDIO) {
2152 srtp_name = kAudioSrtpCipher; 2161 srtp_counter_type = kEnumCounterAudioSrtpCipher;
2153 ssl_name = kAudioSslCipher; 2162 ssl_counter_type = kEnumCounterAudioSslCipher;
2154 } else if (stats.transport_name == cricket::CN_VIDEO) { 2163 } else if (stats.transport_name == cricket::CN_VIDEO) {
2155 srtp_name = kVideoSrtpCipher; 2164 srtp_counter_type = kEnumCounterVideoSrtpCipher;
2156 ssl_name = kVideoSslCipher; 2165 ssl_counter_type = kEnumCounterVideoSslCipher;
2157 } else if (stats.transport_name == cricket::CN_DATA) { 2166 } else if (stats.transport_name == cricket::CN_DATA) {
2158 srtp_name = kDataSrtpCipher; 2167 srtp_counter_type = kEnumCounterDataSrtpCipher;
2159 ssl_name = kDataSslCipher; 2168 ssl_counter_type = kEnumCounterDataSslCipher;
2160 } else { 2169 } else {
2161 RTC_NOTREACHED(); 2170 RTC_NOTREACHED();
2162 return; 2171 return;
2163 } 2172 }
2164 2173
2165 if (!srtp_cipher.empty()) { 2174 if (!srtp_cipher.empty()) {
2166 metrics_observer_->AddHistogramSample(srtp_name, srtp_cipher); 2175 metrics_observer_->IncrementEnumCounter(
2176 srtp_counter_type, GetSrtpCipherType(srtp_cipher), SrtpCipher_Max);
2167 } 2177 }
2168 if (!ssl_cipher.empty()) { 2178 if (!ssl_cipher.name.empty()) {
2169 metrics_observer_->AddHistogramSample(ssl_name, ssl_cipher); 2179 RTC_DCHECK(ssl_cipher.ssl_id);
2180 metrics_observer_->IncrementSparseEnumCounter(ssl_counter_type,
2181 ssl_cipher.ssl_id);
2170 } 2182 }
2171 } 2183 }
2172 2184
2173 } // namespace webrtc 2185 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698