| 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/client/chromoting_client.h" | 5 #include "remoting/client/chromoting_client.h" |
| 6 | 6 |
| 7 #include "remoting/base/capabilities.h" | 7 #include "remoting/base/capabilities.h" |
| 8 #include "remoting/client/audio_decode_scheduler.h" | 8 #include "remoting/client/audio_decode_scheduler.h" |
| 9 #include "remoting/client/audio_player.h" | 9 #include "remoting/client/audio_player.h" |
| 10 #include "remoting/client/client_context.h" | 10 #include "remoting/client/client_context.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 DCHECK(!session_manager_); // Start must be called more than once. | 56 DCHECK(!session_manager_); // Start must be called more than once. |
| 57 | 57 |
| 58 host_jid_ = host_jid; | 58 host_jid_ = host_jid; |
| 59 local_capabilities_ = capabilities; | 59 local_capabilities_ = capabilities; |
| 60 | 60 |
| 61 connection_->set_client_stub(this); | 61 connection_->set_client_stub(this); |
| 62 connection_->set_clipboard_stub(this); | 62 connection_->set_clipboard_stub(this); |
| 63 connection_->set_video_stub(video_renderer_->GetVideoStub()); | 63 connection_->set_video_stub(video_renderer_->GetVideoStub()); |
| 64 connection_->set_audio_stub(audio_decode_scheduler_.get()); | 64 connection_->set_audio_stub(audio_decode_scheduler_.get()); |
| 65 | 65 |
| 66 session_manager_.reset(new protocol::JingleSessionManager( | 66 session_manager_.reset(new protocol::JingleSessionManager(signal_strategy)); |
| 67 make_scoped_ptr(new protocol::IceTransportFactory(transport_context)), | |
| 68 signal_strategy)); | |
| 69 | 67 |
| 70 if (!protocol_config_) | 68 if (!protocol_config_) |
| 71 protocol_config_ = protocol::CandidateSessionConfig::CreateDefault(); | 69 protocol_config_ = protocol::CandidateSessionConfig::CreateDefault(); |
| 72 if (!audio_decode_scheduler_) | 70 if (!audio_decode_scheduler_) |
| 73 protocol_config_->DisableAudioChannel(); | 71 protocol_config_->DisableAudioChannel(); |
| 74 session_manager_->set_protocol_config(std::move(protocol_config_)); | 72 session_manager_->set_protocol_config(std::move(protocol_config_)); |
| 75 | 73 |
| 76 authenticator_ = std::move(authenticator); | 74 authenticator_ = std::move(authenticator); |
| 75 transport_context_ = transport_context; |
| 77 | 76 |
| 78 signal_strategy_ = signal_strategy; | 77 signal_strategy_ = signal_strategy; |
| 79 signal_strategy_->AddListener(this); | 78 signal_strategy_->AddListener(this); |
| 80 | 79 |
| 81 switch (signal_strategy_->GetState()) { | 80 switch (signal_strategy_->GetState()) { |
| 82 case SignalStrategy::CONNECTING: | 81 case SignalStrategy::CONNECTING: |
| 83 // Nothing to do here. Just need to wait until |signal_strategy_| becomes | 82 // Nothing to do here. Just need to wait until |signal_strategy_| becomes |
| 84 // connected. | 83 // connected. |
| 85 break; | 84 break; |
| 86 case SignalStrategy::CONNECTED: | 85 case SignalStrategy::CONNECTED: |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 } | 187 } |
| 189 | 188 |
| 190 bool ChromotingClient::OnSignalStrategyIncomingStanza( | 189 bool ChromotingClient::OnSignalStrategyIncomingStanza( |
| 191 const buzz::XmlElement* stanza) { | 190 const buzz::XmlElement* stanza) { |
| 192 return false; | 191 return false; |
| 193 } | 192 } |
| 194 | 193 |
| 195 void ChromotingClient::StartConnection() { | 194 void ChromotingClient::StartConnection() { |
| 196 DCHECK(thread_checker_.CalledOnValidThread()); | 195 DCHECK(thread_checker_.CalledOnValidThread()); |
| 197 connection_->Connect( | 196 connection_->Connect( |
| 198 session_manager_->Connect(host_jid_, std::move(authenticator_)), this); | 197 session_manager_->Connect(host_jid_, std::move(authenticator_)), |
| 198 transport_context_, this); |
| 199 } | 199 } |
| 200 | 200 |
| 201 void ChromotingClient::OnAuthenticated() { | 201 void ChromotingClient::OnAuthenticated() { |
| 202 DCHECK(thread_checker_.CalledOnValidThread()); | 202 DCHECK(thread_checker_.CalledOnValidThread()); |
| 203 | 203 |
| 204 // Initialize the decoder. | 204 // Initialize the decoder. |
| 205 video_renderer_->OnSessionConfig(connection_->config()); | 205 video_renderer_->OnSessionConfig(connection_->config()); |
| 206 if (connection_->config().is_audio_enabled()) | 206 if (connection_->config().is_audio_enabled()) |
| 207 audio_decode_scheduler_->Initialize(connection_->config()); | 207 audio_decode_scheduler_->Initialize(connection_->config()); |
| 208 } | 208 } |
| 209 | 209 |
| 210 void ChromotingClient::OnChannelsConnected() { | 210 void ChromotingClient::OnChannelsConnected() { |
| 211 DCHECK(thread_checker_.CalledOnValidThread()); | 211 DCHECK(thread_checker_.CalledOnValidThread()); |
| 212 | 212 |
| 213 // Negotiate capabilities with the host. | 213 // Negotiate capabilities with the host. |
| 214 VLOG(1) << "Client capabilities: " << local_capabilities_; | 214 VLOG(1) << "Client capabilities: " << local_capabilities_; |
| 215 | 215 |
| 216 protocol::Capabilities capabilities; | 216 protocol::Capabilities capabilities; |
| 217 capabilities.set_capabilities(local_capabilities_); | 217 capabilities.set_capabilities(local_capabilities_); |
| 218 connection_->host_stub()->SetCapabilities(capabilities); | 218 connection_->host_stub()->SetCapabilities(capabilities); |
| 219 } | 219 } |
| 220 | 220 |
| 221 } // namespace remoting | 221 } // namespace remoting |
| OLD | NEW |