| Index: webrtc/api/webrtcsession.cc
|
| diff --git a/webrtc/api/webrtcsession.cc b/webrtc/api/webrtcsession.cc
|
| index ded3023653247f827c2db0b6fa47f40a1a498aee..fed012af279831f52f1dd08c552cc6bc46bc29de 100644
|
| --- a/webrtc/api/webrtcsession.cc
|
| +++ b/webrtc/api/webrtcsession.cc
|
| @@ -165,7 +165,7 @@ static bool VerifyMediaDescriptions(
|
| // Checks that each non-rejected content has SDES crypto keys or a DTLS
|
| // fingerprint. Mismatches, such as replying with a DTLS fingerprint to SDES
|
| // keys, will be caught in Transport negotiation, and backstopped by Channel's
|
| -// |secure_required| check.
|
| +// |srtp_required| check.
|
| static bool VerifyCrypto(const SessionDescription* desc,
|
| bool dtls_enabled,
|
| std::string* error) {
|
| @@ -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,10 +617,6 @@ 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();
|
| }
|
| @@ -697,14 +669,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 +1627,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, SrtpRequired(),
|
| + audio_options_));
|
| if (!voice_channel_) {
|
| return false;
|
| }
|
| @@ -1687,7 +1652,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, SrtpRequired(),
|
| + video_options_));
|
| if (!video_channel_) {
|
| return false;
|
| }
|
| @@ -1720,7 +1686,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, SrtpRequired(), data_channel_type_));
|
| if (!data_channel_) {
|
| return false;
|
| }
|
| @@ -1928,6 +1894,11 @@ bool WebRtcSession::ReadyToUseRemoteCandidate(
|
| return transport_controller_->ReadyForRemoteCandidates(transport_name);
|
| }
|
|
|
| +bool WebRtcSession::SrtpRequired() const {
|
| + return dtls_enabled_ ||
|
| + webrtc_session_desc_factory_->SdesPolicy() == cricket::SEC_REQUIRED;
|
| +}
|
| +
|
| void WebRtcSession::OnTransportControllerGatheringState(
|
| cricket::IceGatheringState state) {
|
| ASSERT(signaling_thread()->IsCurrent());
|
|
|