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" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 DCHECK(!screen_controls_); | 92 DCHECK(!screen_controls_); |
93 DCHECK(!video_scheduler_); | 93 DCHECK(!video_scheduler_); |
94 | 94 |
95 connection_.reset(); | 95 connection_.reset(); |
96 } | 96 } |
97 | 97 |
98 void ClientSession::NotifyClientResolution( | 98 void ClientSession::NotifyClientResolution( |
99 const protocol::ClientResolution& resolution) { | 99 const protocol::ClientResolution& resolution) { |
100 DCHECK(CalledOnValidThread()); | 100 DCHECK(CalledOnValidThread()); |
101 | 101 |
102 if (!resolution.has_dips_width() || !resolution.has_dips_height()) | 102 // TODO(sergeyu): Move these checks to protocol layer. |
| 103 if (!resolution.has_dips_width() || !resolution.has_dips_height() || |
| 104 resolution.dips_width() < 0 || resolution.dips_height() < 0 || |
| 105 resolution.width() <= 0 || resolution.height() <= 0) { |
| 106 LOG(ERROR) << "Received invalid ClientResolution message."; |
103 return; | 107 return; |
| 108 } |
104 | 109 |
105 VLOG(1) << "Received ClientResolution (dips_width=" | 110 VLOG(1) << "Received ClientResolution (dips_width=" |
106 << resolution.dips_width() << ", dips_height=" | 111 << resolution.dips_width() << ", dips_height=" |
107 << resolution.dips_height() << ")"; | 112 << resolution.dips_height() << ")"; |
108 | 113 |
109 if (!screen_controls_) | 114 if (!screen_controls_) |
110 return; | 115 return; |
111 | 116 |
112 ScreenResolution client_resolution( | 117 ScreenResolution client_resolution( |
113 SkISize::Make(resolution.dips_width(), resolution.dips_height()), | 118 webrtc::DesktopSize(resolution.dips_width(), resolution.dips_height()), |
114 SkIPoint::Make(kDefaultDPI, kDefaultDPI)); | 119 webrtc::DesktopVector(kDefaultDPI, kDefaultDPI)); |
115 | 120 |
116 // Try to match the client's resolution. | 121 // Try to match the client's resolution. |
117 if (client_resolution.IsValid()) | 122 screen_controls_->SetScreenResolution(client_resolution); |
118 screen_controls_->SetScreenResolution(client_resolution); | |
119 } | 123 } |
120 | 124 |
121 void ClientSession::ControlVideo(const protocol::VideoControl& video_control) { | 125 void ClientSession::ControlVideo(const protocol::VideoControl& video_control) { |
122 DCHECK(CalledOnValidThread()); | 126 DCHECK(CalledOnValidThread()); |
123 | 127 |
124 if (video_control.has_enable()) { | 128 if (video_control.has_enable()) { |
125 VLOG(1) << "Received VideoControl (enable=" | 129 VLOG(1) << "Received VideoControl (enable=" |
126 << video_control.enable() << ")"; | 130 << video_control.enable() << ")"; |
127 video_scheduler_->Pause(!video_control.enable()); | 131 video_scheduler_->Pause(!video_control.enable()); |
128 } | 132 } |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 return scoped_ptr<AudioEncoder>(new AudioEncoderSpeex()); | 416 return scoped_ptr<AudioEncoder>(new AudioEncoderSpeex()); |
413 } else if (audio_config.codec == protocol::ChannelConfig::CODEC_OPUS) { | 417 } else if (audio_config.codec == protocol::ChannelConfig::CODEC_OPUS) { |
414 return scoped_ptr<AudioEncoder>(new AudioEncoderOpus()); | 418 return scoped_ptr<AudioEncoder>(new AudioEncoderOpus()); |
415 } | 419 } |
416 | 420 |
417 NOTIMPLEMENTED(); | 421 NOTIMPLEMENTED(); |
418 return scoped_ptr<AudioEncoder>(NULL); | 422 return scoped_ptr<AudioEncoder>(NULL); |
419 } | 423 } |
420 | 424 |
421 } // namespace remoting | 425 } // namespace remoting |
OLD | NEW |