Commit 61233002 authored by Gary Kacmarcik's avatar Gary Kacmarcik Committed by Commit Bot

[Chromoting] Fix display selection on windows host

This moves the display scanning code to always be in the
DesktopCapturerProxy (DCP). Previously, it was located in the
DesktopSessionAgent (DSA) for Windows and in the DCP for Mac.

The change to record the display id along with the geometry info
broke Windows because that info was calculated in the DSA, but
not available in the DCP. By moving all the display scanning into
the DCP, this problem is fixed.

This also removes the duplicate code and increases the likelihood
that it2me will "just work".

This works because, on Windows Me2me, the DSA serves as the
ClientSessionController, and passes the message across the process
boundary to the real ClientSessionController.

Bug: 915411
Change-Id: Iecdd827b82c5e75e4a493f31cc31a6555388d4ca
Reviewed-on: https://chromium-review.googlesource.com/c/1485016Reviewed-by: default avatarJoe Downing <joedow@chromium.org>
Commit-Queue: Gary Kacmarcik <garykac@chromium.org>
Cr-Commit-Position: refs/heads/master@{#635183}
parent c0d45b4c
......@@ -191,6 +191,7 @@ bool DesktopCapturerProxy::GetSourceList(SourceList* sources) {
bool DesktopCapturerProxy::SelectSource(SourceId id_index) {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(desktop_display_info_);
SourceId id = -1;
if (id_index >= 0 && id_index < desktop_display_info_->NumDisplays()) {
DisplayGeometry display = desktop_display_info_->displays()[id_index];
......@@ -209,12 +210,6 @@ void DesktopCapturerProxy::OnFrameCaptured(
callback_->OnCaptureResult(result, std::move(frame));
// On Windows, this is handled in the DesktopSessionAgent.
// Once WebRTC has a callback with the display geometry, then we can remove
// this and rely on WebRTC to pass this through the callbacks up to the
// ClientSession.
// See https://bugs.chromium.org/p/webrtc/issues/detail?id=10122
#if !defined(OS_WIN)
if (client_session_control_) {
auto info = std::make_unique<DesktopDisplayInfo>();
info->LoadCurrentDisplayInfo();
......@@ -234,7 +229,6 @@ void DesktopCapturerProxy::OnFrameCaptured(
client_session_control_->OnDesktopDisplayChanged(std::move(layout));
}
}
#endif
}
} // namespace remoting
......@@ -168,7 +168,6 @@ DesktopSessionAgent::DesktopSessionAgent(
caller_task_runner_(caller_task_runner),
input_task_runner_(input_task_runner),
io_task_runner_(io_task_runner),
desktop_display_info_(new DesktopDisplayInfo()),
current_process_stats_("DesktopSessionAgent"),
weak_factory_(this) {
DCHECK(caller_task_runner_->BelongsToCurrentThread());
......@@ -285,7 +284,10 @@ void DesktopSessionAgent::SetDisableInputs(bool disable_inputs) {
}
void DesktopSessionAgent::OnDesktopDisplayChanged(
std::unique_ptr<protocol::VideoLayout> layout) {}
std::unique_ptr<protocol::VideoLayout> layout) {
SendToNetwork(std::make_unique<ChromotingDesktopNetworkMsg_DisplayChanged>(
*layout.get()));
}
void DesktopSessionAgent::OnProcessStats(
const protocol::AggregatedProcessResourceUsage& usage) {
......@@ -383,27 +385,6 @@ void DesktopSessionAgent::OnCaptureResult(
SendToNetwork(std::make_unique<ChromotingDesktopNetworkMsg_CaptureResult>(
result, serialized_frame));
auto info = std::make_unique<DesktopDisplayInfo>();
info->LoadCurrentDisplayInfo();
if (*desktop_display_info_ != *info) {
desktop_display_info_ = std::move(info);
// Generate and send VideoLayout message.
protocol::VideoLayout layout;
for (auto display : desktop_display_info_->displays()) {
protocol::VideoTrackLayout* track = layout.add_video_track();
track->set_id(display.id);
track->set_position_x(display.x);
track->set_position_y(display.y);
track->set_width(display.width);
track->set_height(display.height);
track->set_x_dpi(display.dpi);
track->set_y_dpi(display.dpi);
}
SendToNetwork(
std::make_unique<ChromotingDesktopNetworkMsg_DisplayChanged>(layout));
}
}
void DesktopSessionAgent::OnMouseCursor(webrtc::MouseCursor* cursor) {
......
......@@ -213,9 +213,6 @@ class DesktopSessionAgent
// Used to apply client-requested changes in screen resolution.
std::unique_ptr<ScreenControls> screen_controls_;
// Contains the most recently gathered into about the desktop displays.
std::unique_ptr<DesktopDisplayInfo> desktop_display_info_;
// IPC channel connecting the desktop process with the network process.
std::unique_ptr<IPC::ChannelProxy> network_channel_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment