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

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: Remove redundant reset(nullptr) 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
« no previous file with comments | « talk/app/webrtc/webrtcsession.h ('k') | talk/libjingle.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 WebRtcSession::~WebRtcSession() { 563 WebRtcSession::~WebRtcSession() {
564 ASSERT(signaling_thread()->IsCurrent()); 564 ASSERT(signaling_thread()->IsCurrent());
565 // Destroy video_channel_ first since it may have a pointer to the 565 // Destroy video_channel_ first since it may have a pointer to the
566 // voice_channel_. 566 // voice_channel_.
567 if (video_channel_) { 567 if (video_channel_) {
568 SignalVideoChannelDestroyed(); 568 SignalVideoChannelDestroyed();
569 channel_manager_->DestroyVideoChannel(video_channel_.release()); 569 channel_manager_->DestroyVideoChannel(video_channel_.release());
570 } 570 }
571 if (voice_channel_) { 571 if (voice_channel_) {
572 SignalVoiceChannelDestroyed(); 572 SignalVoiceChannelDestroyed();
573 channel_manager_->DestroyVoiceChannel(voice_channel_.release(), nullptr); 573 channel_manager_->DestroyVoiceChannel(voice_channel_.release());
574 } 574 }
575 if (data_channel_) { 575 if (data_channel_) {
576 SignalDataChannelDestroyed(); 576 SignalDataChannelDestroyed();
577 channel_manager_->DestroyDataChannel(data_channel_.release()); 577 channel_manager_->DestroyDataChannel(data_channel_.release());
578 } 578 }
579 for (size_t i = 0; i < saved_candidates_.size(); ++i) { 579 for (size_t i = 0; i < saved_candidates_.size(); ++i) {
580 delete saved_candidates_[i]; 580 delete saved_candidates_[i];
581 } 581 }
582 } 582 }
583 583
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 } 776 }
777 port_allocator()->set_candidate_filter( 777 port_allocator()->set_candidate_filter(
778 ConvertIceTransportTypeToCandidateFilter(rtc_configuration.type)); 778 ConvertIceTransportTypeToCandidateFilter(rtc_configuration.type));
779 779
780 if (rtc_configuration.enable_localhost_ice_candidate) { 780 if (rtc_configuration.enable_localhost_ice_candidate) {
781 port_allocator()->set_flags( 781 port_allocator()->set_flags(
782 port_allocator()->flags() | 782 port_allocator()->flags() |
783 cricket::PORTALLOCATOR_ENABLE_LOCALHOST_CANDIDATE); 783 cricket::PORTALLOCATOR_ENABLE_LOCALHOST_CANDIDATE);
784 } 784 }
785 785
786 media_controller_.reset(MediaControllerInterface::Create(
787 worker_thread(), channel_manager_->media_engine()->GetVoE()));
788
786 return true; 789 return true;
787 } 790 }
788 791
789 void WebRtcSession::Terminate() { 792 void WebRtcSession::Terminate() {
790 SetState(STATE_RECEIVEDTERMINATE); 793 SetState(STATE_RECEIVEDTERMINATE);
791 RemoveUnusedChannelsAndTransports(NULL); 794 RemoveUnusedChannelsAndTransports(NULL);
792 ASSERT(!voice_channel_); 795 ASSERT(!voice_channel_);
793 ASSERT(!video_channel_); 796 ASSERT(!video_channel_);
794 ASSERT(!data_channel_); 797 ASSERT(!data_channel_);
795 } 798 }
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
1683 channel_manager_->DestroyVideoChannel(video_channel_.release()); 1686 channel_manager_->DestroyVideoChannel(video_channel_.release());
1684 DestroyTransportProxy(content_name); 1687 DestroyTransportProxy(content_name);
1685 } 1688 }
1686 1689
1687 const cricket::ContentInfo* voice_info = 1690 const cricket::ContentInfo* voice_info =
1688 cricket::GetFirstAudioContent(desc); 1691 cricket::GetFirstAudioContent(desc);
1689 if ((!voice_info || voice_info->rejected) && voice_channel_) { 1692 if ((!voice_info || voice_info->rejected) && voice_channel_) {
1690 mediastream_signaling_->OnAudioChannelClose(); 1693 mediastream_signaling_->OnAudioChannelClose();
1691 SignalVoiceChannelDestroyed(); 1694 SignalVoiceChannelDestroyed();
1692 const std::string content_name = voice_channel_->content_name(); 1695 const std::string content_name = voice_channel_->content_name();
1693 channel_manager_->DestroyVoiceChannel(voice_channel_.release(), 1696 channel_manager_->DestroyVoiceChannel(voice_channel_.release());
1694 video_channel_.get());
1695 DestroyTransportProxy(content_name); 1697 DestroyTransportProxy(content_name);
1696 } 1698 }
1697 1699
1698 const cricket::ContentInfo* data_info = 1700 const cricket::ContentInfo* data_info =
1699 cricket::GetFirstDataContent(desc); 1701 cricket::GetFirstDataContent(desc);
1700 if ((!data_info || data_info->rejected) && data_channel_) { 1702 if ((!data_info || data_info->rejected) && data_channel_) {
1701 mediastream_signaling_->OnDataChannelClose(); 1703 mediastream_signaling_->OnDataChannelClose();
1702 SignalDataChannelDestroyed(); 1704 SignalDataChannelDestroyed();
1703 const std::string content_name = data_channel_->content_name(); 1705 const std::string content_name = data_channel_->content_name();
1704 channel_manager_->DestroyDataChannel(data_channel_.release()); 1706 channel_manager_->DestroyDataChannel(data_channel_.release());
1705 DestroyTransportProxy(content_name); 1707 DestroyTransportProxy(content_name);
1706 } 1708 }
1707 } 1709 }
1708 1710
1709 // TODO(mallinath) - Add a correct error code if the channels are not creatued 1711 // TODO(mallinath) - Add a correct error code if the channels are not created
1710 // due to BUNDLE is enabled but rtcp-mux is disabled. 1712 // due to BUNDLE is enabled but rtcp-mux is disabled.
1711 bool WebRtcSession::CreateChannels(const SessionDescription* desc) { 1713 bool WebRtcSession::CreateChannels(const SessionDescription* desc) {
1712 // Creating the media channels and transport proxies. 1714 // Creating the media channels and transport proxies.
1713 const cricket::ContentInfo* voice = cricket::GetFirstAudioContent(desc); 1715 const cricket::ContentInfo* voice = cricket::GetFirstAudioContent(desc);
1714 if (voice && !voice->rejected && !voice_channel_) { 1716 if (voice && !voice->rejected && !voice_channel_) {
1715 if (!CreateVoiceChannel(voice)) { 1717 if (!CreateVoiceChannel(voice)) {
1716 LOG(LS_ERROR) << "Failed to create voice channel."; 1718 LOG(LS_ERROR) << "Failed to create voice channel.";
1717 return false; 1719 return false;
1718 } 1720 }
1719 } 1721 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1759 LOG(LS_WARNING) << "max-bundle failed to enable bundling."; 1761 LOG(LS_WARNING) << "max-bundle failed to enable bundling.";
1760 return false; 1762 return false;
1761 } 1763 }
1762 } 1764 }
1763 1765
1764 return true; 1766 return true;
1765 } 1767 }
1766 1768
1767 bool WebRtcSession::CreateVoiceChannel(const cricket::ContentInfo* content) { 1769 bool WebRtcSession::CreateVoiceChannel(const cricket::ContentInfo* content) {
1768 voice_channel_.reset(channel_manager_->CreateVoiceChannel( 1770 voice_channel_.reset(channel_manager_->CreateVoiceChannel(
1769 this, content->name, true, audio_options_)); 1771 media_controller_.get(), this, content->name, true, audio_options_));
1770 if (!voice_channel_) { 1772 if (!voice_channel_) {
1771 return false; 1773 return false;
1772 } 1774 }
1773 1775
1774 voice_channel_->SignalDtlsSetupFailure.connect( 1776 voice_channel_->SignalDtlsSetupFailure.connect(
1775 this, &WebRtcSession::OnDtlsSetupFailure); 1777 this, &WebRtcSession::OnDtlsSetupFailure);
1776 return true; 1778 return true;
1777 } 1779 }
1778 1780
1779 bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content) { 1781 bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content) {
1780 video_channel_.reset(channel_manager_->CreateVideoChannel( 1782 video_channel_.reset(channel_manager_->CreateVideoChannel(
1781 this, content->name, true, video_options_, voice_channel_.get())); 1783 media_controller_.get(), this, content->name, true, video_options_));
1782 if (!video_channel_) { 1784 if (!video_channel_) {
1783 return false; 1785 return false;
1784 } 1786 }
1785 1787
1786 video_channel_->SignalDtlsSetupFailure.connect( 1788 video_channel_->SignalDtlsSetupFailure.connect(
1787 this, &WebRtcSession::OnDtlsSetupFailure); 1789 this, &WebRtcSession::OnDtlsSetupFailure);
1788 return true; 1790 return true;
1789 } 1791 }
1790 1792
1791 bool WebRtcSession::CreateDataChannel(const cricket::ContentInfo* content) { 1793 bool WebRtcSession::CreateDataChannel(const cricket::ContentInfo* content) {
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
2083 2085
2084 if (!srtp_cipher.empty()) { 2086 if (!srtp_cipher.empty()) {
2085 metrics_observer_->AddHistogramSample(srtp_name, srtp_cipher); 2087 metrics_observer_->AddHistogramSample(srtp_name, srtp_cipher);
2086 } 2088 }
2087 if (!ssl_cipher.empty()) { 2089 if (!ssl_cipher.empty()) {
2088 metrics_observer_->AddHistogramSample(ssl_name, ssl_cipher); 2090 metrics_observer_->AddHistogramSample(ssl_name, ssl_cipher);
2089 } 2091 }
2090 } 2092 }
2091 2093
2092 } // namespace webrtc 2094 } // namespace webrtc
OLDNEW
« no previous file with comments | « talk/app/webrtc/webrtcsession.h ('k') | talk/libjingle.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698