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

Side by Side Diff: webrtc/api/peerconnection.cc

Issue 2504103002: Adding GetConfiguration to PeerConnection. (Closed)
Patch Set: Fixing typo in comment. Created 4 years, 1 month 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 | « webrtc/api/peerconnection.h ('k') | webrtc/api/peerconnectioninterface.h » ('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 * 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 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 factory_->worker_thread(), factory_->signaling_thread(), 629 factory_->worker_thread(), factory_->signaling_thread(),
630 port_allocator_.get(), 630 port_allocator_.get(),
631 std::unique_ptr<cricket::TransportController>( 631 std::unique_ptr<cricket::TransportController>(
632 factory_->CreateTransportController( 632 factory_->CreateTransportController(
633 port_allocator_.get(), 633 port_allocator_.get(),
634 configuration.redetermine_role_on_ice_restart)))); 634 configuration.redetermine_role_on_ice_restart))));
635 635
636 stats_.reset(new StatsCollector(this)); 636 stats_.reset(new StatsCollector(this));
637 stats_collector_ = RTCStatsCollector::Create(this); 637 stats_collector_ = RTCStatsCollector::Create(this);
638 638
639 enable_ice_renomination_ = configuration.enable_ice_renomination;
640
641 // Initialize the WebRtcSession. It creates transport channels etc. 639 // Initialize the WebRtcSession. It creates transport channels etc.
642 if (!session_->Initialize(factory_->options(), std::move(cert_generator), 640 if (!session_->Initialize(factory_->options(), std::move(cert_generator),
643 configuration)) { 641 configuration)) {
644 return false; 642 return false;
645 } 643 }
646 644
647 // Register PeerConnection as receiver of local ice candidates. 645 // Register PeerConnection as receiver of local ice candidates.
648 // All the callbacks will be posted to the application from PeerConnection. 646 // All the callbacks will be posted to the application from PeerConnection.
649 session_->RegisterIceObserver(this); 647 session_->RegisterIceObserver(this);
650 session_->SignalState.connect(this, &PeerConnection::OnSessionStateChange); 648 session_->SignalState.connect(this, &PeerConnection::OnSessionStateChange);
651 session_->SignalVoiceChannelCreated.connect( 649 session_->SignalVoiceChannelCreated.connect(
652 this, &PeerConnection::OnVoiceChannelCreated); 650 this, &PeerConnection::OnVoiceChannelCreated);
653 session_->SignalVoiceChannelDestroyed.connect( 651 session_->SignalVoiceChannelDestroyed.connect(
654 this, &PeerConnection::OnVoiceChannelDestroyed); 652 this, &PeerConnection::OnVoiceChannelDestroyed);
655 session_->SignalVideoChannelCreated.connect( 653 session_->SignalVideoChannelCreated.connect(
656 this, &PeerConnection::OnVideoChannelCreated); 654 this, &PeerConnection::OnVideoChannelCreated);
657 session_->SignalVideoChannelDestroyed.connect( 655 session_->SignalVideoChannelDestroyed.connect(
658 this, &PeerConnection::OnVideoChannelDestroyed); 656 this, &PeerConnection::OnVideoChannelDestroyed);
659 session_->SignalDataChannelCreated.connect( 657 session_->SignalDataChannelCreated.connect(
660 this, &PeerConnection::OnDataChannelCreated); 658 this, &PeerConnection::OnDataChannelCreated);
661 session_->SignalDataChannelDestroyed.connect( 659 session_->SignalDataChannelDestroyed.connect(
662 this, &PeerConnection::OnDataChannelDestroyed); 660 this, &PeerConnection::OnDataChannelDestroyed);
663 session_->SignalDataChannelOpenMessage.connect( 661 session_->SignalDataChannelOpenMessage.connect(
664 this, &PeerConnection::OnDataChannelOpenMessage); 662 this, &PeerConnection::OnDataChannelOpenMessage);
663
664 configuration_ = configuration;
665 return true; 665 return true;
666 } 666 }
667 667
668 rtc::scoped_refptr<StreamCollectionInterface> 668 rtc::scoped_refptr<StreamCollectionInterface>
669 PeerConnection::local_streams() { 669 PeerConnection::local_streams() {
670 return local_streams_; 670 return local_streams_;
671 } 671 }
672 672
673 rtc::scoped_refptr<StreamCollectionInterface> 673 rtc::scoped_refptr<StreamCollectionInterface>
674 PeerConnection::remote_streams() { 674 PeerConnection::remote_streams() {
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
1248 rtc::scoped_refptr<MediaStreamInterface>(new_stream)); 1248 rtc::scoped_refptr<MediaStreamInterface>(new_stream));
1249 } 1249 }
1250 1250
1251 UpdateEndedRemoteMediaStreams(); 1251 UpdateEndedRemoteMediaStreams();
1252 1252
1253 SetSessionDescriptionMsg* msg = new SetSessionDescriptionMsg(observer); 1253 SetSessionDescriptionMsg* msg = new SetSessionDescriptionMsg(observer);
1254 signaling_thread()->Post(RTC_FROM_HERE, this, 1254 signaling_thread()->Post(RTC_FROM_HERE, this,
1255 MSG_SET_SESSIONDESCRIPTION_SUCCESS, msg); 1255 MSG_SET_SESSIONDESCRIPTION_SUCCESS, msg);
1256 } 1256 }
1257 1257
1258 PeerConnectionInterface::RTCConfiguration PeerConnection::GetConfiguration() {
1259 return configuration_;
1260 }
1261
1258 bool PeerConnection::SetConfiguration(const RTCConfiguration& configuration) { 1262 bool PeerConnection::SetConfiguration(const RTCConfiguration& configuration) {
1259 TRACE_EVENT0("webrtc", "PeerConnection::SetConfiguration"); 1263 TRACE_EVENT0("webrtc", "PeerConnection::SetConfiguration");
1264 // TODO(deadbeef): Return false and log an error if there are any unsupported
1265 // modifications.
1260 if (port_allocator_) { 1266 if (port_allocator_) {
1261 if (!network_thread()->Invoke<bool>( 1267 if (!network_thread()->Invoke<bool>(
1262 RTC_FROM_HERE, 1268 RTC_FROM_HERE,
1263 rtc::Bind(&PeerConnection::ReconfigurePortAllocator_n, this, 1269 rtc::Bind(&PeerConnection::ReconfigurePortAllocator_n, this,
1264 configuration))) { 1270 configuration))) {
1265 return false; 1271 return false;
1266 } 1272 }
1267 } 1273 }
1268 1274
1269 // TODO(deadbeef): Shouldn't have to hop to the worker thread twice... 1275 // TODO(deadbeef): Shouldn't have to hop to the worker thread twice...
1270 session_->SetIceConfig(session_->ParseIceConfig(configuration)); 1276 session_->SetIceConfig(session_->ParseIceConfig(configuration));
1271 1277
1272 enable_ice_renomination_ = configuration.enable_ice_renomination; 1278 configuration_ = configuration;
1273 return true; 1279 return true;
1274 } 1280 }
1275 1281
1276 bool PeerConnection::AddIceCandidate( 1282 bool PeerConnection::AddIceCandidate(
1277 const IceCandidateInterface* ice_candidate) { 1283 const IceCandidateInterface* ice_candidate) {
1278 TRACE_EVENT0("webrtc", "PeerConnection::AddIceCandidate"); 1284 TRACE_EVENT0("webrtc", "PeerConnection::AddIceCandidate");
1279 if (IsClosed()) { 1285 if (IsClosed()) {
1280 return false; 1286 return false;
1281 } 1287 }
1282 return session_->ProcessIceMessage(ice_candidate); 1288 return session_->ProcessIceMessage(ice_candidate);
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
1617 cricket::MediaSessionOptions* session_options) { 1623 cricket::MediaSessionOptions* session_options) {
1618 // TODO(deadbeef): Once we have transceivers, enumerate them here instead of 1624 // TODO(deadbeef): Once we have transceivers, enumerate them here instead of
1619 // ContentInfos. 1625 // ContentInfos.
1620 if (session_->local_description()) { 1626 if (session_->local_description()) {
1621 for (const cricket::ContentInfo& content : 1627 for (const cricket::ContentInfo& content :
1622 session_->local_description()->description()->contents()) { 1628 session_->local_description()->description()->contents()) {
1623 session_options->transport_options[content.name] = 1629 session_options->transport_options[content.name] =
1624 cricket::TransportOptions(); 1630 cricket::TransportOptions();
1625 } 1631 }
1626 } 1632 }
1627 session_options->enable_ice_renomination = enable_ice_renomination_; 1633 session_options->enable_ice_renomination =
1634 configuration_.enable_ice_renomination;
1628 1635
1629 if (!ExtractMediaSessionOptions(rtc_options, true, session_options)) { 1636 if (!ExtractMediaSessionOptions(rtc_options, true, session_options)) {
1630 return false; 1637 return false;
1631 } 1638 }
1632 1639
1633 AddSendStreams(session_options, senders_, rtp_data_channels_); 1640 AddSendStreams(session_options, senders_, rtp_data_channels_);
1634 // Offer to receive audio/video if the constraint is not set and there are 1641 // Offer to receive audio/video if the constraint is not set and there are
1635 // send streams, or we're currently receiving. 1642 // send streams, or we're currently receiving.
1636 if (rtc_options.offer_to_receive_audio == RTCOfferAnswerOptions::kUndefined) { 1643 if (rtc_options.offer_to_receive_audio == RTCOfferAnswerOptions::kUndefined) {
1637 session_options->recv_audio = 1644 session_options->recv_audio =
(...skipping 22 matching lines...) Expand all
1660 1667
1661 session_options->rtcp_cname = rtcp_cname_; 1668 session_options->rtcp_cname = rtcp_cname_;
1662 session_options->crypto_options = factory_->options().crypto_options; 1669 session_options->crypto_options = factory_->options().crypto_options;
1663 return true; 1670 return true;
1664 } 1671 }
1665 1672
1666 void PeerConnection::InitializeOptionsForAnswer( 1673 void PeerConnection::InitializeOptionsForAnswer(
1667 cricket::MediaSessionOptions* session_options) { 1674 cricket::MediaSessionOptions* session_options) {
1668 session_options->recv_audio = false; 1675 session_options->recv_audio = false;
1669 session_options->recv_video = false; 1676 session_options->recv_video = false;
1670 session_options->enable_ice_renomination = enable_ice_renomination_; 1677 session_options->enable_ice_renomination =
1678 configuration_.enable_ice_renomination;
1671 } 1679 }
1672 1680
1673 void PeerConnection::FinishOptionsForAnswer( 1681 void PeerConnection::FinishOptionsForAnswer(
1674 cricket::MediaSessionOptions* session_options) { 1682 cricket::MediaSessionOptions* session_options) {
1675 // TODO(deadbeef): Once we have transceivers, enumerate them here instead of 1683 // TODO(deadbeef): Once we have transceivers, enumerate them here instead of
1676 // ContentInfos. 1684 // ContentInfos.
1677 if (session_->remote_description()) { 1685 if (session_->remote_description()) {
1678 // Initialize the transport_options map. 1686 // Initialize the transport_options map.
1679 for (const cricket::ContentInfo& content : 1687 for (const cricket::ContentInfo& content :
1680 session_->remote_description()->description()->contents()) { 1688 session_->remote_description()->description()->contents()) {
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
2342 2350
2343 bool PeerConnection::StartRtcEventLog_w(rtc::PlatformFile file, 2351 bool PeerConnection::StartRtcEventLog_w(rtc::PlatformFile file,
2344 int64_t max_size_bytes) { 2352 int64_t max_size_bytes) {
2345 return event_log_->StartLogging(file, max_size_bytes); 2353 return event_log_->StartLogging(file, max_size_bytes);
2346 } 2354 }
2347 2355
2348 void PeerConnection::StopRtcEventLog_w() { 2356 void PeerConnection::StopRtcEventLog_w() {
2349 event_log_->StopLogging(); 2357 event_log_->StopLogging();
2350 } 2358 }
2351 } // namespace webrtc 2359 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/api/peerconnection.h ('k') | webrtc/api/peerconnectioninterface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698