| 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/host/client_session.h" | 5 #include "remoting/host/client_session.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
| 10 #include "media/video/capture/screen/screen_capturer.h" | 10 #include "media/video/capture/screen/screen_capturer.h" |
| 11 #include "remoting/codec/audio_encoder.h" | 11 #include "remoting/codec/audio_encoder.h" |
| 12 #include "remoting/codec/audio_encoder_opus.h" | 12 #include "remoting/codec/audio_encoder_opus.h" |
| 13 #include "remoting/codec/audio_encoder_speex.h" | 13 #include "remoting/codec/audio_encoder_speex.h" |
| 14 #include "remoting/codec/audio_encoder_verbatim.h" | 14 #include "remoting/codec/audio_encoder_verbatim.h" |
| 15 #include "remoting/codec/video_encoder.h" | 15 #include "remoting/codec/video_encoder.h" |
| 16 #include "remoting/codec/video_encoder_verbatim.h" | 16 #include "remoting/codec/video_encoder_verbatim.h" |
| 17 #include "remoting/codec/video_encoder_vp8.h" | 17 #include "remoting/codec/video_encoder_vp8.h" |
| 18 #include "remoting/host/audio_capturer.h" | 18 #include "remoting/host/audio_capturer.h" |
| 19 #include "remoting/host/audio_scheduler.h" | 19 #include "remoting/host/audio_scheduler.h" |
| 20 #include "remoting/host/desktop_environment.h" | 20 #include "remoting/host/desktop_environment.h" |
| 21 #include "remoting/host/event_executor.h" | 21 #include "remoting/host/event_executor.h" |
| 22 #include "remoting/host/screen_resolution.h" |
| 22 #include "remoting/host/session_controller.h" | 23 #include "remoting/host/session_controller.h" |
| 23 #include "remoting/host/video_scheduler.h" | 24 #include "remoting/host/video_scheduler.h" |
| 24 #include "remoting/proto/control.pb.h" | 25 #include "remoting/proto/control.pb.h" |
| 25 #include "remoting/proto/event.pb.h" | 26 #include "remoting/proto/event.pb.h" |
| 26 #include "remoting/protocol/client_stub.h" | 27 #include "remoting/protocol/client_stub.h" |
| 27 #include "remoting/protocol/clipboard_thread_proxy.h" | 28 #include "remoting/protocol/clipboard_thread_proxy.h" |
| 28 | 29 |
| 29 namespace remoting { | 30 namespace remoting { |
| 30 | 31 |
| 31 namespace { | 32 namespace { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 DCHECK(!audio_scheduler_); | 90 DCHECK(!audio_scheduler_); |
| 90 DCHECK(!event_executor_); | 91 DCHECK(!event_executor_); |
| 91 DCHECK(!session_controller_); | 92 DCHECK(!session_controller_); |
| 92 DCHECK(!video_scheduler_); | 93 DCHECK(!video_scheduler_); |
| 93 | 94 |
| 94 connection_.reset(); | 95 connection_.reset(); |
| 95 } | 96 } |
| 96 | 97 |
| 97 void ClientSession::NotifyClientResolution( | 98 void ClientSession::NotifyClientResolution( |
| 98 const protocol::ClientResolution& resolution) { | 99 const protocol::ClientResolution& resolution) { |
| 99 if (resolution.has_dips_width() && resolution.has_dips_height()) { | 100 if (!resolution.has_dips_width() || !resolution.has_dips_height()) |
| 100 VLOG(1) << "Received ClientResolution (dips_width=" | 101 return; |
| 101 << resolution.dips_width() << ", dips_height=" | 102 |
| 102 << resolution.dips_height() << ")"; | 103 VLOG(1) << "Received ClientResolution (dips_width=" |
| 103 if (session_controller_) { | 104 << resolution.dips_width() << ", dips_height=" |
| 104 session_controller_->OnClientResolutionChanged( | 105 << resolution.dips_height() << ")"; |
| 105 SkIPoint::Make(kDefaultDPI, kDefaultDPI), | 106 |
| 106 SkISize::Make(resolution.dips_width(), resolution.dips_height())); | 107 if (!session_controller_) |
| 107 } | 108 return; |
| 108 } | 109 |
| 110 ScreenResolution client_resolution(SkISize::Make(resolution.dips_width(), |
| 111 resolution.dips_height())); |
| 112 |
| 113 // Try to match the client's resolution. |
| 114 if (client_resolution.IsValid()) |
| 115 session_controller_->SetScreenResolution(client_resolution); |
| 109 } | 116 } |
| 110 | 117 |
| 111 void ClientSession::ControlVideo(const protocol::VideoControl& video_control) { | 118 void ClientSession::ControlVideo(const protocol::VideoControl& video_control) { |
| 112 if (video_control.has_enable()) { | 119 if (video_control.has_enable()) { |
| 113 VLOG(1) << "Received VideoControl (enable=" | 120 VLOG(1) << "Received VideoControl (enable=" |
| 114 << video_control.enable() << ")"; | 121 << video_control.enable() << ")"; |
| 115 if (video_scheduler_) | 122 if (video_scheduler_) |
| 116 video_scheduler_->Pause(!video_control.enable()); | 123 video_scheduler_->Pause(!video_control.enable()); |
| 117 } | 124 } |
| 118 } | 125 } |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 return scoped_ptr<AudioEncoder>(new AudioEncoderSpeex()); | 338 return scoped_ptr<AudioEncoder>(new AudioEncoderSpeex()); |
| 332 } else if (audio_config.codec == protocol::ChannelConfig::CODEC_OPUS) { | 339 } else if (audio_config.codec == protocol::ChannelConfig::CODEC_OPUS) { |
| 333 return scoped_ptr<AudioEncoder>(new AudioEncoderOpus()); | 340 return scoped_ptr<AudioEncoder>(new AudioEncoderOpus()); |
| 334 } | 341 } |
| 335 | 342 |
| 336 NOTIMPLEMENTED(); | 343 NOTIMPLEMENTED(); |
| 337 return scoped_ptr<AudioEncoder>(NULL); | 344 return scoped_ptr<AudioEncoder>(NULL); |
| 338 } | 345 } |
| 339 | 346 |
| 340 } // namespace remoting | 347 } // namespace remoting |
| OLD | NEW |