Index: talk/session/media/mediasession.cc |
diff --git a/talk/session/media/mediasession.cc b/talk/session/media/mediasession.cc |
index 7413026092f1d6f8c8742e407d48376ac5a5ea01..74c478f153bb6dc7e611e74f96759f9ea98b0c14 100644 |
--- a/talk/session/media/mediasession.cc |
+++ b/talk/session/media/mediasession.cc |
@@ -152,27 +152,55 @@ bool FindMatchingCrypto(const CryptoParamsVec& cryptos, |
} |
// For audio, HMAC 32 is prefered because of the low overhead. |
-void GetSupportedAudioCryptoSuites( |
+void GetSupportedAudioCryptoSuites(std::vector<int>* crypto_suites) { |
+#ifdef HAVE_SRTP |
+ crypto_suites->push_back(rtc::SRTP_AES128_CM_SHA1_32); |
+ crypto_suites->push_back(rtc::SRTP_AES128_CM_SHA1_80); |
+#endif |
+} |
+ |
+void GetSupportedAudioCryptoSuiteNames( |
std::vector<std::string>* crypto_suites) { |
#ifdef HAVE_SRTP |
- crypto_suites->push_back(rtc::CS_AES_CM_128_HMAC_SHA1_32); |
- crypto_suites->push_back(rtc::CS_AES_CM_128_HMAC_SHA1_80); |
+ std::vector<int> cryptos; |
pthatcher1
2015/11/11 19:59:40
I think crypto_suites or suites would be better.
guoweis_webrtc
2015/11/17 01:21:16
Done.
|
+ GetSupportedAudioCryptoSuites(&cryptos); |
+ for (const auto crypto : cryptos) { |
+ crypto_suites->push_back(rtc::SrtpCryptoSuiteToName(crypto)); |
+ } |
#endif |
} |
-void GetSupportedVideoCryptoSuites( |
+void GetSupportedVideoCryptoSuites(std::vector<int>* crypto_suites) { |
+ GetDefaultSrtpCryptoSuites(crypto_suites); |
+} |
+ |
+void GetSupportedVideoCryptoSuiteNames( |
std::vector<std::string>* crypto_suites) { |
GetDefaultSrtpCryptoSuiteNames(crypto_suites); |
} |
-void GetSupportedDataCryptoSuites( |
- std::vector<std::string>* crypto_suites) { |
+void GetSupportedDataCryptoSuites(std::vector<int>* crypto_suites) { |
+ GetDefaultSrtpCryptoSuites(crypto_suites); |
+} |
+ |
+void GetSupportedDataCryptoSuiteNames(std::vector<std::string>* crypto_suites) { |
GetDefaultSrtpCryptoSuiteNames(crypto_suites); |
} |
-void GetDefaultSrtpCryptoSuiteNames(std::vector<std::string>* crypto_suites) { |
+void GetDefaultSrtpCryptoSuites(std::vector<int>* crypto_suites) { |
#ifdef HAVE_SRTP |
- crypto_suites->push_back(rtc::CS_AES_CM_128_HMAC_SHA1_80); |
+ crypto_suites->push_back(rtc::SRTP_AES128_CM_SHA1_80); |
+#endif |
+} |
+ |
+void GetDefaultSrtpCryptoSuiteNames( |
+ std::vector<std::string>* crypto_suite_names) { |
+#ifdef HAVE_SRTP |
+ std::vector<int> crypto_suites; |
+ GetDefaultSrtpCryptoSuites(&crypto_suites); |
+ for (const auto crypto : crypto_suites) { |
+ crypto_suite_names->push_back(rtc::SrtpCryptoSuiteToName(crypto)); |
+ } |
#endif |
} |
@@ -1514,7 +1542,7 @@ bool MediaSessionDescriptionFactory::AddAudioContentForOffer( |
scoped_ptr<AudioContentDescription> audio(new AudioContentDescription()); |
std::vector<std::string> crypto_suites; |
- GetSupportedAudioCryptoSuites(&crypto_suites); |
+ GetSupportedAudioCryptoSuiteNames(&crypto_suites); |
if (!CreateMediaContentOffer( |
options, |
audio_codecs, |
@@ -1568,7 +1596,7 @@ bool MediaSessionDescriptionFactory::AddVideoContentForOffer( |
scoped_ptr<VideoContentDescription> video(new VideoContentDescription()); |
std::vector<std::string> crypto_suites; |
- GetSupportedVideoCryptoSuites(&crypto_suites); |
+ GetSupportedVideoCryptoSuiteNames(&crypto_suites); |
if (!CreateMediaContentOffer( |
options, |
video_codecs, |
@@ -1638,7 +1666,7 @@ bool MediaSessionDescriptionFactory::AddDataContentForOffer( |
data->set_protocol( |
secure_transport ? kMediaProtocolDtlsSctp : kMediaProtocolSctp); |
} else { |
- GetSupportedDataCryptoSuites(&crypto_suites); |
+ GetSupportedDataCryptoSuiteNames(&crypto_suites); |
} |
if (!CreateMediaContentOffer( |