| OLD | NEW |
| 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 #include "remoting/host/chromoting_host.h" | 5 #include "remoting/host/chromoting_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/command_line.h" |
| 11 #include "base/message_loop/message_loop_proxy.h" | 12 #include "base/message_loop/message_loop_proxy.h" |
| 12 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 13 #include "remoting/base/constants.h" | 14 #include "remoting/base/constants.h" |
| 14 #include "remoting/base/logging.h" | 15 #include "remoting/base/logging.h" |
| 15 #include "remoting/host/chromoting_host_context.h" | 16 #include "remoting/host/chromoting_host_context.h" |
| 16 #include "remoting/host/desktop_environment.h" | 17 #include "remoting/host/desktop_environment.h" |
| 17 #include "remoting/host/host_config.h" | 18 #include "remoting/host/host_config.h" |
| 18 #include "remoting/host/input_injector.h" | 19 #include "remoting/host/input_injector.h" |
| 19 #include "remoting/protocol/connection_to_client.h" | 20 #include "remoting/protocol/connection_to_client.h" |
| 20 #include "remoting/protocol/client_stub.h" | 21 #include "remoting/protocol/client_stub.h" |
| 21 #include "remoting/protocol/host_stub.h" | 22 #include "remoting/protocol/host_stub.h" |
| 22 #include "remoting/protocol/input_stub.h" | 23 #include "remoting/protocol/input_stub.h" |
| 23 #include "remoting/protocol/session_config.h" | 24 #include "remoting/protocol/session_config.h" |
| 24 | 25 |
| 25 using remoting::protocol::ConnectionToClient; | 26 using remoting::protocol::ConnectionToClient; |
| 26 using remoting::protocol::InputStub; | 27 using remoting::protocol::InputStub; |
| 27 | 28 |
| 28 namespace remoting { | 29 namespace remoting { |
| 29 | 30 |
| 30 namespace { | 31 namespace { |
| 31 | 32 |
| 33 const char kEnableVp9SwitchName[] = "enable-vp9"; |
| 34 |
| 32 const net::BackoffEntry::Policy kDefaultBackoffPolicy = { | 35 const net::BackoffEntry::Policy kDefaultBackoffPolicy = { |
| 33 // Number of initial errors (in sequence) to ignore before applying | 36 // Number of initial errors (in sequence) to ignore before applying |
| 34 // exponential back-off rules. | 37 // exponential back-off rules. |
| 35 0, | 38 0, |
| 36 | 39 |
| 37 // Initial delay for exponential back-off in ms. | 40 // Initial delay for exponential back-off in ms. |
| 38 2000, | 41 2000, |
| 39 | 42 |
| 40 // Factor by which the waiting time will be multiplied. | 43 // Factor by which the waiting time will be multiplied. |
| 41 2, | 44 2, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 started_(false), | 82 started_(false), |
| 80 protocol_config_(protocol::CandidateSessionConfig::CreateDefault()), | 83 protocol_config_(protocol::CandidateSessionConfig::CreateDefault()), |
| 81 login_backoff_(&kDefaultBackoffPolicy), | 84 login_backoff_(&kDefaultBackoffPolicy), |
| 82 authenticating_client_(false), | 85 authenticating_client_(false), |
| 83 reject_authenticating_client_(false), | 86 reject_authenticating_client_(false), |
| 84 enable_curtaining_(false), | 87 enable_curtaining_(false), |
| 85 weak_factory_(this) { | 88 weak_factory_(this) { |
| 86 DCHECK(network_task_runner_->BelongsToCurrentThread()); | 89 DCHECK(network_task_runner_->BelongsToCurrentThread()); |
| 87 DCHECK(signal_strategy); | 90 DCHECK(signal_strategy); |
| 88 | 91 |
| 89 // VP9 encode is not yet supported. | 92 // Disable VP9 unless it is explicitly enabled via the command-line. |
| 90 protocol::CandidateSessionConfig::DisableVideoCodec( | 93 if (!CommandLine::ForCurrentProcess()->HasSwitch(kEnableVp9SwitchName)) { |
| 91 protocol_config_.get(), protocol::ChannelConfig::CODEC_VP9); | 94 protocol::CandidateSessionConfig::DisableVideoCodec( |
| 95 protocol_config_.get(), protocol::ChannelConfig::CODEC_VP9); |
| 96 } |
| 92 | 97 |
| 93 if (!desktop_environment_factory_->SupportsAudioCapture()) { | 98 if (!desktop_environment_factory_->SupportsAudioCapture()) { |
| 94 protocol::CandidateSessionConfig::DisableAudioChannel( | 99 protocol::CandidateSessionConfig::DisableAudioChannel( |
| 95 protocol_config_.get()); | 100 protocol_config_.get()); |
| 96 } | 101 } |
| 97 } | 102 } |
| 98 | 103 |
| 99 ChromotingHost::~ChromotingHost() { | 104 ChromotingHost::~ChromotingHost() { |
| 100 DCHECK(CalledOnValidThread()); | 105 DCHECK(CalledOnValidThread()); |
| 101 | 106 |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 DCHECK(CalledOnValidThread()); | 334 DCHECK(CalledOnValidThread()); |
| 330 | 335 |
| 331 while (!clients_.empty()) { | 336 while (!clients_.empty()) { |
| 332 size_t size = clients_.size(); | 337 size_t size = clients_.size(); |
| 333 clients_.front()->DisconnectSession(); | 338 clients_.front()->DisconnectSession(); |
| 334 CHECK_EQ(clients_.size(), size - 1); | 339 CHECK_EQ(clients_.size(), size - 1); |
| 335 } | 340 } |
| 336 } | 341 } |
| 337 | 342 |
| 338 } // namespace remoting | 343 } // namespace remoting |
| OLD | NEW |