summaryrefslogtreecommitdiff
path: root/remoting/protocol/connection_to_host.cc
diff options
context:
space:
mode:
Diffstat (limited to 'remoting/protocol/connection_to_host.cc')
-rw-r--r--remoting/protocol/connection_to_host.cc77
1 files changed, 46 insertions, 31 deletions
diff --git a/remoting/protocol/connection_to_host.cc b/remoting/protocol/connection_to_host.cc
index d2ce7ff311..fdbd0f2c65 100644
--- a/remoting/protocol/connection_to_host.cc
+++ b/remoting/protocol/connection_to_host.cc
@@ -51,40 +51,18 @@ ConnectionToHost::~ConnectionToHost() {
signal_strategy_->RemoveListener(this);
}
-ClipboardStub* ConnectionToHost::clipboard_stub() {
- return &clipboard_forwarder_;
-}
-
-HostStub* ConnectionToHost::host_stub() {
- // TODO(wez): Add a HostFilter class, equivalent to input filter.
- return control_dispatcher_.get();
-}
-
-InputStub* ConnectionToHost::input_stub() {
- return &event_forwarder_;
-}
-
void ConnectionToHost::Connect(SignalStrategy* signal_strategy,
- const std::string& host_jid,
- const std::string& host_public_key,
scoped_ptr<TransportFactory> transport_factory,
scoped_ptr<Authenticator> authenticator,
- HostEventCallback* event_callback,
- ClientStub* client_stub,
- ClipboardStub* clipboard_stub,
- VideoStub* video_stub,
- AudioStub* audio_stub) {
+ const std::string& host_jid,
+ const std::string& host_public_key,
+ HostEventCallback* event_callback) {
+ DCHECK(client_stub_);
+ DCHECK(clipboard_stub_);
+ DCHECK(monitored_video_stub_);
+
signal_strategy_ = signal_strategy;
event_callback_ = event_callback;
- client_stub_ = client_stub;
- clipboard_stub_ = clipboard_stub;
- monitored_video_stub_.reset(new MonitoredVideoStub(
- video_stub,
- base::TimeDelta::FromSeconds(
- MonitoredVideoStub::kConnectivityCheckDelaySeconds),
- base::Bind(&ConnectionToHost::OnVideoChannelStatus,
- base::Unretained(this))));
- audio_stub_ = audio_stub;
authenticator_ = authenticator.Pass();
// Save jid of the host. The actual connection is created later after
@@ -105,6 +83,41 @@ const SessionConfig& ConnectionToHost::config() {
return session_->config();
}
+ClipboardStub* ConnectionToHost::clipboard_forwarder() {
+ return &clipboard_forwarder_;
+}
+
+HostStub* ConnectionToHost::host_stub() {
+ // TODO(wez): Add a HostFilter class, equivalent to input filter.
+ return control_dispatcher_.get();
+}
+
+InputStub* ConnectionToHost::input_stub() {
+ return &event_forwarder_;
+}
+
+void ConnectionToHost::set_client_stub(ClientStub* client_stub) {
+ client_stub_ = client_stub;
+}
+
+void ConnectionToHost::set_clipboard_stub(ClipboardStub* clipboard_stub) {
+ clipboard_stub_ = clipboard_stub;
+}
+
+void ConnectionToHost::set_video_stub(VideoStub* video_stub) {
+ DCHECK(video_stub);
+ monitored_video_stub_.reset(new MonitoredVideoStub(
+ video_stub,
+ base::TimeDelta::FromSeconds(
+ MonitoredVideoStub::kConnectivityCheckDelaySeconds),
+ base::Bind(&ConnectionToHost::OnVideoChannelStatus,
+ base::Unretained(this))));
+}
+
+void ConnectionToHost::set_audio_stub(AudioStub* audio_stub) {
+ audio_stub_ = audio_stub;
+}
+
void ConnectionToHost::OnSignalStrategyStateChange(
SignalStrategy::State state) {
DCHECK(CalledOnValidThread());
@@ -129,8 +142,10 @@ void ConnectionToHost::OnSessionManagerReady() {
// After SessionManager is initialized we can try to connect to the host.
scoped_ptr<CandidateSessionConfig> candidate_config =
CandidateSessionConfig::CreateDefault();
- if (!audio_stub_)
- CandidateSessionConfig::DisableAudioChannel(candidate_config.get());
+ if (!audio_stub_) {
+ candidate_config->DisableAudioChannel();
+ }
+ candidate_config->EnableVideoCodec(ChannelConfig::CODEC_VP9);
session_ = session_manager_->Connect(
host_jid_, authenticator_.Pass(), candidate_config.Pass());