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

Unified Diff: webrtc/p2p/base/dtlstransportchannel.cc

Issue 1416673006: Convert internal representation of Srtp cryptos from string to int. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: change srtp crypto name conversion 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/p2p/base/dtlstransportchannel.h ('k') | webrtc/p2p/base/dtlstransportchannel_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/dtlstransportchannel.cc
diff --git a/webrtc/p2p/base/dtlstransportchannel.cc b/webrtc/p2p/base/dtlstransportchannel.cc
index 0c063e03230cf9cc85034a3484af9baeab2a3d89..fff24f30b81617e39475f5e804902f6782d979c2 100644
--- a/webrtc/p2p/base/dtlstransportchannel.cc
+++ b/webrtc/p2p/base/dtlstransportchannel.cc
@@ -267,7 +267,7 @@ bool DtlsTransportChannelWrapper::SetupDtls() {
// Set up DTLS-SRTP, if it's been enabled.
if (!srtp_ciphers_.empty()) {
- if (!dtls_->SetDtlsSrtpCiphers(srtp_ciphers_)) {
+ if (!dtls_->SetDtlsSrtpCryptoSuites(srtp_ciphers_)) {
LOG_J(LS_ERROR, this) << "Couldn't set DTLS-SRTP ciphers.";
return false;
}
@@ -279,11 +279,10 @@ bool DtlsTransportChannelWrapper::SetupDtls() {
return true;
}
-bool DtlsTransportChannelWrapper::SetSrtpCiphers(
- const std::vector<std::string>& ciphers) {
- if (srtp_ciphers_ == ciphers) {
+bool DtlsTransportChannelWrapper::SetSrtpCryptoSuites(
+ const std::vector<int>& ciphers) {
+ if (srtp_ciphers_ == ciphers)
return true;
- }
if (dtls_state() == DTLS_TRANSPORT_CONNECTING) {
LOG(LS_WARNING) << "Ignoring new SRTP ciphers while DTLS is negotiating";
@@ -294,18 +293,18 @@ bool DtlsTransportChannelWrapper::SetSrtpCiphers(
// We don't support DTLS renegotiation currently. If new set of srtp ciphers
// are different than what's being used currently, we will not use it.
// So for now, let's be happy (or sad) with a warning message.
- std::string current_srtp_cipher;
- if (!dtls_->GetDtlsSrtpCipher(&current_srtp_cipher)) {
+ int current_srtp_cipher;
+ if (!dtls_->GetDtlsSrtpCryptoSuite(&current_srtp_cipher)) {
LOG(LS_ERROR) << "Failed to get the current SRTP cipher for DTLS channel";
return false;
}
- const std::vector<std::string>::const_iterator iter =
+ const std::vector<int>::const_iterator iter =
std::find(ciphers.begin(), ciphers.end(), current_srtp_cipher);
if (iter == ciphers.end()) {
std::string requested_str;
for (size_t i = 0; i < ciphers.size(); ++i) {
requested_str.append(" ");
- requested_str.append(ciphers[i]);
+ requested_str.append(rtc::SrtpCryptoSuiteToName(ciphers[i]));
requested_str.append(" ");
}
LOG(LS_WARNING) << "Ignoring new set of SRTP ciphers, as DTLS "
@@ -324,12 +323,12 @@ bool DtlsTransportChannelWrapper::SetSrtpCiphers(
return true;
}
-bool DtlsTransportChannelWrapper::GetSrtpCryptoSuite(std::string* cipher) {
+bool DtlsTransportChannelWrapper::GetSrtpCryptoSuite(int* cipher) {
if (dtls_state() != DTLS_TRANSPORT_CONNECTED) {
return false;
}
- return dtls_->GetDtlsSrtpCipher(cipher);
+ return dtls_->GetDtlsSrtpCryptoSuite(cipher);
}
« no previous file with comments | « webrtc/p2p/base/dtlstransportchannel.h ('k') | webrtc/p2p/base/dtlstransportchannel_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698