| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 } | 754 } |
| 755 | 755 |
| 756 void WebRtcSession::SetSdesPolicy(cricket::SecurePolicy secure_policy) { | 756 void WebRtcSession::SetSdesPolicy(cricket::SecurePolicy secure_policy) { |
| 757 webrtc_session_desc_factory_->SetSdesPolicy(secure_policy); | 757 webrtc_session_desc_factory_->SetSdesPolicy(secure_policy); |
| 758 } | 758 } |
| 759 | 759 |
| 760 cricket::SecurePolicy WebRtcSession::SdesPolicy() const { | 760 cricket::SecurePolicy WebRtcSession::SdesPolicy() const { |
| 761 return webrtc_session_desc_factory_->SdesPolicy(); | 761 return webrtc_session_desc_factory_->SdesPolicy(); |
| 762 } | 762 } |
| 763 | 763 |
| 764 bool WebRtcSession::GetSslRole(rtc::SSLRole* role) { | 764 bool WebRtcSession::GetSslRole(const std::string& transport_name, |
| 765 rtc::SSLRole* role) { |
| 765 if (!local_desc_ || !remote_desc_) { | 766 if (!local_desc_ || !remote_desc_) { |
| 766 LOG(LS_INFO) << "Local and Remote descriptions must be applied to get " | 767 LOG(LS_INFO) << "Local and Remote descriptions must be applied to get " |
| 767 << "SSL Role of the session."; | 768 << "SSL Role of the session."; |
| 768 return false; | 769 return false; |
| 769 } | 770 } |
| 770 | 771 |
| 771 return transport_controller_->GetSslRole(role); | 772 return transport_controller_->GetSslRole(transport_name, role); |
| 773 } |
| 774 |
| 775 bool WebRtcSession::GetSslRole(const cricket::BaseChannel* channel, |
| 776 rtc::SSLRole* role) { |
| 777 return channel && GetSslRole(channel->transport_name(), role); |
| 772 } | 778 } |
| 773 | 779 |
| 774 void WebRtcSession::CreateOffer( | 780 void WebRtcSession::CreateOffer( |
| 775 CreateSessionDescriptionObserver* observer, | 781 CreateSessionDescriptionObserver* observer, |
| 776 const PeerConnectionInterface::RTCOfferAnswerOptions& options, | 782 const PeerConnectionInterface::RTCOfferAnswerOptions& options, |
| 777 const cricket::MediaSessionOptions& session_options) { | 783 const cricket::MediaSessionOptions& session_options) { |
| 778 webrtc_session_desc_factory_->CreateOffer(observer, options, session_options); | 784 webrtc_session_desc_factory_->CreateOffer(observer, options, session_options); |
| 779 } | 785 } |
| 780 | 786 |
| 781 void WebRtcSession::CreateAnswer( | 787 void WebRtcSession::CreateAnswer( |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 963 EnableChannels(); | 969 EnableChannels(); |
| 964 SetState(source == cricket::CS_LOCAL ? STATE_SENTPRANSWER | 970 SetState(source == cricket::CS_LOCAL ? STATE_SENTPRANSWER |
| 965 : STATE_RECEIVEDPRANSWER); | 971 : STATE_RECEIVEDPRANSWER); |
| 966 if (!PushdownMediaDescription(cricket::CA_PRANSWER, source, err_desc)) { | 972 if (!PushdownMediaDescription(cricket::CA_PRANSWER, source, err_desc)) { |
| 967 SetError(ERROR_CONTENT, *err_desc); | 973 SetError(ERROR_CONTENT, *err_desc); |
| 968 } | 974 } |
| 969 if (error() != ERROR_NONE) { | 975 if (error() != ERROR_NONE) { |
| 970 return BadPranswerSdp(source, GetSessionErrorMsg(), err_desc); | 976 return BadPranswerSdp(source, GetSessionErrorMsg(), err_desc); |
| 971 } | 977 } |
| 972 } else if (action == kAnswer) { | 978 } else if (action == kAnswer) { |
| 973 if (!PushdownTransportDescription(source, cricket::CA_ANSWER, &td_err)) { | |
| 974 return BadAnswerSdp(source, MakeTdErrorString(td_err), err_desc); | |
| 975 } | |
| 976 const cricket::ContentGroup* local_bundle = | 979 const cricket::ContentGroup* local_bundle = |
| 977 local_desc_->description()->GetGroupByName(cricket::GROUP_TYPE_BUNDLE); | 980 local_desc_->description()->GetGroupByName(cricket::GROUP_TYPE_BUNDLE); |
| 978 const cricket::ContentGroup* remote_bundle = | 981 const cricket::ContentGroup* remote_bundle = |
| 979 remote_desc_->description()->GetGroupByName(cricket::GROUP_TYPE_BUNDLE); | 982 remote_desc_->description()->GetGroupByName(cricket::GROUP_TYPE_BUNDLE); |
| 980 if (local_bundle && remote_bundle) { | 983 if (local_bundle && remote_bundle) { |
| 981 // The answerer decides the transport to bundle on | 984 // The answerer decides the transport to bundle on. |
| 982 const cricket::ContentGroup* answer_bundle = | 985 const cricket::ContentGroup* answer_bundle = |
| 983 (source == cricket::CS_LOCAL ? local_bundle : remote_bundle); | 986 (source == cricket::CS_LOCAL ? local_bundle : remote_bundle); |
| 984 if (!EnableBundle(*answer_bundle)) { | 987 if (!EnableBundle(*answer_bundle)) { |
| 985 LOG(LS_WARNING) << "Failed to enable BUNDLE."; | 988 LOG(LS_WARNING) << "Failed to enable BUNDLE."; |
| 986 return BadAnswerSdp(source, kEnableBundleFailed, err_desc); | 989 return BadAnswerSdp(source, kEnableBundleFailed, err_desc); |
| 987 } | 990 } |
| 988 } | 991 } |
| 992 // Only push down the transport description after enabling BUNDLE; we don't |
| 993 // want to push down a description on a transport about to be destroyed. |
| 994 if (!PushdownTransportDescription(source, cricket::CA_ANSWER, &td_err)) { |
| 995 return BadAnswerSdp(source, MakeTdErrorString(td_err), err_desc); |
| 996 } |
| 989 EnableChannels(); | 997 EnableChannels(); |
| 990 SetState(STATE_INPROGRESS); | 998 SetState(STATE_INPROGRESS); |
| 991 if (!PushdownMediaDescription(cricket::CA_ANSWER, source, err_desc)) { | 999 if (!PushdownMediaDescription(cricket::CA_ANSWER, source, err_desc)) { |
| 992 SetError(ERROR_CONTENT, *err_desc); | 1000 SetError(ERROR_CONTENT, *err_desc); |
| 993 } | 1001 } |
| 994 if (error() != ERROR_NONE) { | 1002 if (error() != ERROR_NONE) { |
| 995 return BadAnswerSdp(source, GetSessionErrorMsg(), err_desc); | 1003 return BadAnswerSdp(source, GetSessionErrorMsg(), err_desc); |
| 996 } | 1004 } |
| 997 } | 1005 } |
| 998 return true; | 1006 return true; |
| (...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2196 } | 2204 } |
| 2197 } | 2205 } |
| 2198 | 2206 |
| 2199 void WebRtcSession::OnSentPacket_w(cricket::TransportChannel* channel, | 2207 void WebRtcSession::OnSentPacket_w(cricket::TransportChannel* channel, |
| 2200 const rtc::SentPacket& sent_packet) { | 2208 const rtc::SentPacket& sent_packet) { |
| 2201 RTC_DCHECK(worker_thread()->IsCurrent()); | 2209 RTC_DCHECK(worker_thread()->IsCurrent()); |
| 2202 media_controller_->call_w()->OnSentPacket(sent_packet); | 2210 media_controller_->call_w()->OnSentPacket(sent_packet); |
| 2203 } | 2211 } |
| 2204 | 2212 |
| 2205 } // namespace webrtc | 2213 } // namespace webrtc |
| OLD | NEW |