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

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

Issue 1956453003: Relanding: Implement RTCConfiguration.iceCandidatePoolSize. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixing uninitialized variable (noticed by msan) Created 4 years, 7 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 | « webrtc/api/webrtcsession.h ('k') | webrtc/api/webrtcsession_unittest.cc » ('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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 const std::string& desc) { 414 const std::string& desc) {
415 std::ostringstream ret; 415 std::ostringstream ret;
416 ret << error << " " << desc; 416 ret << error << " " << desc;
417 return ret.str(); 417 return ret.str();
418 } 418 }
419 419
420 static std::string MakeTdErrorString(const std::string& desc) { 420 static std::string MakeTdErrorString(const std::string& desc) {
421 return MakeErrorString(kPushDownTDFailed, desc); 421 return MakeErrorString(kPushDownTDFailed, desc);
422 } 422 }
423 423
424 uint32_t ConvertIceTransportTypeToCandidateFilter(
425 PeerConnectionInterface::IceTransportsType type) {
426 switch (type) {
427 case PeerConnectionInterface::kNone:
428 return cricket::CF_NONE;
429 case PeerConnectionInterface::kRelay:
430 return cricket::CF_RELAY;
431 case PeerConnectionInterface::kNoHost:
432 return (cricket::CF_ALL & ~cricket::CF_HOST);
433 case PeerConnectionInterface::kAll:
434 return cricket::CF_ALL;
435 default: ASSERT(false);
436 }
437 return cricket::CF_NONE;
438 }
439
440 // Returns true if |new_desc| requests an ICE restart (i.e., new ufrag/pwd). 424 // Returns true if |new_desc| requests an ICE restart (i.e., new ufrag/pwd).
441 bool CheckForRemoteIceRestart(const SessionDescriptionInterface* old_desc, 425 bool CheckForRemoteIceRestart(const SessionDescriptionInterface* old_desc,
442 const SessionDescriptionInterface* new_desc, 426 const SessionDescriptionInterface* new_desc,
443 const std::string& content_name) { 427 const std::string& content_name) {
444 if (!old_desc) { 428 if (!old_desc) {
445 return false; 429 return false;
446 } 430 }
447 const SessionDescription* new_sd = new_desc->description(); 431 const SessionDescription* new_sd = new_desc->description();
448 const SessionDescription* old_sd = old_desc->description(); 432 const SessionDescription* old_sd = old_desc->description();
449 const ContentInfo* cinfo = new_sd->GetContentByName(content_name); 433 const ContentInfo* cinfo = new_sd->GetContentByName(content_name);
(...skipping 18 matching lines...) Expand all
468 } 452 }
469 return false; 453 return false;
470 } 454 }
471 455
472 WebRtcSession::WebRtcSession(webrtc::MediaControllerInterface* media_controller, 456 WebRtcSession::WebRtcSession(webrtc::MediaControllerInterface* media_controller,
473 rtc::Thread* signaling_thread, 457 rtc::Thread* signaling_thread,
474 rtc::Thread* worker_thread, 458 rtc::Thread* worker_thread,
475 cricket::PortAllocator* port_allocator) 459 cricket::PortAllocator* port_allocator)
476 : signaling_thread_(signaling_thread), 460 : signaling_thread_(signaling_thread),
477 worker_thread_(worker_thread), 461 worker_thread_(worker_thread),
478 port_allocator_(port_allocator),
479 // RFC 3264: The numeric value of the session id and version in the 462 // RFC 3264: The numeric value of the session id and version in the
480 // o line MUST be representable with a "64 bit signed integer". 463 // o line MUST be representable with a "64 bit signed integer".
481 // Due to this constraint session id |sid_| is max limited to LLONG_MAX. 464 // Due to this constraint session id |sid_| is max limited to LLONG_MAX.
482 sid_(rtc::ToString(rtc::CreateRandomId64() & LLONG_MAX)), 465 sid_(rtc::ToString(rtc::CreateRandomId64() & LLONG_MAX)),
483 transport_controller_(new cricket::TransportController(signaling_thread, 466 transport_controller_(new cricket::TransportController(signaling_thread,
484 worker_thread, 467 worker_thread,
485 port_allocator)), 468 port_allocator)),
486 media_controller_(media_controller), 469 media_controller_(media_controller),
487 channel_manager_(media_controller_->channel_manager()), 470 channel_manager_(media_controller_->channel_manager()),
488 ice_observer_(NULL), 471 ice_observer_(NULL),
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 signaling_thread(), channel_manager_, certificate, this, id())); 580 signaling_thread(), channel_manager_, certificate, this, id()));
598 } 581 }
599 } 582 }
600 583
601 webrtc_session_desc_factory_->SignalCertificateReady.connect( 584 webrtc_session_desc_factory_->SignalCertificateReady.connect(
602 this, &WebRtcSession::OnCertificateReady); 585 this, &WebRtcSession::OnCertificateReady);
603 586
604 if (options.disable_encryption) { 587 if (options.disable_encryption) {
605 webrtc_session_desc_factory_->SetSdesPolicy(cricket::SEC_DISABLED); 588 webrtc_session_desc_factory_->SetSdesPolicy(cricket::SEC_DISABLED);
606 } 589 }
607 port_allocator()->set_candidate_filter(
608 ConvertIceTransportTypeToCandidateFilter(rtc_configuration.type));
609 590
610 return true; 591 return true;
611 } 592 }
612 593
613 void WebRtcSession::Close() { 594 void WebRtcSession::Close() {
614 SetState(STATE_CLOSED); 595 SetState(STATE_CLOSED);
615 RemoveUnusedChannels(nullptr); 596 RemoveUnusedChannels(nullptr);
616 ASSERT(!voice_channel_); 597 ASSERT(!voice_channel_);
617 ASSERT(!video_channel_); 598 ASSERT(!video_channel_);
618 ASSERT(!data_channel_); 599 ASSERT(!data_channel_);
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 1119
1139 // Remove the candidates from the transport controller. 1120 // Remove the candidates from the transport controller.
1140 std::string error; 1121 std::string error;
1141 bool res = transport_controller_->RemoveRemoteCandidates(candidates, &error); 1122 bool res = transport_controller_->RemoveRemoteCandidates(candidates, &error);
1142 if (!res && !error.empty()) { 1123 if (!res && !error.empty()) {
1143 LOG(LS_ERROR) << "Error when removing remote candidates: " << error; 1124 LOG(LS_ERROR) << "Error when removing remote candidates: " << error;
1144 } 1125 }
1145 return true; 1126 return true;
1146 } 1127 }
1147 1128
1148 bool WebRtcSession::SetIceTransports(
1149 PeerConnectionInterface::IceTransportsType type) {
1150 return port_allocator()->set_candidate_filter(
1151 ConvertIceTransportTypeToCandidateFilter(type));
1152 }
1153
1154 cricket::IceConfig WebRtcSession::ParseIceConfig( 1129 cricket::IceConfig WebRtcSession::ParseIceConfig(
1155 const PeerConnectionInterface::RTCConfiguration& config) const { 1130 const PeerConnectionInterface::RTCConfiguration& config) const {
1156 cricket::IceConfig ice_config; 1131 cricket::IceConfig ice_config;
1157 ice_config.receiving_timeout = config.ice_connection_receiving_timeout; 1132 ice_config.receiving_timeout = config.ice_connection_receiving_timeout;
1158 ice_config.prioritize_most_likely_candidate_pairs = 1133 ice_config.prioritize_most_likely_candidate_pairs =
1159 config.prioritize_most_likely_ice_candidate_pairs; 1134 config.prioritize_most_likely_ice_candidate_pairs;
1160 ice_config.backup_connection_ping_interval = 1135 ice_config.backup_connection_ping_interval =
1161 config.ice_backup_candidate_pair_ping_interval; 1136 config.ice_backup_candidate_pair_ping_interval;
1162 ice_config.gather_continually = (config.continual_gathering_policy == 1137 ice_config.gather_continually = (config.continual_gathering_policy ==
1163 PeerConnectionInterface::GATHER_CONTINUALLY); 1138 PeerConnectionInterface::GATHER_CONTINUALLY);
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after
2155 } 2130 }
2156 } 2131 }
2157 2132
2158 void WebRtcSession::OnSentPacket_w(cricket::TransportChannel* channel, 2133 void WebRtcSession::OnSentPacket_w(cricket::TransportChannel* channel,
2159 const rtc::SentPacket& sent_packet) { 2134 const rtc::SentPacket& sent_packet) {
2160 RTC_DCHECK(worker_thread()->IsCurrent()); 2135 RTC_DCHECK(worker_thread()->IsCurrent());
2161 media_controller_->call_w()->OnSentPacket(sent_packet); 2136 media_controller_->call_w()->OnSentPacket(sent_packet);
2162 } 2137 }
2163 2138
2164 } // namespace webrtc 2139 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/api/webrtcsession.h ('k') | webrtc/api/webrtcsession_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698