Commit 91f5ed4b authored by Gary Kacmarcik's avatar Gary Kacmarcik Committed by Commit Bot

[Chromoting] Add message with list of host displays

Currently, this just sends a message with the desktop display
configuration so that it can be added to the client logs.

The display information must be gathered in the Desktop
Process (DesktopSessionAgent) and then IPC'ed over to the
Network Process. A temp hook from the DesktopSessionProxy
to the ClientSession is added since there is no webrtc path
for this message (so it can't follow the normal path from
DesktopSessionProxy -> VideoFrameCapturer -> VideoStream ->
ClientSession).

Change-Id: I0a6b620b3b21aa16e6d978a92ece94f8440dc02c
Reviewed-on: https://chromium-review.googlesource.com/c/1352730Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarJoe Downing <joedow@chromium.org>
Commit-Queue: Gary Kacmarcik <garykac@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612405}
parent 26a7d45a
...@@ -112,6 +112,8 @@ static_library("host") { ...@@ -112,6 +112,8 @@ static_library("host") {
"daemon_process_win.cc", "daemon_process_win.cc",
"desktop_capturer_proxy.cc", "desktop_capturer_proxy.cc",
"desktop_capturer_proxy.h", "desktop_capturer_proxy.h",
"desktop_display_info.cc",
"desktop_display_info.h",
"desktop_environment.h", "desktop_environment.h",
"desktop_environment_options.cc", "desktop_environment_options.cc",
"desktop_environment_options.h", "desktop_environment_options.h",
......
...@@ -183,6 +183,10 @@ IPC_MESSAGE_CONTROL2(ChromotingDesktopNetworkMsg_CaptureResult, ...@@ -183,6 +183,10 @@ IPC_MESSAGE_CONTROL2(ChromotingDesktopNetworkMsg_CaptureResult,
webrtc::DesktopCapturer::Result /* result */, webrtc::DesktopCapturer::Result /* result */,
SerializedDesktopFrame /* frame */) SerializedDesktopFrame /* frame */)
// Notifies the network process that the host display layout has changed.
IPC_MESSAGE_CONTROL1(ChromotingDesktopNetworkMsg_DisplayChanged,
remoting::protocol::VideoLayout /* layout */)
// Carries a cursor share update from the desktop session agent to the client. // Carries a cursor share update from the desktop session agent to the client.
IPC_MESSAGE_CONTROL1(ChromotingDesktopNetworkMsg_MouseCursor, IPC_MESSAGE_CONTROL1(ChromotingDesktopNetworkMsg_MouseCursor,
webrtc::MouseCursor /* cursor */ ) webrtc::MouseCursor /* cursor */ )
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
namespace IPC { namespace IPC {
// webrtc::DesktopVector
// static // static
void ParamTraits<webrtc::DesktopVector>::Write(base::Pickle* m, void ParamTraits<webrtc::DesktopVector>::Write(base::Pickle* m,
const webrtc::DesktopVector& p) { const webrtc::DesktopVector& p) {
...@@ -38,6 +40,8 @@ void ParamTraits<webrtc::DesktopVector>::Log(const webrtc::DesktopVector& p, ...@@ -38,6 +40,8 @@ void ParamTraits<webrtc::DesktopVector>::Log(const webrtc::DesktopVector& p,
p.x(), p.y())); p.x(), p.y()));
} }
// webrtc::DesktopSize
// static // static
void ParamTraits<webrtc::DesktopSize>::Write(base::Pickle* m, void ParamTraits<webrtc::DesktopSize>::Write(base::Pickle* m,
const webrtc::DesktopSize& p) { const webrtc::DesktopSize& p) {
...@@ -63,6 +67,8 @@ void ParamTraits<webrtc::DesktopSize>::Log(const webrtc::DesktopSize& p, ...@@ -63,6 +67,8 @@ void ParamTraits<webrtc::DesktopSize>::Log(const webrtc::DesktopSize& p,
p.width(), p.height())); p.width(), p.height()));
} }
// webrtc::DesktopRect
// static // static
void ParamTraits<webrtc::DesktopRect>::Write(base::Pickle* m, void ParamTraits<webrtc::DesktopRect>::Write(base::Pickle* m,
const webrtc::DesktopRect& p) { const webrtc::DesktopRect& p) {
...@@ -92,6 +98,8 @@ void ParamTraits<webrtc::DesktopRect>::Log(const webrtc::DesktopRect& p, ...@@ -92,6 +98,8 @@ void ParamTraits<webrtc::DesktopRect>::Log(const webrtc::DesktopRect& p,
p.left(), p.top(), p.right(), p.bottom())); p.left(), p.top(), p.right(), p.bottom()));
} }
// webrtc::MouseCursor
// static // static
void ParamTraits<webrtc::MouseCursor>::Write(base::Pickle* m, void ParamTraits<webrtc::MouseCursor>::Write(base::Pickle* m,
const webrtc::MouseCursor& p) { const webrtc::MouseCursor& p) {
...@@ -153,6 +161,7 @@ void ParamTraits<webrtc::MouseCursor>::Log( ...@@ -153,6 +161,7 @@ void ParamTraits<webrtc::MouseCursor>::Log(
p.hotspot().x(), p.hotspot().y())); p.hotspot().x(), p.hotspot().y()));
} }
// remoting::ScreenResolution
// static // static
void ParamTraits<remoting::ScreenResolution>::Write( void ParamTraits<remoting::ScreenResolution>::Write(
...@@ -190,6 +199,8 @@ void ParamTraits<remoting::ScreenResolution>::Log( ...@@ -190,6 +199,8 @@ void ParamTraits<remoting::ScreenResolution>::Log(
p.dpi().x(), p.dpi().y())); p.dpi().x(), p.dpi().y()));
} }
// remoting::DesktopEnvironmentOptions
// static // static
void ParamTraits<remoting::DesktopEnvironmentOptions>::Write( void ParamTraits<remoting::DesktopEnvironmentOptions>::Write(
base::Pickle* m, base::Pickle* m,
...@@ -258,6 +269,8 @@ void ParamTraits<remoting::DesktopEnvironmentOptions>::Log( ...@@ -258,6 +269,8 @@ void ParamTraits<remoting::DesktopEnvironmentOptions>::Log(
l->append("DesktopEnvironmentOptions()"); l->append("DesktopEnvironmentOptions()");
} }
// remoting::protocol::ProcessResourceUsage
// static // static
void ParamTraits<remoting::protocol::ProcessResourceUsage>::Write( void ParamTraits<remoting::protocol::ProcessResourceUsage>::Write(
base::Pickle* m, base::Pickle* m,
...@@ -298,6 +311,8 @@ void ParamTraits<remoting::protocol::ProcessResourceUsage>::Log( ...@@ -298,6 +311,8 @@ void ParamTraits<remoting::protocol::ProcessResourceUsage>::Log(
l->append("ProcessResourceUsage(").append(p.process_name()).append(")"); l->append("ProcessResourceUsage(").append(p.process_name()).append(")");
} }
// remoting::protocol::AggregatedProcessResourceUsage
// static // static
void ParamTraits<remoting::protocol::AggregatedProcessResourceUsage>::Write( void ParamTraits<remoting::protocol::AggregatedProcessResourceUsage>::Write(
base::Pickle* m, base::Pickle* m,
...@@ -322,6 +337,8 @@ void ParamTraits<remoting::protocol::AggregatedProcessResourceUsage>::Log( ...@@ -322,6 +337,8 @@ void ParamTraits<remoting::protocol::AggregatedProcessResourceUsage>::Log(
l->append(")"); l->append(")");
} }
// remoting::protocol::ActionRequest
// static // static
void ParamTraits<remoting::protocol::ActionRequest>::Write( void ParamTraits<remoting::protocol::ActionRequest>::Write(
base::Pickle* m, base::Pickle* m,
...@@ -351,5 +368,45 @@ void ParamTraits<remoting::protocol::ActionRequest>::Log(const param_type& p, ...@@ -351,5 +368,45 @@ void ParamTraits<remoting::protocol::ActionRequest>::Log(const param_type& p,
p.request_id())); p.request_id()));
} }
} // namespace IPC // remoting::protocol::VideoLayout
// static
void ParamTraits<remoting::protocol::VideoLayout>::Write(
base::Pickle* m,
const remoting::protocol::VideoLayout& p) {
std::string serialized_video_layout;
bool result = p.SerializeToString(&serialized_video_layout);
DCHECK(result);
m->WriteString(serialized_video_layout);
}
// static
bool ParamTraits<remoting::protocol::VideoLayout>::Read(
const base::Pickle* m,
base::PickleIterator* iter,
remoting::protocol::VideoLayout* p) {
std::string serialized_video_layout;
if (!iter->ReadString(&serialized_video_layout))
return false;
return p->ParseFromString(serialized_video_layout);
}
// static
void ParamTraits<remoting::protocol::VideoLayout>::Log(
const remoting::protocol::VideoLayout& p,
std::string* l) {
l->append(base::StringPrintf("protocol::VideoLayout(["));
for (int i = 0; i < p.video_track_size(); i++) {
remoting::protocol::VideoTrackLayout track = p.video_track(i);
l->append("])");
if (i != 0)
l->append(",");
l->append(base::StringPrintf("{(%d,%d) %dx%d}", track.position_x(),
track.position_y(), track.width(),
track.height()));
}
l->append("])");
}
} // namespace IPC
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "remoting/host/desktop_environment_options.h" #include "remoting/host/desktop_environment_options.h"
#include "remoting/host/screen_resolution.h" #include "remoting/host/screen_resolution.h"
#include "remoting/proto/action.pb.h" #include "remoting/proto/action.pb.h"
#include "remoting/proto/control.pb.h"
#include "remoting/proto/process_stats.pb.h" #include "remoting/proto/process_stats.pb.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
...@@ -109,6 +110,16 @@ struct ParamTraits<remoting::protocol::ActionRequest> { ...@@ -109,6 +110,16 @@ struct ParamTraits<remoting::protocol::ActionRequest> {
static void Log(const param_type& p, std::string* l); static void Log(const param_type& p, std::string* l);
}; };
template <>
struct ParamTraits<remoting::protocol::VideoLayout> {
typedef remoting::protocol::VideoLayout param_type;
static void Write(base::Pickle* m, const param_type& p);
static bool Read(const base::Pickle* m,
base::PickleIterator* iter,
param_type* p);
static void Log(const param_type& p, std::string* l);
};
} // namespace IPC } // namespace IPC
#endif // REMOTING_HOST_CHROMOTING_PARAM_TRAITS_H_ #endif // REMOTING_HOST_CHROMOTING_PARAM_TRAITS_H_
...@@ -507,6 +507,51 @@ void ClientSession::OnVideoSizeChanged(protocol::VideoStream* video_stream, ...@@ -507,6 +507,51 @@ void ClientSession::OnVideoSizeChanged(protocol::VideoStream* video_stream,
} }
} }
void ClientSession::OnDesktopDisplayChanged(
std::unique_ptr<protocol::VideoLayout> displays) {
// Scan display list to calculate the full desktop size.
int min_x = 0;
int max_x = 0;
int min_y = 0;
int max_y = 0;
int dpi_x = 0;
int dpi_y = 0;
for (int display_id = 0; display_id < displays->video_track_size();
display_id++) {
protocol::VideoTrackLayout track = displays->video_track(display_id);
int x = track.position_x();
int y = track.position_y();
min_x = std::min(x, min_x);
min_y = std::min(y, min_y);
max_x = std::max(x + track.width(), max_x);
max_y = std::max(y + track.height(), max_y);
if (dpi_x == 0)
dpi_x = track.x_dpi();
if (dpi_y == 0)
dpi_y = track.y_dpi();
}
// Generate and send VideoLayout message.
protocol::VideoLayout layout;
protocol::VideoTrackLayout* video_track = layout.add_video_track();
video_track->set_position_x(0);
video_track->set_position_y(0);
video_track->set_width(max_x - min_x);
video_track->set_height(max_y - min_y);
video_track->set_x_dpi(dpi_x);
video_track->set_y_dpi(dpi_y);
// Add a VideoTrackLayout entry for each separate display.
for (int display_id = 0; display_id < displays->video_track_size();
display_id++) {
protocol::VideoTrackLayout* video_track = layout.add_video_track();
video_track->CopyFrom(displays->video_track(display_id));
}
connection_->client_stub()->SetVideoLayout(layout);
}
void ClientSession::CreateFileTransferMessageHandler( void ClientSession::CreateFileTransferMessageHandler(
const std::string& channel_name, const std::string& channel_name,
std::unique_ptr<protocol::MessagePipe> pipe) { std::unique_ptr<protocol::MessagePipe> pipe) {
......
...@@ -131,6 +131,8 @@ class ClientSession : public protocol::HostStub, ...@@ -131,6 +131,8 @@ class ClientSession : public protocol::HostStub,
void DisconnectSession(protocol::ErrorCode error) override; void DisconnectSession(protocol::ErrorCode error) override;
void OnLocalMouseMoved(const webrtc::DesktopVector& position) override; void OnLocalMouseMoved(const webrtc::DesktopVector& position) override;
void SetDisableInputs(bool disable_inputs) override; void SetDisableInputs(bool disable_inputs) override;
void OnDesktopDisplayChanged(
std::unique_ptr<protocol::VideoLayout> layout) override;
// ClientSessionDetails interface. // ClientSessionDetails interface.
uint32_t desktop_session_id() const override; uint32_t desktop_session_id() const override;
......
...@@ -13,6 +13,10 @@ class DesktopVector; ...@@ -13,6 +13,10 @@ class DesktopVector;
namespace remoting { namespace remoting {
namespace protocol {
class VideoLayout;
} // namespace protocol
// Allows the desktop environment to disconnect the client session and // Allows the desktop environment to disconnect the client session and
// to control the remote input handling (i.e. disable, enable, and pause // to control the remote input handling (i.e. disable, enable, and pause
// temporarily if the local mouse movements are detected). // temporarily if the local mouse movements are detected).
...@@ -32,6 +36,10 @@ class ClientSessionControl { ...@@ -32,6 +36,10 @@ class ClientSessionControl {
// Disables or enables the remote input in the client session. // Disables or enables the remote input in the client session.
virtual void SetDisableInputs(bool disable_inputs) = 0; virtual void SetDisableInputs(bool disable_inputs) = 0;
// Called when the host desktop displays are changed.
virtual void OnDesktopDisplayChanged(
std::unique_ptr<protocol::VideoLayout> layout) = 0;
}; };
} // namespace remoting } // namespace remoting
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "remoting/host/desktop_display_info.h"
#include "build/build_config.h"
#if defined(OS_WIN)
#include <windows.h>
#endif
namespace remoting {
DesktopDisplayInfo::DesktopDisplayInfo() = default;
DesktopDisplayInfo::~DesktopDisplayInfo() = default;
bool DesktopDisplayInfo::operator==(const DesktopDisplayInfo& other) {
if (other.displays_.size() == displays_.size()) {
for (size_t display = 0; display < displays_.size(); display++) {
DisplayGeometry this_display = displays_[display];
DisplayGeometry other_display = other.displays_[display];
if (this_display.x != other_display.x ||
this_display.y != other_display.y ||
this_display.width != other_display.width ||
this_display.height != other_display.height ||
this_display.dpi != other_display.dpi ||
this_display.bpp != other_display.bpp ||
this_display.is_default != other_display.is_default) {
return false;
}
}
return true;
}
return false;
}
bool DesktopDisplayInfo::operator!=(const DesktopDisplayInfo& other) {
return !(*this == other);
}
void DesktopDisplayInfo::LoadCurrentDisplayInfo() {
displays_.clear();
#if defined(OS_WIN)
BOOL enum_result = TRUE;
for (int device_index = 0;; ++device_index) {
DisplayGeometry info;
DISPLAY_DEVICE device = {};
device.cb = sizeof(device);
enum_result = EnumDisplayDevices(NULL, device_index, &device, 0);
// |enum_result| is 0 if we have enumerated all devices.
if (!enum_result)
break;
// We only care about active displays.
if (!(device.StateFlags & DISPLAY_DEVICE_ACTIVE))
continue;
info.is_default = false;
if (device.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)
info.is_default = true;
// Get additional info about device.
DEVMODE devmode;
devmode.dmSize = sizeof(devmode);
EnumDisplaySettingsEx(device.DeviceName, ENUM_CURRENT_SETTINGS, &devmode,
0);
info.x = devmode.dmPosition.x;
info.y = devmode.dmPosition.y;
info.width = devmode.dmPelsWidth;
info.height = devmode.dmPelsHeight;
info.dpi = devmode.dmLogPixels;
info.bpp = devmode.dmBitsPerPel;
displays_.push_back(info);
}
#endif
}
} // namespace remoting
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef REMOTING_HOST_DESKTOP_DISPLAY_INFO_H_
#define REMOTING_HOST_DESKTOP_DISPLAY_INFO_H_
#include <stddef.h>
#include "base/logging.h"
#include "remoting/proto/control.pb.h"
namespace remoting {
struct DisplayGeometry {
int32_t x, y;
uint32_t width, height;
uint32_t dpi; // Number of pixels per logical inch.
uint32_t bpp; // Number of bits per pixel.
bool is_default; // True if this is the default display.
};
class DesktopDisplayInfo {
public:
DesktopDisplayInfo();
~DesktopDisplayInfo();
void LoadCurrentDisplayInfo();
bool operator==(const DesktopDisplayInfo& other);
bool operator!=(const DesktopDisplayInfo& other);
std::vector<DisplayGeometry>& displays() { return displays_; };
private:
std::vector<DisplayGeometry> displays_;
DISALLOW_COPY_AND_ASSIGN(DesktopDisplayInfo);
};
} // namespace remoting
#endif // REMOTING_HOST_DESKTOP_DISPLAY_INFO_H_
...@@ -167,6 +167,7 @@ DesktopSessionAgent::DesktopSessionAgent( ...@@ -167,6 +167,7 @@ DesktopSessionAgent::DesktopSessionAgent(
caller_task_runner_(caller_task_runner), caller_task_runner_(caller_task_runner),
input_task_runner_(input_task_runner), input_task_runner_(input_task_runner),
io_task_runner_(io_task_runner), io_task_runner_(io_task_runner),
desktop_display_info_(new DesktopDisplayInfo()),
current_process_stats_("DesktopSessionAgent"), current_process_stats_("DesktopSessionAgent"),
weak_factory_(this) { weak_factory_(this) {
DCHECK(caller_task_runner_->BelongsToCurrentThread()); DCHECK(caller_task_runner_->BelongsToCurrentThread());
...@@ -261,6 +262,9 @@ void DesktopSessionAgent::SetDisableInputs(bool disable_inputs) { ...@@ -261,6 +262,9 @@ void DesktopSessionAgent::SetDisableInputs(bool disable_inputs) {
NOTREACHED(); NOTREACHED();
} }
void DesktopSessionAgent::OnDesktopDisplayChanged(
std::unique_ptr<protocol::VideoLayout> layout) {}
void DesktopSessionAgent::OnProcessStats( void DesktopSessionAgent::OnProcessStats(
const protocol::AggregatedProcessResourceUsage& usage) { const protocol::AggregatedProcessResourceUsage& usage) {
SendToNetwork( SendToNetwork(
...@@ -351,6 +355,26 @@ void DesktopSessionAgent::OnCaptureResult( ...@@ -351,6 +355,26 @@ void DesktopSessionAgent::OnCaptureResult(
SendToNetwork(std::make_unique<ChromotingDesktopNetworkMsg_CaptureResult>( SendToNetwork(std::make_unique<ChromotingDesktopNetworkMsg_CaptureResult>(
result, serialized_frame)); 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_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) { void DesktopSessionAgent::OnMouseCursor(webrtc::MouseCursor* cursor) {
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "mojo/public/cpp/system/message_pipe.h" #include "mojo/public/cpp/system/message_pipe.h"
#include "remoting/host/client_session_control.h" #include "remoting/host/client_session_control.h"
#include "remoting/host/current_process_stats_agent.h" #include "remoting/host/current_process_stats_agent.h"
#include "remoting/host/desktop_display_info.h"
#include "remoting/host/desktop_environment_options.h" #include "remoting/host/desktop_environment_options.h"
#include "remoting/protocol/clipboard_stub.h" #include "remoting/protocol/clipboard_stub.h"
#include "remoting/protocol/process_stats_stub.h" #include "remoting/protocol/process_stats_stub.h"
...@@ -118,6 +119,8 @@ class DesktopSessionAgent ...@@ -118,6 +119,8 @@ class DesktopSessionAgent
void DisconnectSession(protocol::ErrorCode error) override; void DisconnectSession(protocol::ErrorCode error) override;
void OnLocalMouseMoved(const webrtc::DesktopVector& position) override; void OnLocalMouseMoved(const webrtc::DesktopVector& position) override;
void SetDisableInputs(bool disable_inputs) override; void SetDisableInputs(bool disable_inputs) override;
void OnDesktopDisplayChanged(
std::unique_ptr<protocol::VideoLayout> layout) override;
// ProcessStatsStub interface. // ProcessStatsStub interface.
void OnProcessStats( void OnProcessStats(
...@@ -198,6 +201,9 @@ class DesktopSessionAgent ...@@ -198,6 +201,9 @@ class DesktopSessionAgent
// Used to apply client-requested changes in screen resolution. // Used to apply client-requested changes in screen resolution.
std::unique_ptr<ScreenControls> screen_controls_; 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. // IPC channel connecting the desktop process with the network process.
std::unique_ptr<IPC::ChannelProxy> network_channel_; std::unique_ptr<IPC::ChannelProxy> network_channel_;
......
...@@ -189,6 +189,8 @@ bool DesktopSessionProxy::OnMessageReceived(const IPC::Message& message) { ...@@ -189,6 +189,8 @@ bool DesktopSessionProxy::OnMessageReceived(const IPC::Message& message) {
OnAudioPacket) OnAudioPacket)
IPC_MESSAGE_HANDLER(ChromotingDesktopNetworkMsg_CaptureResult, IPC_MESSAGE_HANDLER(ChromotingDesktopNetworkMsg_CaptureResult,
OnCaptureResult) OnCaptureResult)
IPC_MESSAGE_HANDLER(ChromotingDesktopNetworkMsg_DisplayChanged,
OnDesktopDisplayChanged)
IPC_MESSAGE_HANDLER(ChromotingDesktopNetworkMsg_MouseCursor, IPC_MESSAGE_HANDLER(ChromotingDesktopNetworkMsg_MouseCursor,
OnMouseCursor) OnMouseCursor)
IPC_MESSAGE_HANDLER(ChromotingDesktopNetworkMsg_CreateSharedBuffer, IPC_MESSAGE_HANDLER(ChromotingDesktopNetworkMsg_CreateSharedBuffer,
...@@ -471,6 +473,17 @@ void DesktopSessionProxy::OnReleaseSharedBuffer(int id) { ...@@ -471,6 +473,17 @@ void DesktopSessionProxy::OnReleaseSharedBuffer(int id) {
shared_buffers_.erase(id); shared_buffers_.erase(id);
} }
void DesktopSessionProxy::OnDesktopDisplayChanged(
const protocol::VideoLayout& displays) {
DCHECK(caller_task_runner_->BelongsToCurrentThread());
if (client_session_control_) {
auto layout = std::make_unique<protocol::VideoLayout>();
layout->CopyFrom(displays);
client_session_control_->OnDesktopDisplayChanged(std::move(layout));
}
}
void DesktopSessionProxy::OnCaptureResult( void DesktopSessionProxy::OnCaptureResult(
webrtc::DesktopCapturer::Result result, webrtc::DesktopCapturer::Result result,
const SerializedDesktopFrame& serialized_frame) { const SerializedDesktopFrame& serialized_frame) {
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "remoting/host/audio_capturer.h" #include "remoting/host/audio_capturer.h"
#include "remoting/host/desktop_environment.h" #include "remoting/host/desktop_environment.h"
#include "remoting/host/screen_resolution.h" #include "remoting/host/screen_resolution.h"
#include "remoting/proto/control.pb.h"
#include "remoting/proto/event.pb.h" #include "remoting/proto/event.pb.h"
#include "remoting/protocol/clipboard_stub.h" #include "remoting/protocol/clipboard_stub.h"
#include "remoting/protocol/errors.h" #include "remoting/protocol/errors.h"
...@@ -163,6 +164,9 @@ class DesktopSessionProxy ...@@ -163,6 +164,9 @@ class DesktopSessionProxy
// Drops a cached reference to the shared buffer. // Drops a cached reference to the shared buffer.
void OnReleaseSharedBuffer(int id); void OnReleaseSharedBuffer(int id);
// Handles DesktopDisplayChange notification from the desktop session agent.
void OnDesktopDisplayChanged(const protocol::VideoLayout& layout);
// Handles CaptureResult notification from the desktop session agent. // Handles CaptureResult notification from the desktop session agent.
void OnCaptureResult(webrtc::DesktopCapturer::Result result, void OnCaptureResult(webrtc::DesktopCapturer::Result result,
const SerializedDesktopFrame& serialized_frame); const SerializedDesktopFrame& serialized_frame);
......
...@@ -71,6 +71,8 @@ class MockClientSessionControl : public ClientSessionControl { ...@@ -71,6 +71,8 @@ class MockClientSessionControl : public ClientSessionControl {
MOCK_METHOD1(OnLocalMouseMoved, void(const webrtc::DesktopVector&)); MOCK_METHOD1(OnLocalMouseMoved, void(const webrtc::DesktopVector&));
MOCK_METHOD1(SetDisableInputs, void(bool)); MOCK_METHOD1(SetDisableInputs, void(bool));
MOCK_METHOD0(ResetVideoPipeline, void()); MOCK_METHOD0(ResetVideoPipeline, void());
MOCK_METHOD1(OnDesktopDisplayChanged,
void(std::unique_ptr<protocol::VideoLayout>));
private: private:
DISALLOW_COPY_AND_ASSIGN(MockClientSessionControl); DISALLOW_COPY_AND_ASSIGN(MockClientSessionControl);
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "remoting/host/client_session_control.h" #include "remoting/host/client_session_control.h"
#include "remoting/proto/control.pb.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
namespace remoting { namespace remoting {
...@@ -44,6 +45,8 @@ class HostWindowProxy::Core ...@@ -44,6 +45,8 @@ class HostWindowProxy::Core
void DisconnectSession(protocol::ErrorCode error) override; void DisconnectSession(protocol::ErrorCode error) override;
void OnLocalMouseMoved(const webrtc::DesktopVector& position) override; void OnLocalMouseMoved(const webrtc::DesktopVector& position) override;
void SetDisableInputs(bool disable_inputs) override; void SetDisableInputs(bool disable_inputs) override;
void OnDesktopDisplayChanged(
std::unique_ptr<protocol::VideoLayout> layout) override;
// Task runner on which public methods of this class must be called. // Task runner on which public methods of this class must be called.
scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_; scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_;
...@@ -179,4 +182,9 @@ void HostWindowProxy::Core::SetDisableInputs(bool disable_inputs) { ...@@ -179,4 +182,9 @@ void HostWindowProxy::Core::SetDisableInputs(bool disable_inputs) {
client_session_control_->SetDisableInputs(disable_inputs); client_session_control_->SetDisableInputs(disable_inputs);
} }
void HostWindowProxy::Core::OnDesktopDisplayChanged(
std::unique_ptr<protocol::VideoLayout> layout) {
NOTREACHED();
}
} // namespace remoting } // namespace remoting
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