Chromium Code Reviews| 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/base/constants.h" | |
| 10 #include "remoting/client/audio_decode_scheduler.h" | 11 #include "remoting/client/audio_decode_scheduler.h" |
| 11 #include "remoting/client/audio_player.h" | 12 #include "remoting/client/audio_player.h" |
| 12 #include "remoting/client/client_context.h" | 13 #include "remoting/client/client_context.h" |
| 13 #include "remoting/client/client_user_interface.h" | 14 #include "remoting/client/client_user_interface.h" |
| 14 #include "remoting/protocol/authenticator.h" | 15 #include "remoting/protocol/authenticator.h" |
| 15 #include "remoting/protocol/connection_to_host.h" | 16 #include "remoting/protocol/connection_to_host.h" |
| 16 #include "remoting/protocol/host_stub.h" | 17 #include "remoting/protocol/host_stub.h" |
| 17 #include "remoting/protocol/ice_connection_to_host.h" | 18 #include "remoting/protocol/ice_connection_to_host.h" |
| 18 #include "remoting/protocol/jingle_session_manager.h" | 19 #include "remoting/protocol/jingle_session_manager.h" |
| 19 #include "remoting/protocol/negotiating_client_authenticator.h" | 20 #include "remoting/protocol/negotiating_client_authenticator.h" |
| 20 #include "remoting/protocol/session_config.h" | 21 #include "remoting/protocol/session_config.h" |
| 21 #include "remoting/protocol/transport_context.h" | 22 #include "remoting/protocol/transport_context.h" |
| 22 #include "remoting/protocol/video_renderer.h" | 23 #include "remoting/protocol/video_renderer.h" |
| 23 #include "remoting/protocol/webrtc_connection_to_host.h" | 24 #include "remoting/protocol/webrtc_connection_to_host.h" |
| 24 #include "remoting/signaling/jid_util.h" | 25 #include "remoting/signaling/jid_util.h" |
| 26 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" | |
| 25 | 27 |
| 26 namespace remoting { | 28 namespace remoting { |
| 27 | 29 |
| 28 ChromotingClient::ChromotingClient(ClientContext* client_context, | 30 ChromotingClient::ChromotingClient(ClientContext* client_context, |
| 29 ClientUserInterface* user_interface, | 31 ClientUserInterface* user_interface, |
| 30 protocol::VideoRenderer* video_renderer, | 32 protocol::VideoRenderer* video_renderer, |
| 31 scoped_ptr<AudioPlayer> audio_player) | 33 scoped_ptr<AudioPlayer> audio_player) |
| 32 : user_interface_(user_interface), video_renderer_(video_renderer) { | 34 : user_interface_(user_interface), video_renderer_(video_renderer) { |
| 33 DCHECK(client_context->main_task_runner()->BelongsToCurrentThread()); | 35 DCHECK(client_context->main_task_runner()->BelongsToCurrentThread()); |
| 34 if (audio_player) { | 36 if (audio_player) { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 140 user_interface_->SetPairingResponse(pairing_response); | 142 user_interface_->SetPairingResponse(pairing_response); |
| 141 } | 143 } |
| 142 | 144 |
| 143 void ChromotingClient::DeliverHostMessage( | 145 void ChromotingClient::DeliverHostMessage( |
| 144 const protocol::ExtensionMessage& message) { | 146 const protocol::ExtensionMessage& message) { |
| 145 DCHECK(thread_checker_.CalledOnValidThread()); | 147 DCHECK(thread_checker_.CalledOnValidThread()); |
| 146 | 148 |
| 147 user_interface_->DeliverHostMessage(message); | 149 user_interface_->DeliverHostMessage(message); |
| 148 } | 150 } |
| 149 | 151 |
| 152 void ChromotingClient::SetVideoLayout(const protocol::VideoLayout& layout) { | |
| 153 int num_video_tracks = layout.video_track_size(); | |
| 154 if (num_video_tracks < 1) { | |
| 155 LOG(ERROR) << "Received VideoLayout message with 0 tracks."; | |
| 156 return; | |
| 157 } | |
| 158 | |
| 159 if (layout.video_track_size() > 2) { | |
|
Jamie
2016/03/31 22:36:44
Replace this call (and the next one) with num_vide
Sergey Ulanov
2016/03/31 23:05:25
Done.
| |
| 160 LOG(WARNING) << "Received VideoLayout message with " | |
| 161 << layout.video_track_size() | |
| 162 << " tracks. Only one track is supported."; | |
| 163 } | |
| 164 | |
| 165 const protocol::VideoTrackLayout& track_layout = layout.video_track(0); | |
| 166 int x_dpi = track_layout.has_x_dpi() ? track_layout.x_dpi() : kDefaultDpi; | |
| 167 int y_dpi = track_layout.has_y_dpi() ? track_layout.y_dpi() : kDefaultDpi; | |
| 168 user_interface_->SetDesktopSize( | |
| 169 webrtc::DesktopSize(track_layout.width() * x_dpi / kDefaultDpi, | |
| 170 track_layout.height() * y_dpi / kDefaultDpi), | |
| 171 webrtc::DesktopVector(x_dpi, y_dpi)); | |
| 172 } | |
| 173 | |
| 150 void ChromotingClient::InjectClipboardEvent( | 174 void ChromotingClient::InjectClipboardEvent( |
| 151 const protocol::ClipboardEvent& event) { | 175 const protocol::ClipboardEvent& event) { |
| 152 DCHECK(thread_checker_.CalledOnValidThread()); | 176 DCHECK(thread_checker_.CalledOnValidThread()); |
| 153 | 177 |
| 154 user_interface_->GetClipboardStub()->InjectClipboardEvent(event); | 178 user_interface_->GetClipboardStub()->InjectClipboardEvent(event); |
| 155 } | 179 } |
| 156 | 180 |
| 157 void ChromotingClient::SetCursorShape( | 181 void ChromotingClient::SetCursorShape( |
| 158 const protocol::CursorShapeInfo& cursor_shape) { | 182 const protocol::CursorShapeInfo& cursor_shape) { |
| 159 DCHECK(thread_checker_.CalledOnValidThread()); | 183 DCHECK(thread_checker_.CalledOnValidThread()); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 235 | 259 |
| 236 // Negotiate capabilities with the host. | 260 // Negotiate capabilities with the host. |
| 237 VLOG(1) << "Client capabilities: " << local_capabilities_; | 261 VLOG(1) << "Client capabilities: " << local_capabilities_; |
| 238 | 262 |
| 239 protocol::Capabilities capabilities; | 263 protocol::Capabilities capabilities; |
| 240 capabilities.set_capabilities(local_capabilities_); | 264 capabilities.set_capabilities(local_capabilities_); |
| 241 connection_->host_stub()->SetCapabilities(capabilities); | 265 connection_->host_stub()->SetCapabilities(capabilities); |
| 242 } | 266 } |
| 243 | 267 |
| 244 } // namespace remoting | 268 } // namespace remoting |
| OLD | NEW |