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 if (!resolution.has_dips_width() || !resolution.has_dips_height() || |
103 resolution.dips_width() < 0 || resolution.dips_height() < 0) { | |
103 return; | 104 return; |
105 } | |
104 | 106 |
105 VLOG(1) << "Received ClientResolution (dips_width=" | 107 VLOG(1) << "Received ClientResolution (dips_width=" |
106 << resolution.dips_width() << ", dips_height=" | 108 << resolution.dips_width() << ", dips_height=" |
107 << resolution.dips_height() << ")"; | 109 << resolution.dips_height() << ")"; |
108 | 110 |
109 if (!screen_controls_) | 111 if (!screen_controls_) |
110 return; | 112 return; |
111 | 113 |
114 | |
112 ScreenResolution client_resolution( | 115 ScreenResolution client_resolution( |
113 SkISize::Make(resolution.dips_width(), resolution.dips_height()), | 116 webrtc::DesktopSize(resolution.dips_width(), resolution.dips_height()), |
114 SkIPoint::Make(kDefaultDPI, kDefaultDPI)); | 117 webrtc::DesktopVector(kDefaultDPI, kDefaultDPI)); |
115 | 118 |
116 // Try to match the client's resolution. | 119 // Try to match the client's resolution. |
117 if (client_resolution.IsValid()) | 120 screen_controls_->SetScreenResolution(client_resolution); |
alexeypa (please no reviews)
2013/04/26 21:33:58
IsValid() was more restrictive than the checks in
Sergey Ulanov
2013/05/07 22:25:50
Added checks for screen dimentions. It's actually
| |
118 screen_controls_->SetScreenResolution(client_resolution); | |
119 } | 121 } |
120 | 122 |
121 void ClientSession::ControlVideo(const protocol::VideoControl& video_control) { | 123 void ClientSession::ControlVideo(const protocol::VideoControl& video_control) { |
122 DCHECK(CalledOnValidThread()); | 124 DCHECK(CalledOnValidThread()); |
123 | 125 |
124 if (video_control.has_enable()) { | 126 if (video_control.has_enable()) { |
125 VLOG(1) << "Received VideoControl (enable=" | 127 VLOG(1) << "Received VideoControl (enable=" |
126 << video_control.enable() << ")"; | 128 << video_control.enable() << ")"; |
127 if (video_scheduler_) | 129 if (video_scheduler_) |
128 video_scheduler_->Pause(!video_control.enable()); | 130 video_scheduler_->Pause(!video_control.enable()); |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
402 return scoped_ptr<AudioEncoder>(new AudioEncoderSpeex()); | 404 return scoped_ptr<AudioEncoder>(new AudioEncoderSpeex()); |
403 } else if (audio_config.codec == protocol::ChannelConfig::CODEC_OPUS) { | 405 } else if (audio_config.codec == protocol::ChannelConfig::CODEC_OPUS) { |
404 return scoped_ptr<AudioEncoder>(new AudioEncoderOpus()); | 406 return scoped_ptr<AudioEncoder>(new AudioEncoderOpus()); |
405 } | 407 } |
406 | 408 |
407 NOTIMPLEMENTED(); | 409 NOTIMPLEMENTED(); |
408 return scoped_ptr<AudioEncoder>(NULL); | 410 return scoped_ptr<AudioEncoder>(NULL); |
409 } | 411 } |
410 | 412 |
411 } // namespace remoting | 413 } // namespace remoting |
OLD | NEW |