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

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

Issue 1460043002: Don't call the Pass methods of rtc::Buffer, rtc::scoped_ptr, and rtc::ScopedVector (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Restore the Pass methods Created 5 years 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 10 matching lines...) Expand all
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28 #include "talk/app/webrtc/peerconnection.h" 28 #include "talk/app/webrtc/peerconnection.h"
29 29
30 #include <algorithm> 30 #include <algorithm>
31 #include <cctype> // for isdigit
32 #include <utility>
31 #include <vector> 33 #include <vector>
32 #include <cctype> // for isdigit
33 34
34 #include "talk/app/webrtc/audiotrack.h" 35 #include "talk/app/webrtc/audiotrack.h"
35 #include "talk/app/webrtc/dtmfsender.h" 36 #include "talk/app/webrtc/dtmfsender.h"
36 #include "talk/app/webrtc/jsepicecandidate.h" 37 #include "talk/app/webrtc/jsepicecandidate.h"
37 #include "talk/app/webrtc/jsepsessiondescription.h" 38 #include "talk/app/webrtc/jsepsessiondescription.h"
38 #include "talk/app/webrtc/mediaconstraintsinterface.h" 39 #include "talk/app/webrtc/mediaconstraintsinterface.h"
39 #include "talk/app/webrtc/mediastream.h" 40 #include "talk/app/webrtc/mediastream.h"
40 #include "talk/app/webrtc/mediastreamobserver.h" 41 #include "talk/app/webrtc/mediastreamobserver.h"
41 #include "talk/app/webrtc/mediastreamproxy.h" 42 #include "talk/app/webrtc/mediastreamproxy.h"
42 #include "talk/app/webrtc/mediastreamtrackproxy.h" 43 #include "talk/app/webrtc/mediastreamtrackproxy.h"
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 626
626 // This Initialize function parses ICE servers an extra time, but it will 627 // This Initialize function parses ICE servers an extra time, but it will
627 // be removed once all PortAllocaotrs support SetIceServers. 628 // be removed once all PortAllocaotrs support SetIceServers.
628 std::vector<PortAllocatorFactoryInterface::StunConfiguration> stun_config; 629 std::vector<PortAllocatorFactoryInterface::StunConfiguration> stun_config;
629 std::vector<PortAllocatorFactoryInterface::TurnConfiguration> turn_config; 630 std::vector<PortAllocatorFactoryInterface::TurnConfiguration> turn_config;
630 if (!ParseIceServers(configuration.servers, &stun_config, &turn_config)) { 631 if (!ParseIceServers(configuration.servers, &stun_config, &turn_config)) {
631 return false; 632 return false;
632 } 633 }
633 rtc::scoped_ptr<cricket::PortAllocator> allocator( 634 rtc::scoped_ptr<cricket::PortAllocator> allocator(
634 allocator_factory->CreatePortAllocator(stun_config, turn_config)); 635 allocator_factory->CreatePortAllocator(stun_config, turn_config));
635 return Initialize(configuration, constraints, allocator.Pass(), 636 return Initialize(configuration, constraints, std::move(allocator),
636 dtls_identity_store.Pass(), observer); 637 std::move(dtls_identity_store), observer);
637 } 638 }
638 639
639 bool PeerConnection::Initialize( 640 bool PeerConnection::Initialize(
640 const PeerConnectionInterface::RTCConfiguration& configuration, 641 const PeerConnectionInterface::RTCConfiguration& configuration,
641 const MediaConstraintsInterface* constraints, 642 const MediaConstraintsInterface* constraints,
642 rtc::scoped_ptr<cricket::PortAllocator> allocator, 643 rtc::scoped_ptr<cricket::PortAllocator> allocator,
643 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, 644 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
644 PeerConnectionObserver* observer) { 645 PeerConnectionObserver* observer) {
645 TRACE_EVENT0("webrtc", "PeerConnection::Initialize"); 646 TRACE_EVENT0("webrtc", "PeerConnection::Initialize");
646 RTC_DCHECK(observer != nullptr); 647 RTC_DCHECK(observer != nullptr);
647 if (!observer) { 648 if (!observer) {
648 return false; 649 return false;
649 } 650 }
650 observer_ = observer; 651 observer_ = observer;
651 652
652 port_allocator_ = allocator.Pass(); 653 port_allocator_ = std::move(allocator);
653 654
654 std::vector<PortAllocatorFactoryInterface::StunConfiguration> stun_config; 655 std::vector<PortAllocatorFactoryInterface::StunConfiguration> stun_config;
655 std::vector<PortAllocatorFactoryInterface::TurnConfiguration> turn_config; 656 std::vector<PortAllocatorFactoryInterface::TurnConfiguration> turn_config;
656 if (!ParseIceServers(configuration.servers, &stun_config, &turn_config)) { 657 if (!ParseIceServers(configuration.servers, &stun_config, &turn_config)) {
657 return false; 658 return false;
658 } 659 }
659 660
660 cricket::ServerAddresses cricket_stuns; 661 cricket::ServerAddresses cricket_stuns;
661 std::vector<cricket::RelayServerConfig> cricket_turns; 662 std::vector<cricket::RelayServerConfig> cricket_turns;
662 ConvertToCricketIceServers(stun_config, turn_config, &cricket_stuns, 663 ConvertToCricketIceServers(stun_config, turn_config, &cricket_stuns,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 remote_stream_factory_.reset(new RemoteMediaStreamFactory( 695 remote_stream_factory_.reset(new RemoteMediaStreamFactory(
695 factory_->signaling_thread(), media_controller_->channel_manager())); 696 factory_->signaling_thread(), media_controller_->channel_manager()));
696 697
697 session_.reset( 698 session_.reset(
698 new WebRtcSession(media_controller_.get(), factory_->signaling_thread(), 699 new WebRtcSession(media_controller_.get(), factory_->signaling_thread(),
699 factory_->worker_thread(), port_allocator_.get())); 700 factory_->worker_thread(), port_allocator_.get()));
700 stats_.reset(new StatsCollector(this)); 701 stats_.reset(new StatsCollector(this));
701 702
702 // Initialize the WebRtcSession. It creates transport channels etc. 703 // Initialize the WebRtcSession. It creates transport channels etc.
703 if (!session_->Initialize(factory_->options(), constraints, 704 if (!session_->Initialize(factory_->options(), constraints,
704 dtls_identity_store.Pass(), configuration)) { 705 std::move(dtls_identity_store), configuration)) {
705 return false; 706 return false;
706 } 707 }
707 708
708 // Register PeerConnection as receiver of local ice candidates. 709 // Register PeerConnection as receiver of local ice candidates.
709 // All the callbacks will be posted to the application from PeerConnection. 710 // All the callbacks will be posted to the application from PeerConnection.
710 session_->RegisterIceObserver(this); 711 session_->RegisterIceObserver(this);
711 session_->SignalState.connect(this, &PeerConnection::OnSessionStateChange); 712 session_->SignalState.connect(this, &PeerConnection::OnSessionStateChange);
712 session_->SignalVoiceChannelDestroyed.connect( 713 session_->SignalVoiceChannelDestroyed.connect(
713 this, &PeerConnection::OnVoiceChannelDestroyed); 714 this, &PeerConnection::OnVoiceChannelDestroyed);
714 session_->SignalVideoChannelDestroyed.connect( 715 session_->SignalVideoChannelDestroyed.connect(
(...skipping 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after
2071 DataChannel* PeerConnection::FindDataChannelBySid(int sid) const { 2072 DataChannel* PeerConnection::FindDataChannelBySid(int sid) const {
2072 for (const auto& channel : sctp_data_channels_) { 2073 for (const auto& channel : sctp_data_channels_) {
2073 if (channel->id() == sid) { 2074 if (channel->id() == sid) {
2074 return channel; 2075 return channel;
2075 } 2076 }
2076 } 2077 }
2077 return nullptr; 2078 return nullptr;
2078 } 2079 }
2079 2080
2080 } // namespace webrtc 2081 } // namespace webrtc
OLDNEW
« no previous file with comments | « talk/app/webrtc/java/jni/peerconnection_jni.cc ('k') | talk/app/webrtc/peerconnection_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698