| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 SignalDataChannelDestroyed(); | 521 SignalDataChannelDestroyed(); |
| 522 channel_manager_->DestroyDataChannel(data_channel_.release()); | 522 channel_manager_->DestroyDataChannel(data_channel_.release()); |
| 523 } | 523 } |
| 524 SignalDestroyed(); | 524 SignalDestroyed(); |
| 525 | 525 |
| 526 LOG(LS_INFO) << "Session: " << id() << " is destroyed."; | 526 LOG(LS_INFO) << "Session: " << id() << " is destroyed."; |
| 527 } | 527 } |
| 528 | 528 |
| 529 bool WebRtcSession::Initialize( | 529 bool WebRtcSession::Initialize( |
| 530 const PeerConnectionFactoryInterface::Options& options, | 530 const PeerConnectionFactoryInterface::Options& options, |
| 531 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, | 531 std::unique_ptr<DtlsIdentityStoreInterface> dtls_identity_store, |
| 532 const PeerConnectionInterface::RTCConfiguration& rtc_configuration) { | 532 const PeerConnectionInterface::RTCConfiguration& rtc_configuration) { |
| 533 bundle_policy_ = rtc_configuration.bundle_policy; | 533 bundle_policy_ = rtc_configuration.bundle_policy; |
| 534 rtcp_mux_policy_ = rtc_configuration.rtcp_mux_policy; | 534 rtcp_mux_policy_ = rtc_configuration.rtcp_mux_policy; |
| 535 transport_controller_->SetSslMaxProtocolVersion(options.ssl_max_version); | 535 transport_controller_->SetSslMaxProtocolVersion(options.ssl_max_version); |
| 536 | 536 |
| 537 // Obtain a certificate from RTCConfiguration if any were provided (optional). | 537 // Obtain a certificate from RTCConfiguration if any were provided (optional). |
| 538 rtc::scoped_refptr<rtc::RTCCertificate> certificate; | 538 rtc::scoped_refptr<rtc::RTCCertificate> certificate; |
| 539 if (!rtc_configuration.certificates.empty()) { | 539 if (!rtc_configuration.certificates.empty()) { |
| 540 // TODO(hbos,torbjorng): Decide on certificate-selection strategy instead of | 540 // TODO(hbos,torbjorng): Decide on certificate-selection strategy instead of |
| 541 // just picking the first one. The decision should be made based on the DTLS | 541 // just picking the first one. The decision should be made based on the DTLS |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 CreateSessionDescriptionObserver* observer, | 668 CreateSessionDescriptionObserver* observer, |
| 669 const cricket::MediaSessionOptions& session_options) { | 669 const cricket::MediaSessionOptions& session_options) { |
| 670 webrtc_session_desc_factory_->CreateAnswer(observer, session_options); | 670 webrtc_session_desc_factory_->CreateAnswer(observer, session_options); |
| 671 } | 671 } |
| 672 | 672 |
| 673 bool WebRtcSession::SetLocalDescription(SessionDescriptionInterface* desc, | 673 bool WebRtcSession::SetLocalDescription(SessionDescriptionInterface* desc, |
| 674 std::string* err_desc) { | 674 std::string* err_desc) { |
| 675 ASSERT(signaling_thread()->IsCurrent()); | 675 ASSERT(signaling_thread()->IsCurrent()); |
| 676 | 676 |
| 677 // Takes the ownership of |desc| regardless of the result. | 677 // Takes the ownership of |desc| regardless of the result. |
| 678 rtc::scoped_ptr<SessionDescriptionInterface> desc_temp(desc); | 678 std::unique_ptr<SessionDescriptionInterface> desc_temp(desc); |
| 679 | 679 |
| 680 // Validate SDP. | 680 // Validate SDP. |
| 681 if (!ValidateSessionDescription(desc, cricket::CS_LOCAL, err_desc)) { | 681 if (!ValidateSessionDescription(desc, cricket::CS_LOCAL, err_desc)) { |
| 682 return false; | 682 return false; |
| 683 } | 683 } |
| 684 | 684 |
| 685 // Update the initial_offerer flag if this session is the initial_offerer. | 685 // Update the initial_offerer flag if this session is the initial_offerer. |
| 686 Action action = GetAction(desc->type()); | 686 Action action = GetAction(desc->type()); |
| 687 if (state() == STATE_INIT && action == kOffer) { | 687 if (state() == STATE_INIT && action == kOffer) { |
| 688 initial_offerer_ = true; | 688 initial_offerer_ = true; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 return BadLocalSdp(desc->type(), GetSessionErrorMsg(), err_desc); | 724 return BadLocalSdp(desc->type(), GetSessionErrorMsg(), err_desc); |
| 725 } | 725 } |
| 726 return true; | 726 return true; |
| 727 } | 727 } |
| 728 | 728 |
| 729 bool WebRtcSession::SetRemoteDescription(SessionDescriptionInterface* desc, | 729 bool WebRtcSession::SetRemoteDescription(SessionDescriptionInterface* desc, |
| 730 std::string* err_desc) { | 730 std::string* err_desc) { |
| 731 ASSERT(signaling_thread()->IsCurrent()); | 731 ASSERT(signaling_thread()->IsCurrent()); |
| 732 | 732 |
| 733 // Takes the ownership of |desc| regardless of the result. | 733 // Takes the ownership of |desc| regardless of the result. |
| 734 rtc::scoped_ptr<SessionDescriptionInterface> desc_temp(desc); | 734 std::unique_ptr<SessionDescriptionInterface> desc_temp(desc); |
| 735 | 735 |
| 736 // Validate SDP. | 736 // Validate SDP. |
| 737 if (!ValidateSessionDescription(desc, cricket::CS_REMOTE, err_desc)) { | 737 if (!ValidateSessionDescription(desc, cricket::CS_REMOTE, err_desc)) { |
| 738 return false; | 738 return false; |
| 739 } | 739 } |
| 740 | 740 |
| 741 rtc::scoped_ptr<SessionDescriptionInterface> old_remote_desc( | 741 std::unique_ptr<SessionDescriptionInterface> old_remote_desc( |
| 742 remote_desc_.release()); | 742 remote_desc_.release()); |
| 743 remote_desc_.reset(desc_temp.release()); | 743 remote_desc_.reset(desc_temp.release()); |
| 744 | 744 |
| 745 // Transport and Media channels will be created only when offer is set. | 745 // Transport and Media channels will be created only when offer is set. |
| 746 Action action = GetAction(desc->type()); | 746 Action action = GetAction(desc->type()); |
| 747 if (action == kOffer && !CreateChannels(desc->description())) { | 747 if (action == kOffer && !CreateChannels(desc->description())) { |
| 748 // TODO(mallinath) - Handle CreateChannel failure, as new local description | 748 // TODO(mallinath) - Handle CreateChannel failure, as new local description |
| 749 // is applied. Restore back to old description. | 749 // is applied. Restore back to old description. |
| 750 return BadRemoteSdp(desc->type(), kCreateChannelFailed, err_desc); | 750 return BadRemoteSdp(desc->type(), kCreateChannelFailed, err_desc); |
| 751 } | 751 } |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1229 LOG(LS_ERROR) << "SetAudioPlayoutVolume: No audio channel exists."; | 1229 LOG(LS_ERROR) << "SetAudioPlayoutVolume: No audio channel exists."; |
| 1230 return; | 1230 return; |
| 1231 } | 1231 } |
| 1232 | 1232 |
| 1233 if (!voice_channel_->SetOutputVolume(ssrc, volume)) { | 1233 if (!voice_channel_->SetOutputVolume(ssrc, volume)) { |
| 1234 ASSERT(false); | 1234 ASSERT(false); |
| 1235 } | 1235 } |
| 1236 } | 1236 } |
| 1237 | 1237 |
| 1238 void WebRtcSession::SetRawAudioSink(uint32_t ssrc, | 1238 void WebRtcSession::SetRawAudioSink(uint32_t ssrc, |
| 1239 rtc::scoped_ptr<AudioSinkInterface> sink) { | 1239 std::unique_ptr<AudioSinkInterface> sink) { |
| 1240 ASSERT(signaling_thread()->IsCurrent()); | 1240 ASSERT(signaling_thread()->IsCurrent()); |
| 1241 if (!voice_channel_) | 1241 if (!voice_channel_) |
| 1242 return; | 1242 return; |
| 1243 | 1243 |
| 1244 voice_channel_->SetRawAudioSink(ssrc, std::move(sink)); | 1244 voice_channel_->SetRawAudioSink(ssrc, std::move(sink)); |
| 1245 } | 1245 } |
| 1246 | 1246 |
| 1247 RtpParameters WebRtcSession::GetAudioRtpParameters(uint32_t ssrc) const { | 1247 RtpParameters WebRtcSession::GetAudioRtpParameters(uint32_t ssrc) const { |
| 1248 ASSERT(signaling_thread()->IsCurrent()); | 1248 ASSERT(signaling_thread()->IsCurrent()); |
| 1249 if (voice_channel_) { | 1249 if (voice_channel_) { |
| (...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2155 } | 2155 } |
| 2156 } | 2156 } |
| 2157 | 2157 |
| 2158 void WebRtcSession::OnSentPacket_w(cricket::TransportChannel* channel, | 2158 void WebRtcSession::OnSentPacket_w(cricket::TransportChannel* channel, |
| 2159 const rtc::SentPacket& sent_packet) { | 2159 const rtc::SentPacket& sent_packet) { |
| 2160 RTC_DCHECK(worker_thread()->IsCurrent()); | 2160 RTC_DCHECK(worker_thread()->IsCurrent()); |
| 2161 media_controller_->call_w()->OnSentPacket(sent_packet); | 2161 media_controller_->call_w()->OnSentPacket(sent_packet); |
| 2162 } | 2162 } |
| 2163 | 2163 |
| 2164 } // namespace webrtc | 2164 } // namespace webrtc |
| OLD | NEW |