Index: remoting/protocol/connection_to_host.cc |
diff --git a/remoting/protocol/connection_to_host.cc b/remoting/protocol/connection_to_host.cc |
index 86ab5443ffa1992fd0fee89a0eaba64597275b88..71c7764fd383d7a859385ced6c1e5ce5662e4000 100644 |
--- a/remoting/protocol/connection_to_host.cc |
+++ b/remoting/protocol/connection_to_host.cc |
@@ -57,6 +57,16 @@ void ConnectionToHost::Connect(SignalStrategy* signal_strategy, |
DCHECK(clipboard_stub_); |
DCHECK(monitored_video_stub_); |
+ // Initialize default |candidate_config_| if set_candidate_config() wasn't |
+ // called. |
+ if (!candidate_config_) { |
+ candidate_config_ = CandidateSessionConfig::CreateDefault(); |
+ if (!audio_stub_) { |
+ candidate_config_->DisableAudioChannel(); |
+ } |
+ candidate_config_->EnableVideoCodec(ChannelConfig::CODEC_VP9); |
+ } |
+ |
signal_strategy_ = signal_strategy; |
event_callback_ = event_callback; |
authenticator_ = authenticator.Pass(); |
@@ -74,6 +84,14 @@ void ConnectionToHost::Connect(SignalStrategy* signal_strategy, |
SetState(CONNECTING, OK); |
} |
+void ConnectionToHost::set_candidate_config( |
+ scoped_ptr<CandidateSessionConfig> config) { |
+ DCHECK_EQ(state_, INITIALIZING); |
+ |
+ candidate_config_ = config.Pass(); |
+} |
+ |
+ |
const SessionConfig& ConnectionToHost::config() { |
return session_->config(); |
} |
@@ -135,15 +153,8 @@ void ConnectionToHost::OnSessionManagerReady() { |
DCHECK(CalledOnValidThread()); |
// After SessionManager is initialized we can try to connect to the host. |
- scoped_ptr<CandidateSessionConfig> candidate_config = |
- CandidateSessionConfig::CreateDefault(); |
- if (!audio_stub_) { |
- candidate_config->DisableAudioChannel(); |
- } |
- candidate_config->EnableVideoCodec(ChannelConfig::CODEC_VP9); |
- |
session_ = session_manager_->Connect( |
- host_jid_, authenticator_.Pass(), candidate_config.Pass()); |
+ host_jid_, authenticator_.Pass(), candidate_config_.Pass()); |
session_->SetEventHandler(this); |
} |