Index: talk/session/media/mediasession.cc |
diff --git a/talk/session/media/mediasession.cc b/talk/session/media/mediasession.cc |
index 7413026092f1d6f8c8742e407d48376ac5a5ea01..2274b241516d1e7725da9cb22c236e99ccde7081 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( |
- std::vector<std::string>* crypto_suites) { |
+void GetSupportedAudioCryptoSuites(std::vector<int>* 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); |
+ crypto_suites->push_back(rtc::SRTP_AES128_CM_SHA1_32); |
+ crypto_suites->push_back(rtc::SRTP_AES128_CM_SHA1_80); |
#endif |
} |
-void GetSupportedVideoCryptoSuites( |
+void GetSupportedAudioCryptoSuiteNames( |
+ std::vector<std::string>* crypto_suite_names) { |
+#ifdef HAVE_SRTP |
+ std::vector<int> crypto_suites; |
+ GetSupportedAudioCryptoSuites(&crypto_suites); |
+ for (const auto crypto : crypto_suites) { |
+ crypto_suite_names->push_back(rtc::SrtpCryptoSuiteToName(crypto)); |
+ } |
+#endif |
+} |
+ |
+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( |
juberti
2015/11/17 21:19:08
Seems like it would be simplest to have a wrapper
guoweis_webrtc
2015/11/18 19:17:17
Do you mean the following:
std::vector<int> GetSu
juberti
2015/11/18 20:19:15
more like GetSupportedCryptoSuiteNames(void (*func
|
+ 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( |