Index: webrtc/api/webrtcsession.cc |
diff --git a/webrtc/api/webrtcsession.cc b/webrtc/api/webrtcsession.cc |
index ded3023653247f827c2db0b6fa47f40a1a498aee..ca9f1bd18e8d3ea5bdb5d78e5ac23a5d72a25c21 100644 |
--- a/webrtc/api/webrtcsession.cc |
+++ b/webrtc/api/webrtcsession.cc |
@@ -231,30 +231,6 @@ static bool VerifyIceUfragPwdPresent(const SessionDescription* desc) { |
return true; |
} |
-// Forces |sdesc->crypto_required| to the appropriate state based on the |
-// current security policy, to ensure a failure occurs if there is an error |
-// in crypto negotiation. |
-// Called when processing the local session description. |
-static void UpdateSessionDescriptionSecurePolicy(cricket::CryptoType type, |
- SessionDescription* sdesc) { |
- if (!sdesc) { |
- return; |
- } |
- |
- // Updating the |crypto_required_| in MediaContentDescription to the |
- // appropriate state based on the current security policy. |
- for (cricket::ContentInfos::iterator iter = sdesc->contents().begin(); |
- iter != sdesc->contents().end(); ++iter) { |
- if (cricket::IsMediaContent(&*iter)) { |
- MediaContentDescription* mdesc = |
- static_cast<MediaContentDescription*> (iter->description); |
- if (mdesc) { |
- mdesc->set_crypto_required(type); |
- } |
- } |
- } |
-} |
- |
static bool GetAudioSsrcByTrackId(const SessionDescription* session_description, |
const std::string& track_id, |
uint32_t* ssrc) { |
@@ -641,14 +617,15 @@ cricket::BaseChannel* WebRtcSession::GetChannel( |
return nullptr; |
} |
-void WebRtcSession::SetSdesPolicy(cricket::SecurePolicy secure_policy) { |
- webrtc_session_desc_factory_->SetSdesPolicy(secure_policy); |
-} |
- |
cricket::SecurePolicy WebRtcSession::SdesPolicy() const { |
return webrtc_session_desc_factory_->SdesPolicy(); |
} |
+bool WebRtcSession::SecureRequired() const { |
+ return dtls_enabled_ || |
+ webrtc_session_desc_factory_->SdesPolicy() == cricket::SEC_REQUIRED; |
+} |
+ |
bool WebRtcSession::GetSslRole(const std::string& transport_name, |
rtc::SSLRole* role) { |
if (!local_desc_ || !remote_desc_) { |
@@ -697,14 +674,6 @@ bool WebRtcSession::SetLocalDescription(SessionDescriptionInterface* desc, |
transport_controller_->SetIceRole(cricket::ICEROLE_CONTROLLING); |
} |
- cricket::SecurePolicy sdes_policy = |
- webrtc_session_desc_factory_->SdesPolicy(); |
- cricket::CryptoType crypto_required = dtls_enabled_ ? |
- cricket::CT_DTLS : (sdes_policy == cricket::SEC_REQUIRED ? |
- cricket::CT_SDES : cricket::CT_NONE); |
- // Update the MediaContentDescription crypto settings as per the policy set. |
- UpdateSessionDescriptionSecurePolicy(crypto_required, desc->description()); |
- |
local_desc_.reset(desc_temp.release()); |
// Transport and Media channels will be created only when offer is set. |
@@ -1663,7 +1632,8 @@ bool WebRtcSession::CreateVoiceChannel(const cricket::ContentInfo* content, |
bool create_rtcp_transport_channel = !require_rtcp_mux; |
voice_channel_.reset(channel_manager_->CreateVoiceChannel( |
media_controller_, transport_controller_.get(), content->name, |
- bundle_transport, create_rtcp_transport_channel, audio_options_)); |
+ bundle_transport, create_rtcp_transport_channel, SecureRequired(), |
pthatcher1
2016/11/30 19:16:17
Does SecureRequired()/srtp_required() need to be p
Taylor Brandstetter
2016/12/01 02:41:34
I guess so. I just made it public because SdesPoli
|
+ audio_options_)); |
if (!voice_channel_) { |
return false; |
} |
@@ -1687,7 +1657,8 @@ bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content, |
bool create_rtcp_transport_channel = !require_rtcp_mux; |
video_channel_.reset(channel_manager_->CreateVideoChannel( |
media_controller_, transport_controller_.get(), content->name, |
- bundle_transport, create_rtcp_transport_channel, video_options_)); |
+ bundle_transport, create_rtcp_transport_channel, SecureRequired(), |
+ video_options_)); |
if (!video_channel_) { |
return false; |
} |
@@ -1720,7 +1691,7 @@ bool WebRtcSession::CreateDataChannel(const cricket::ContentInfo* content, |
bool create_rtcp_transport_channel = !sctp && !require_rtcp_mux; |
data_channel_.reset(channel_manager_->CreateDataChannel( |
transport_controller_.get(), content->name, bundle_transport, |
- create_rtcp_transport_channel, data_channel_type_)); |
+ create_rtcp_transport_channel, SecureRequired(), data_channel_type_)); |
if (!data_channel_) { |
return false; |
} |