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

Side by Side Diff: remoting/host/remoting_me2me_host.cc

Issue 1800893002: Enable TURN on the host when using WebRTC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // This file implements a standalone host process for Me2Me. 5 // This file implements a standalone host process for Me2Me.
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after
1503 if (!udp_port_range_.is_null()) { 1503 if (!udp_port_range_.is_null()) {
1504 network_settings.port_range = udp_port_range_; 1504 network_settings.port_range = udp_port_range_;
1505 } else if (!allow_nat_traversal_) { 1505 } else if (!allow_nat_traversal_) {
1506 // For legacy reasons we have to restrict the port range to a set of default 1506 // For legacy reasons we have to restrict the port range to a set of default
1507 // values when nat traversal is disabled, even if the port range was not 1507 // values when nat traversal is disabled, even if the port range was not
1508 // set in policy. 1508 // set in policy.
1509 network_settings.port_range.min_port = NetworkSettings::kDefaultMinPort; 1509 network_settings.port_range.min_port = NetworkSettings::kDefaultMinPort;
1510 network_settings.port_range.max_port = NetworkSettings::kDefaultMaxPort; 1510 network_settings.port_range.max_port = NetworkSettings::kDefaultMaxPort;
1511 } 1511 }
1512 1512
1513 scoped_refptr<protocol::TransportContext> transport_context = 1513 scoped_refptr<protocol::TransportContext> ice_transport_context =
1514 new protocol::TransportContext( 1514 new protocol::TransportContext(
1515 signal_strategy_.get(), 1515 signal_strategy_.get(),
1516 make_scoped_ptr(new protocol::ChromiumPortAllocatorFactory()), 1516 make_scoped_ptr(new protocol::ChromiumPortAllocatorFactory()),
1517 make_scoped_ptr(new ChromiumUrlRequestFactory( 1517 make_scoped_ptr(new ChromiumUrlRequestFactory(
1518 context_->url_request_context_getter())), 1518 context_->url_request_context_getter())),
1519 network_settings, protocol::TransportRole::SERVER); 1519 network_settings, protocol::TransportRole::SERVER);
1520 1520
1521 scoped_refptr<protocol::TransportContext> webrtc_transport_context;
1522
1521 scoped_ptr<protocol::SessionManager> session_manager( 1523 scoped_ptr<protocol::SessionManager> session_manager(
1522 new protocol::JingleSessionManager(signal_strategy_.get())); 1524 new protocol::JingleSessionManager(signal_strategy_.get()));
1523 1525
1524 scoped_ptr<protocol::CandidateSessionConfig> protocol_config = 1526 scoped_ptr<protocol::CandidateSessionConfig> protocol_config =
1525 protocol::CandidateSessionConfig::CreateDefault(); 1527 protocol::CandidateSessionConfig::CreateDefault();
1526 if (!desktop_environment_factory_->SupportsAudioCapture()) 1528 if (!desktop_environment_factory_->SupportsAudioCapture())
1527 protocol_config->DisableAudioChannel(); 1529 protocol_config->DisableAudioChannel();
1528 if (enable_vp9_) 1530 if (enable_vp9_)
1529 protocol_config->set_vp9_experiment_enabled(true); 1531 protocol_config->set_vp9_experiment_enabled(true);
1530 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1532 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1531 kEnableWebrtcSwitchName)) { 1533 kEnableWebrtcSwitchName)) {
1532 protocol_config->set_webrtc_supported(true); 1534 protocol_config->set_webrtc_supported(true);
1535
1536 webrtc_transport_context = new protocol::TransportContext(
1537 signal_strategy_.get(),
1538 make_scoped_ptr(new protocol::ChromiumPortAllocatorFactory()),
1539 make_scoped_ptr(new ChromiumUrlRequestFactory(
1540 context_->url_request_context_getter())),
1541 network_settings, protocol::TransportRole::SERVER);
1542 webrtc_transport_context->UseTurn(
1543 ServiceUrls::GetInstance()->ice_config_url());
1533 } 1544 }
1534 session_manager->set_protocol_config(std::move(protocol_config)); 1545 session_manager->set_protocol_config(std::move(protocol_config));
1535 1546
1536 host_.reset(new ChromotingHost(desktop_environment_factory_.get(), 1547 host_.reset(new ChromotingHost(
1537 std::move(session_manager), transport_context, 1548 desktop_environment_factory_.get(), std::move(session_manager),
1538 context_->audio_task_runner(), 1549 ice_transport_context, webrtc_transport_context,
1539 context_->video_encode_task_runner())); 1550 context_->audio_task_runner(), context_->video_encode_task_runner()));
1540 1551
1541 if (gnubby_auth_policy_enabled_ && gnubby_extension_supported_) { 1552 if (gnubby_auth_policy_enabled_ && gnubby_extension_supported_) {
1542 host_->AddExtension(make_scoped_ptr(new GnubbyExtension())); 1553 host_->AddExtension(make_scoped_ptr(new GnubbyExtension()));
1543 } 1554 }
1544 1555
1545 if (frame_recorder_buffer_size_ > 0) { 1556 if (frame_recorder_buffer_size_ > 0) {
1546 scoped_ptr<VideoFrameRecorderHostExtension> frame_recorder_extension( 1557 scoped_ptr<VideoFrameRecorderHostExtension> frame_recorder_extension(
1547 new VideoFrameRecorderHostExtension()); 1558 new VideoFrameRecorderHostExtension());
1548 frame_recorder_extension->SetMaxContentBytes(frame_recorder_buffer_size_); 1559 frame_recorder_extension->SetMaxContentBytes(frame_recorder_buffer_size_);
1549 host_->AddExtension(std::move(frame_recorder_extension)); 1560 host_->AddExtension(std::move(frame_recorder_extension));
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1743 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); 1754 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds));
1744 new HostProcess(std::move(context), &exit_code, &shutdown_watchdog); 1755 new HostProcess(std::move(context), &exit_code, &shutdown_watchdog);
1745 1756
1746 // Run the main (also UI) message loop until the host no longer needs it. 1757 // Run the main (also UI) message loop until the host no longer needs it.
1747 message_loop.Run(); 1758 message_loop.Run();
1748 1759
1749 return exit_code; 1760 return exit_code;
1750 } 1761 }
1751 1762
1752 } // namespace remoting 1763 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698