| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "remoting/base/capabilities.h" | 9 #include "remoting/base/capabilities.h" |
| 10 #include "remoting/client/audio_decode_scheduler.h" | 10 #include "remoting/client/audio_decode_scheduler.h" |
| 11 #include "remoting/client/audio_player.h" | 11 #include "remoting/client/audio_player.h" |
| 12 #include "remoting/client/client_context.h" | 12 #include "remoting/client/client_context.h" |
| 13 #include "remoting/client/client_user_interface.h" | 13 #include "remoting/client/client_user_interface.h" |
| 14 #include "remoting/protocol/authenticator.h" | 14 #include "remoting/protocol/authenticator.h" |
| 15 #include "remoting/protocol/connection_to_host.h" | 15 #include "remoting/protocol/connection_to_host.h" |
| 16 #include "remoting/protocol/host_stub.h" | 16 #include "remoting/protocol/host_stub.h" |
| 17 #include "remoting/protocol/ice_connection_to_host.h" | 17 #include "remoting/protocol/ice_connection_to_host.h" |
| 18 #include "remoting/protocol/jingle_session_manager.h" | 18 #include "remoting/protocol/jingle_session_manager.h" |
| 19 #include "remoting/protocol/negotiating_client_authenticator.h" | 19 #include "remoting/protocol/negotiating_client_authenticator.h" |
| 20 #include "remoting/protocol/session_config.h" | 20 #include "remoting/protocol/session_config.h" |
| 21 #include "remoting/protocol/transport_context.h" | 21 #include "remoting/protocol/transport_context.h" |
| 22 #include "remoting/protocol/video_renderer.h" | 22 #include "remoting/protocol/video_renderer.h" |
| 23 #include "remoting/protocol/webrtc_connection_to_host.h" | 23 #include "remoting/protocol/webrtc_connection_to_host.h" |
| 24 #include "remoting/signaling/jid_util.h" |
| 24 | 25 |
| 25 namespace remoting { | 26 namespace remoting { |
| 26 | 27 |
| 27 ChromotingClient::ChromotingClient(ClientContext* client_context, | 28 ChromotingClient::ChromotingClient(ClientContext* client_context, |
| 28 ClientUserInterface* user_interface, | 29 ClientUserInterface* user_interface, |
| 29 protocol::VideoRenderer* video_renderer, | 30 protocol::VideoRenderer* video_renderer, |
| 30 scoped_ptr<AudioPlayer> audio_player) | 31 scoped_ptr<AudioPlayer> audio_player) |
| 31 : user_interface_(user_interface), video_renderer_(video_renderer) { | 32 : user_interface_(user_interface), video_renderer_(video_renderer) { |
| 32 DCHECK(client_context->main_task_runner()->BelongsToCurrentThread()); | 33 DCHECK(client_context->main_task_runner()->BelongsToCurrentThread()); |
| 33 if (audio_player) { | 34 if (audio_player) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 54 | 55 |
| 55 void ChromotingClient::Start( | 56 void ChromotingClient::Start( |
| 56 SignalStrategy* signal_strategy, | 57 SignalStrategy* signal_strategy, |
| 57 const protocol::ClientAuthenticationConfig& client_auth_config, | 58 const protocol::ClientAuthenticationConfig& client_auth_config, |
| 58 scoped_refptr<protocol::TransportContext> transport_context, | 59 scoped_refptr<protocol::TransportContext> transport_context, |
| 59 const std::string& host_jid, | 60 const std::string& host_jid, |
| 60 const std::string& capabilities) { | 61 const std::string& capabilities) { |
| 61 DCHECK(thread_checker_.CalledOnValidThread()); | 62 DCHECK(thread_checker_.CalledOnValidThread()); |
| 62 DCHECK(!session_manager_); // Start must be called more than once. | 63 DCHECK(!session_manager_); // Start must be called more than once. |
| 63 | 64 |
| 64 host_jid_ = host_jid; | 65 host_jid_ = NormalizeJid(host_jid); |
| 65 local_capabilities_ = capabilities; | 66 local_capabilities_ = capabilities; |
| 66 | 67 |
| 67 if (!protocol_config_) | 68 if (!protocol_config_) |
| 68 protocol_config_ = protocol::CandidateSessionConfig::CreateDefault(); | 69 protocol_config_ = protocol::CandidateSessionConfig::CreateDefault(); |
| 69 if (!audio_decode_scheduler_) | 70 if (!audio_decode_scheduler_) |
| 70 protocol_config_->DisableAudioChannel(); | 71 protocol_config_->DisableAudioChannel(); |
| 71 | 72 |
| 72 if (!connection_) { | 73 if (!connection_) { |
| 73 if (protocol_config_->webrtc_supported()) { | 74 if (protocol_config_->webrtc_supported()) { |
| 74 DCHECK(!protocol_config_->ice_supported()); | 75 DCHECK(!protocol_config_->ice_supported()); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 const buzz::XmlElement* stanza) { | 210 const buzz::XmlElement* stanza) { |
| 210 return false; | 211 return false; |
| 211 } | 212 } |
| 212 | 213 |
| 213 void ChromotingClient::StartConnection() { | 214 void ChromotingClient::StartConnection() { |
| 214 DCHECK(thread_checker_.CalledOnValidThread()); | 215 DCHECK(thread_checker_.CalledOnValidThread()); |
| 215 connection_->Connect( | 216 connection_->Connect( |
| 216 session_manager_->Connect( | 217 session_manager_->Connect( |
| 217 host_jid_, | 218 host_jid_, |
| 218 make_scoped_ptr(new protocol::NegotiatingClientAuthenticator( | 219 make_scoped_ptr(new protocol::NegotiatingClientAuthenticator( |
| 219 signal_strategy_->GetLocalJid(), host_jid_, | 220 NormalizeJid(signal_strategy_->GetLocalJid()), host_jid_, |
| 220 client_auth_config_))), | 221 client_auth_config_))), |
| 221 transport_context_, this); | 222 transport_context_, this); |
| 222 } | 223 } |
| 223 | 224 |
| 224 void ChromotingClient::OnAuthenticated() { | 225 void ChromotingClient::OnAuthenticated() { |
| 225 DCHECK(thread_checker_.CalledOnValidThread()); | 226 DCHECK(thread_checker_.CalledOnValidThread()); |
| 226 | 227 |
| 227 // Initialize the decoder. | 228 // Initialize the decoder. |
| 228 if (connection_->config().is_audio_enabled()) | 229 if (connection_->config().is_audio_enabled()) |
| 229 audio_decode_scheduler_->Initialize(connection_->config()); | 230 audio_decode_scheduler_->Initialize(connection_->config()); |
| 230 } | 231 } |
| 231 | 232 |
| 232 void ChromotingClient::OnChannelsConnected() { | 233 void ChromotingClient::OnChannelsConnected() { |
| 233 DCHECK(thread_checker_.CalledOnValidThread()); | 234 DCHECK(thread_checker_.CalledOnValidThread()); |
| 234 | 235 |
| 235 // Negotiate capabilities with the host. | 236 // Negotiate capabilities with the host. |
| 236 VLOG(1) << "Client capabilities: " << local_capabilities_; | 237 VLOG(1) << "Client capabilities: " << local_capabilities_; |
| 237 | 238 |
| 238 protocol::Capabilities capabilities; | 239 protocol::Capabilities capabilities; |
| 239 capabilities.set_capabilities(local_capabilities_); | 240 capabilities.set_capabilities(local_capabilities_); |
| 240 connection_->host_stub()->SetCapabilities(capabilities); | 241 connection_->host_stub()->SetCapabilities(capabilities); |
| 241 } | 242 } |
| 242 | 243 |
| 243 } // namespace remoting | 244 } // namespace remoting |
| OLD | NEW |