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 "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "remoting/base/capabilities.h" | 10 #include "remoting/base/capabilities.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 const protocol::ClientAuthenticationConfig& client_auth_config, | 58 const protocol::ClientAuthenticationConfig& client_auth_config, |
59 scoped_refptr<protocol::TransportContext> transport_context, | 59 scoped_refptr<protocol::TransportContext> transport_context, |
60 const std::string& host_jid, | 60 const std::string& host_jid, |
61 const std::string& capabilities) { | 61 const std::string& capabilities) { |
62 DCHECK(thread_checker_.CalledOnValidThread()); | 62 DCHECK(thread_checker_.CalledOnValidThread()); |
63 DCHECK(!session_manager_); // Start must be called more than once. | 63 DCHECK(!session_manager_); // Start must be called more than once. |
64 | 64 |
65 host_jid_ = NormalizeJid(host_jid); | 65 host_jid_ = NormalizeJid(host_jid); |
66 local_capabilities_ = capabilities; | 66 local_capabilities_ = capabilities; |
67 | 67 |
68 if (!protocol_config_) | 68 if (!protocol_config_) { |
69 protocol_config_ = protocol::CandidateSessionConfig::CreateDefault(); | 69 protocol_config_ = protocol::CandidateSessionConfig::CreateDefault(); |
70 if (!audio_consumer_) | 70 } |
71 protocol_config_->DisableAudioChannel(); | |
72 | 71 |
73 if (!connection_) { | 72 if (!connection_) { |
74 if (protocol_config_->webrtc_supported()) { | 73 if (protocol_config_->webrtc_supported()) { |
75 DCHECK(!protocol_config_->ice_supported()); | 74 DCHECK(!protocol_config_->ice_supported()); |
76 #if !defined(ENABLE_WEBRTC_REMOTING_CLIENT) | 75 #if !defined(ENABLE_WEBRTC_REMOTING_CLIENT) |
77 LOG(FATAL) << "WebRTC is not supported."; | 76 LOG(FATAL) << "WebRTC is not supported."; |
78 #else | 77 #else |
79 connection_.reset(new protocol::WebrtcConnectionToHost()); | 78 connection_.reset(new protocol::WebrtcConnectionToHost()); |
80 #endif | 79 #endif |
81 } else { | 80 } else { |
82 DCHECK(protocol_config_->ice_supported()); | 81 DCHECK(protocol_config_->ice_supported()); |
83 connection_.reset(new protocol::IceConnectionToHost()); | 82 connection_.reset(new protocol::IceConnectionToHost()); |
84 } | 83 } |
85 } | 84 } |
86 connection_->set_client_stub(this); | 85 connection_->set_client_stub(this); |
87 connection_->set_clipboard_stub(this); | 86 connection_->set_clipboard_stub(this); |
88 connection_->set_video_renderer(video_renderer_); | 87 connection_->set_video_renderer(video_renderer_); |
89 | 88 |
90 connection_->InitializeAudio(audio_decode_task_runner_, audio_consumer_); | 89 if (audio_consumer_) { |
| 90 connection_->InitializeAudio(audio_decode_task_runner_, audio_consumer_); |
| 91 } else { |
| 92 protocol_config_->DisableAudioChannel(); |
| 93 } |
91 | 94 |
92 session_manager_.reset(new protocol::JingleSessionManager(signal_strategy)); | 95 session_manager_.reset(new protocol::JingleSessionManager(signal_strategy)); |
93 session_manager_->set_protocol_config(std::move(protocol_config_)); | 96 session_manager_->set_protocol_config(std::move(protocol_config_)); |
94 | 97 |
95 client_auth_config_ = client_auth_config; | 98 client_auth_config_ = client_auth_config; |
96 transport_context_ = transport_context; | 99 transport_context_ = transport_context; |
97 | 100 |
98 signal_strategy_ = signal_strategy; | 101 signal_strategy_ = signal_strategy; |
99 signal_strategy_->AddListener(this); | 102 signal_strategy_->AddListener(this); |
100 | 103 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 VLOG(1) << "Client capabilities: " << local_capabilities_; | 259 VLOG(1) << "Client capabilities: " << local_capabilities_; |
257 | 260 |
258 protocol::Capabilities capabilities; | 261 protocol::Capabilities capabilities; |
259 capabilities.set_capabilities(local_capabilities_); | 262 capabilities.set_capabilities(local_capabilities_); |
260 connection_->host_stub()->SetCapabilities(capabilities); | 263 connection_->host_stub()->SetCapabilities(capabilities); |
261 | 264 |
262 mouse_input_scaler_.set_input_stub(connection_->input_stub()); | 265 mouse_input_scaler_.set_input_stub(connection_->input_stub()); |
263 } | 266 } |
264 | 267 |
265 } // namespace remoting | 268 } // namespace remoting |
OLD | NEW |