Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(574)

Side by Side Diff: talk/app/webrtc/webrtcsession.cc

Issue 1269863005: MediaController/Call instantiation. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Misplaced assertion Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 ice_restart_latch_(new IceRestartAnswerLatch), 544 ice_restart_latch_(new IceRestartAnswerLatch),
545 metrics_observer_(NULL) { 545 metrics_observer_(NULL) {
546 } 546 }
547 547
548 WebRtcSession::~WebRtcSession() { 548 WebRtcSession::~WebRtcSession() {
549 ASSERT(signaling_thread()->IsCurrent()); 549 ASSERT(signaling_thread()->IsCurrent());
550 // Destroy video_channel_ first since it may have a pointer to the 550 // Destroy video_channel_ first since it may have a pointer to the
551 // voice_channel_. 551 // voice_channel_.
552 if (video_channel_) { 552 if (video_channel_) {
553 SignalVideoChannelDestroyed(); 553 SignalVideoChannelDestroyed();
554 media_controller_->set_video_channel(nullptr);
554 channel_manager_->DestroyVideoChannel(video_channel_.release()); 555 channel_manager_->DestroyVideoChannel(video_channel_.release());
555 } 556 }
556 if (voice_channel_) { 557 if (voice_channel_) {
557 SignalVoiceChannelDestroyed(); 558 SignalVoiceChannelDestroyed();
558 channel_manager_->DestroyVoiceChannel(voice_channel_.release(), nullptr); 559 channel_manager_->DestroyVoiceChannel(voice_channel_.release());
559 } 560 }
560 if (data_channel_) { 561 if (data_channel_) {
561 SignalDataChannelDestroyed(); 562 SignalDataChannelDestroyed();
562 channel_manager_->DestroyDataChannel(data_channel_.release()); 563 channel_manager_->DestroyDataChannel(data_channel_.release());
563 } 564 }
565 media_controller_.reset(nullptr);
564 for (size_t i = 0; i < saved_candidates_.size(); ++i) { 566 for (size_t i = 0; i < saved_candidates_.size(); ++i) {
565 delete saved_candidates_[i]; 567 delete saved_candidates_[i];
566 } 568 }
567 } 569 }
568 570
569 bool WebRtcSession::Initialize( 571 bool WebRtcSession::Initialize(
570 const PeerConnectionFactoryInterface::Options& options, 572 const PeerConnectionFactoryInterface::Options& options,
571 const MediaConstraintsInterface* constraints, 573 const MediaConstraintsInterface* constraints,
572 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, 574 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
573 const PeerConnectionInterface::RTCConfiguration& rtc_configuration) { 575 const PeerConnectionInterface::RTCConfiguration& rtc_configuration) {
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 } 763 }
762 port_allocator()->set_candidate_filter( 764 port_allocator()->set_candidate_filter(
763 ConvertIceTransportTypeToCandidateFilter(rtc_configuration.type)); 765 ConvertIceTransportTypeToCandidateFilter(rtc_configuration.type));
764 766
765 if (rtc_configuration.enable_localhost_ice_candidate) { 767 if (rtc_configuration.enable_localhost_ice_candidate) {
766 port_allocator()->set_flags( 768 port_allocator()->set_flags(
767 port_allocator()->flags() | 769 port_allocator()->flags() |
768 cricket::PORTALLOCATOR_ENABLE_LOCALHOST_CANDIDATE); 770 cricket::PORTALLOCATOR_ENABLE_LOCALHOST_CANDIDATE);
769 } 771 }
770 772
773 media_controller_.reset(
774 new MediaController(worker_thread(),
775 channel_manager_->media_engine()->GetVoE()));
776
771 return true; 777 return true;
772 } 778 }
773 779
774 void WebRtcSession::Terminate() { 780 void WebRtcSession::Terminate() {
775 SetState(STATE_RECEIVEDTERMINATE); 781 SetState(STATE_RECEIVEDTERMINATE);
776 RemoveUnusedChannelsAndTransports(NULL); 782 RemoveUnusedChannelsAndTransports(NULL);
777 ASSERT(!voice_channel_); 783 ASSERT(!voice_channel_);
778 ASSERT(!video_channel_); 784 ASSERT(!video_channel_);
779 ASSERT(!data_channel_); 785 ASSERT(!data_channel_);
780 } 786 }
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
1671 void WebRtcSession::RemoveUnusedChannelsAndTransports( 1677 void WebRtcSession::RemoveUnusedChannelsAndTransports(
1672 const SessionDescription* desc) { 1678 const SessionDescription* desc) {
1673 // Destroy video_channel_ first since it may have a pointer to the 1679 // Destroy video_channel_ first since it may have a pointer to the
1674 // voice_channel_. 1680 // voice_channel_.
1675 const cricket::ContentInfo* video_info = 1681 const cricket::ContentInfo* video_info =
1676 cricket::GetFirstVideoContent(desc); 1682 cricket::GetFirstVideoContent(desc);
1677 if ((!video_info || video_info->rejected) && video_channel_) { 1683 if ((!video_info || video_info->rejected) && video_channel_) {
1678 mediastream_signaling_->OnVideoChannelClose(); 1684 mediastream_signaling_->OnVideoChannelClose();
1679 SignalVideoChannelDestroyed(); 1685 SignalVideoChannelDestroyed();
1680 const std::string content_name = video_channel_->content_name(); 1686 const std::string content_name = video_channel_->content_name();
1687 media_controller_->set_video_channel(nullptr);
1681 channel_manager_->DestroyVideoChannel(video_channel_.release()); 1688 channel_manager_->DestroyVideoChannel(video_channel_.release());
1682 DestroyTransportProxy(content_name); 1689 DestroyTransportProxy(content_name);
1683 } 1690 }
1684 1691
1685 const cricket::ContentInfo* voice_info = 1692 const cricket::ContentInfo* voice_info =
1686 cricket::GetFirstAudioContent(desc); 1693 cricket::GetFirstAudioContent(desc);
1687 if ((!voice_info || voice_info->rejected) && voice_channel_) { 1694 if ((!voice_info || voice_info->rejected) && voice_channel_) {
1688 mediastream_signaling_->OnAudioChannelClose(); 1695 mediastream_signaling_->OnAudioChannelClose();
1689 SignalVoiceChannelDestroyed(); 1696 SignalVoiceChannelDestroyed();
1690 const std::string content_name = voice_channel_->content_name(); 1697 const std::string content_name = voice_channel_->content_name();
1691 channel_manager_->DestroyVoiceChannel(voice_channel_.release(), 1698 channel_manager_->DestroyVoiceChannel(voice_channel_.release());
1692 video_channel_.get());
1693 DestroyTransportProxy(content_name); 1699 DestroyTransportProxy(content_name);
1694 } 1700 }
1695 1701
1696 const cricket::ContentInfo* data_info = 1702 const cricket::ContentInfo* data_info =
1697 cricket::GetFirstDataContent(desc); 1703 cricket::GetFirstDataContent(desc);
1698 if ((!data_info || data_info->rejected) && data_channel_) { 1704 if ((!data_info || data_info->rejected) && data_channel_) {
1699 mediastream_signaling_->OnDataChannelClose(); 1705 mediastream_signaling_->OnDataChannelClose();
1700 SignalDataChannelDestroyed(); 1706 SignalDataChannelDestroyed();
1701 const std::string content_name = data_channel_->content_name(); 1707 const std::string content_name = data_channel_->content_name();
1702 channel_manager_->DestroyDataChannel(data_channel_.release()); 1708 channel_manager_->DestroyDataChannel(data_channel_.release());
1703 DestroyTransportProxy(content_name); 1709 DestroyTransportProxy(content_name);
1704 } 1710 }
1705 } 1711 }
1706 1712
1707 // TODO(mallinath) - Add a correct error code if the channels are not creatued 1713 // TODO(mallinath) - Add a correct error code if the channels are not created
1708 // due to BUNDLE is enabled but rtcp-mux is disabled. 1714 // due to BUNDLE is enabled but rtcp-mux is disabled.
1709 bool WebRtcSession::CreateChannels(const SessionDescription* desc) { 1715 bool WebRtcSession::CreateChannels(const SessionDescription* desc) {
1710 // Creating the media channels and transport proxies. 1716 // Creating the media channels and transport proxies.
1711 const cricket::ContentInfo* voice = cricket::GetFirstAudioContent(desc); 1717 const cricket::ContentInfo* voice = cricket::GetFirstAudioContent(desc);
1712 if (voice && !voice->rejected && !voice_channel_) { 1718 if (voice && !voice->rejected && !voice_channel_) {
1713 if (!CreateVoiceChannel(voice)) { 1719 if (!CreateVoiceChannel(voice)) {
1714 LOG(LS_ERROR) << "Failed to create voice channel."; 1720 LOG(LS_ERROR) << "Failed to create voice channel.";
1715 return false; 1721 return false;
1716 } 1722 }
1717 } 1723 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1756 if (!BaseSession::BundleContentGroup(bundle_group)) { 1762 if (!BaseSession::BundleContentGroup(bundle_group)) {
1757 LOG(LS_WARNING) << "max-bundle failed to enable bundling."; 1763 LOG(LS_WARNING) << "max-bundle failed to enable bundling.";
1758 return false; 1764 return false;
1759 } 1765 }
1760 } 1766 }
1761 1767
1762 return true; 1768 return true;
1763 } 1769 }
1764 1770
1765 bool WebRtcSession::CreateVoiceChannel(const cricket::ContentInfo* content) { 1771 bool WebRtcSession::CreateVoiceChannel(const cricket::ContentInfo* content) {
1766 voice_channel_.reset(channel_manager_->CreateVoiceChannel( 1772 voice_channel_.reset(channel_manager_->CreateVoiceChannel(this, content->name,
1767 this, content->name, true, audio_options_)); 1773 true, media_controller_->call(), audio_options_));
1768 if (!voice_channel_) { 1774 if (!voice_channel_) {
1769 return false; 1775 return false;
1770 } 1776 }
1771 1777
1772 voice_channel_->SignalDtlsSetupFailure.connect( 1778 voice_channel_->SignalDtlsSetupFailure.connect(
1773 this, &WebRtcSession::OnDtlsSetupFailure); 1779 this, &WebRtcSession::OnDtlsSetupFailure);
1774 return true; 1780 return true;
1775 } 1781 }
1776 1782
1777 bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content) { 1783 bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content) {
1778 video_channel_.reset(channel_manager_->CreateVideoChannel( 1784 video_channel_.reset(channel_manager_->CreateVideoChannel(this, content->name,
1779 this, content->name, true, video_options_, voice_channel_.get())); 1785 true, media_controller_->call(), video_options_));
1780 if (!video_channel_) { 1786 if (!video_channel_) {
1781 return false; 1787 return false;
1782 } 1788 }
1789 media_controller_->set_video_channel(video_channel_.get());
1783 1790
1784 video_channel_->SignalDtlsSetupFailure.connect( 1791 video_channel_->SignalDtlsSetupFailure.connect(
1785 this, &WebRtcSession::OnDtlsSetupFailure); 1792 this, &WebRtcSession::OnDtlsSetupFailure);
1786 return true; 1793 return true;
1787 } 1794 }
1788 1795
1789 bool WebRtcSession::CreateDataChannel(const cricket::ContentInfo* content) { 1796 bool WebRtcSession::CreateDataChannel(const cricket::ContentInfo* content) {
1790 bool sctp = (data_channel_type_ == cricket::DCT_SCTP); 1797 bool sctp = (data_channel_type_ == cricket::DCT_SCTP);
1791 data_channel_.reset(channel_manager_->CreateDataChannel( 1798 data_channel_.reset(channel_manager_->CreateDataChannel(
1792 this, content->name, !sctp, data_channel_type_)); 1799 this, content->name, !sctp, data_channel_type_));
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
2088 2095
2089 if (!srtp_cipher.empty()) { 2096 if (!srtp_cipher.empty()) {
2090 metrics_observer_->AddHistogramSample(srtp_name, srtp_cipher); 2097 metrics_observer_->AddHistogramSample(srtp_name, srtp_cipher);
2091 } 2098 }
2092 if (!ssl_cipher.empty()) { 2099 if (!ssl_cipher.empty()) {
2093 metrics_observer_->AddHistogramSample(ssl_name, ssl_cipher); 2100 metrics_observer_->AddHistogramSample(ssl_name, ssl_cipher);
2094 } 2101 }
2095 } 2102 }
2096 2103
2097 } // namespace webrtc 2104 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698