Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(478)

Side by Side Diff: remoting/host/client_session.cc

Issue 12678008: Reworked the plumbing required to pass the client resolution to the desktop resizer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR feedback. Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
31 namespace {
32 // Default DPI to assume for old clients that use notifyClientDimensions. 30 // Default DPI to assume for old clients that use notifyClientDimensions.
33 const int kDefaultDPI = 96; 31 const int kDefaultDPI = 96;
Jamie 2013/03/15 22:06:27 Why lose the anonymous namespace?
alexeypa (please no reviews) 2013/03/15 22:32:12 It is not needed. Constants have file scope by def
34 } // namespace 32
33 namespace remoting {
35 34
36 ClientSession::ClientSession( 35 ClientSession::ClientSession(
37 EventHandler* event_handler, 36 EventHandler* event_handler,
38 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner, 37 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner,
39 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, 38 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
40 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, 39 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner,
41 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner, 40 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner,
42 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, 41 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
43 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, 42 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
44 scoped_ptr<protocol::ConnectionToClient> connection, 43 scoped_ptr<protocol::ConnectionToClient> connection,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 DCHECK(!audio_scheduler_); 88 DCHECK(!audio_scheduler_);
90 DCHECK(!event_executor_); 89 DCHECK(!event_executor_);
91 DCHECK(!session_controller_); 90 DCHECK(!session_controller_);
92 DCHECK(!video_scheduler_); 91 DCHECK(!video_scheduler_);
93 92
94 connection_.reset(); 93 connection_.reset();
95 } 94 }
96 95
97 void ClientSession::NotifyClientResolution( 96 void ClientSession::NotifyClientResolution(
98 const protocol::ClientResolution& resolution) { 97 const protocol::ClientResolution& resolution) {
99 if (resolution.has_dips_width() && resolution.has_dips_height()) { 98 if (!resolution.has_dips_width() || !resolution.has_dips_height())
100 VLOG(1) << "Received ClientResolution (dips_width=" 99 return;
101 << resolution.dips_width() << ", dips_height=" 100
102 << resolution.dips_height() << ")"; 101 VLOG(1) << "Received ClientResolution (dips_width="
103 if (session_controller_) { 102 << resolution.dips_width() << ", dips_height="
104 session_controller_->OnClientResolutionChanged( 103 << resolution.dips_height() << ")";
105 SkIPoint::Make(kDefaultDPI, kDefaultDPI), 104
106 SkISize::Make(resolution.dips_width(), resolution.dips_height())); 105 if (!session_controller_)
107 } 106 return;
108 } 107
108 ScreenResolution client_resolution(
109 SkISize::Make(resolution.dips_width(), resolution.dips_height()),
110 SkIPoint::Make(kDefaultDPI, kDefaultDPI));
111
112 // Try to match the client's resolution.
113 if (client_resolution.IsValid())
114 session_controller_->SetScreenResolution(client_resolution);
109 } 115 }
110 116
111 void ClientSession::ControlVideo(const protocol::VideoControl& video_control) { 117 void ClientSession::ControlVideo(const protocol::VideoControl& video_control) {
112 if (video_control.has_enable()) { 118 if (video_control.has_enable()) {
113 VLOG(1) << "Received VideoControl (enable=" 119 VLOG(1) << "Received VideoControl (enable="
114 << video_control.enable() << ")"; 120 << video_control.enable() << ")";
115 if (video_scheduler_) 121 if (video_scheduler_)
116 video_scheduler_->Pause(!video_control.enable()); 122 video_scheduler_->Pause(!video_control.enable());
117 } 123 }
118 } 124 }
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 return scoped_ptr<AudioEncoder>(new AudioEncoderSpeex()); 337 return scoped_ptr<AudioEncoder>(new AudioEncoderSpeex());
332 } else if (audio_config.codec == protocol::ChannelConfig::CODEC_OPUS) { 338 } else if (audio_config.codec == protocol::ChannelConfig::CODEC_OPUS) {
333 return scoped_ptr<AudioEncoder>(new AudioEncoderOpus()); 339 return scoped_ptr<AudioEncoder>(new AudioEncoderOpus());
334 } 340 }
335 341
336 NOTIMPLEMENTED(); 342 NOTIMPLEMENTED();
337 return scoped_ptr<AudioEncoder>(NULL); 343 return scoped_ptr<AudioEncoder>(NULL);
338 } 344 }
339 345
340 } // namespace remoting 346 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698