summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-17 22:02:44 +0000
committerwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-17 22:02:44 +0000
commit36d3f2a0a0480c2b281a3e70d20ba0ed6c059f8b (patch)
treec4fc16c711852f8344463f0f2f8fcf92cc2e7df0
parent061a496e68ef31d6cf7497cc772b15791c56deb2 (diff)
downloadchromium_src-36d3f2a0a0480c2b281a3e70d20ba0ed6c059f8b.zip
chromium_src-36d3f2a0a0480c2b281a3e70d20ba0ed6c059f8b.tar.gz
chromium_src-36d3f2a0a0480c2b281a3e70d20ba0ed6c059f8b.tar.bz2
Add enable_vp9 option to host config.
Review URL: https://codereview.chromium.org/331853009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277876 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--remoting/host/chromoting_host.cc7
-rw-r--r--remoting/host/chromoting_host.h13
-rw-r--r--remoting/host/host_config.cc1
-rw-r--r--remoting/host/host_config.h2
-rw-r--r--remoting/host/remoting_me2me_host.cc20
5 files changed, 32 insertions, 11 deletions
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc
index 942e643..6558dbb 100644
--- a/remoting/host/chromoting_host.cc
+++ b/remoting/host/chromoting_host.cc
@@ -31,8 +31,6 @@ namespace remoting {
namespace {
-const char kEnableVp9SwitchName[] = "enable-vp9";
-
const net::BackoffEntry::Policy kDefaultBackoffPolicy = {
// Number of initial errors (in sequence) to ignore before applying
// exponential back-off rules.
@@ -92,11 +90,6 @@ ChromotingHost::ChromotingHost(
jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop();
- // Enable VP9 if specified on the command-line.
- if (CommandLine::ForCurrentProcess()->HasSwitch(kEnableVp9SwitchName)) {
- protocol_config_->EnableVideoCodec(protocol::ChannelConfig::CODEC_VP9);
- }
-
if (!desktop_environment_factory_->SupportsAudioCapture()) {
protocol_config_->DisableAudioChannel();
}
diff --git a/remoting/host/chromoting_host.h b/remoting/host/chromoting_host.h
index 73e8442..fe2c26fa 100644
--- a/remoting/host/chromoting_host.h
+++ b/remoting/host/chromoting_host.h
@@ -139,13 +139,14 @@ class ChromotingHost : public base::NonThreadSafe,
protocol::Session* session,
protocol::SessionManager::IncomingSessionResponse* response) OVERRIDE;
+ // Gets the candidate configuration for the protocol.
+ const protocol::CandidateSessionConfig* protocol_config() const {
+ return protocol_config_.get();
+ }
+
// Sets desired configuration for the protocol. Must be called before Start().
void set_protocol_config(scoped_ptr<protocol::CandidateSessionConfig> config);
- base::WeakPtr<ChromotingHost> AsWeakPtr() {
- return weak_factory_.GetWeakPtr();
- }
-
// The host uses a pairing registry to generate and store pairing information
// for clients for PIN-less authentication.
scoped_refptr<protocol::PairingRegistry> pairing_registry() const {
@@ -156,6 +157,10 @@ class ChromotingHost : public base::NonThreadSafe,
pairing_registry_ = pairing_registry;
}
+ base::WeakPtr<ChromotingHost> AsWeakPtr() {
+ return weak_factory_.GetWeakPtr();
+ }
+
private:
friend class ChromotingHostTest;
diff --git a/remoting/host/host_config.cc b/remoting/host/host_config.cc
index e812843..5b277db 100644
--- a/remoting/host/host_config.cc
+++ b/remoting/host/host_config.cc
@@ -17,5 +17,6 @@ const char kHostNameConfigPath[] = "host_name";
const char kHostSecretHashConfigPath[] = "host_secret_hash";
const char kPrivateKeyConfigPath[] = "private_key";
const char kUsageStatsConsentConfigPath[] = "usage_stats_consent";
+const char kEnableVp9ConfigPath[] = "enable_vp9";
} // namespace remoting
diff --git a/remoting/host/host_config.h b/remoting/host/host_config.h
index 5bd5c5c..71c91ed 100644
--- a/remoting/host/host_config.h
+++ b/remoting/host/host_config.h
@@ -40,6 +40,8 @@ extern const char kHostSecretHashConfigPath[];
extern const char kPrivateKeyConfigPath[];
// Whether consent is given for usage stats reporting.
extern const char kUsageStatsConsentConfigPath[];
+// Whether to offer VP9 encoding to clients.
+extern const char kEnableVp9ConfigPath[];
// HostConfig interace provides read-only access to host configuration.
class HostConfig {
diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc
index eb54ab8..857caf4 100644
--- a/remoting/host/remoting_me2me_host.cc
+++ b/remoting/host/remoting_me2me_host.cc
@@ -124,6 +124,9 @@ const char kAuthSocknameSwitchName[] = "ssh-auth-sockname";
// when it is successfully started.
const char kSignalParentSwitchName[] = "signal-parent";
+// Command line switch used to enable VP9 encoding.
+const char kEnableVp9SwitchName[] = "enable-vp9";
+
// Value used for --host-config option to indicate that the path must be read
// from stdin.
const char kStdinConfigPath[] = "-";
@@ -287,6 +290,7 @@ class HostProcess
std::string serialized_config_;
std::string host_owner_;
bool use_service_account_;
+ bool enable_vp9_;
scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_;
std::string host_domain_;
@@ -331,6 +335,7 @@ HostProcess::HostProcess(scoped_ptr<ChromotingHostContext> context,
: context_(context.Pass()),
state_(HOST_INITIALIZING),
use_service_account_(false),
+ enable_vp9_(false),
host_username_match_required_(false),
allow_nat_traversal_(true),
allow_relay_(true),
@@ -816,6 +821,14 @@ bool HostProcess::ApplyConfig(scoped_ptr<JsonHostConfig> config) {
host_owner_ = xmpp_server_config_.username;
use_service_account_ = false;
}
+
+ // Allow offering of VP9 encoding to be overridden by the command-line.
+ if (CommandLine::ForCurrentProcess()->HasSwitch(kEnableVp9SwitchName)) {
+ enable_vp9_ = true;
+ } else {
+ config->GetBoolean(kEnableVp9ConfigPath, &enable_vp9_);
+ }
+
return true;
}
@@ -1190,6 +1203,13 @@ void HostProcess::StartHost() {
context_->network_task_runner(),
context_->ui_task_runner()));
+ if (enable_vp9_) {
+ scoped_ptr<protocol::CandidateSessionConfig> config =
+ host_->protocol_config()->Clone();
+ config->EnableVideoCodec(protocol::ChannelConfig::CODEC_VP9);
+ host_->set_protocol_config(config.Pass());
+ }
+
// TODO(simonmorris): Get the maximum session duration from a policy.
#if defined(OS_LINUX)
host_->SetMaximumSessionDuration(base::TimeDelta::FromHours(20));