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

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

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