Commit eccc2d43 authored by alexeypa@google.com's avatar alexeypa@google.com

Revert 176126 - the reverted change depends on another CL, so reverting it...

Revert 176126 - the reverted change depends on another CL, so reverting it breaks the build. Undoing the revert.

> Revert 175648 because it causes http://crbug.com/169126.
> 
> > Connect to DesktopEnvironment's stubs only when audio/video schedulers are about to be created.
> > 
> > This CL localizes usage of DesktopEnvironment to a single method that creates audio/video schedulers and hook up the event executor. This prepares further refactoring of DesktopEnvironment that should become a factory for classes interacting with the specific desktop environment.
> > 
> > Related changes in this CL:
> >   - MouseClampingFilter receives screen size on the proper thread.
> >   - ClientSessionTest.* tests now run asynchronously to support MouseClampingFilter change.
> >   - ClientSession does not expose DesktopEnvironment.
> >   - InputEventTracker can be re-attached to a different InputStub.
> > 
> > BUG=104544
> > 
> > 
> > Review URL: https://chromiumcodereview.appspot.com/11781003
> 
> TBR=alexeypa@chromium.org
> BUG=104544,169126
> Review URL: https://codereview.chromium.org/11817048

TBR=alexeypa@google.com

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176130 0039d316-1c4b-4281-b951-d872f2087c98
parent 7dcba24f
...@@ -12,8 +12,8 @@ namespace remoting { ...@@ -12,8 +12,8 @@ namespace remoting {
// VideoFrameCapturerFake generates a white picture of size kWidth x kHeight // VideoFrameCapturerFake generates a white picture of size kWidth x kHeight
// with a rectangle of size kBoxWidth x kBoxHeight. The rectangle moves kSpeed // with a rectangle of size kBoxWidth x kBoxHeight. The rectangle moves kSpeed
// pixels per frame along both axes, and bounces off the sides of the screen. // pixels per frame along both axes, and bounces off the sides of the screen.
static const int kWidth = 800; static const int kWidth = VideoFrameCapturerFake::kWidth;
static const int kHeight = 600; static const int kHeight = VideoFrameCapturerFake::kHeight;
static const int kBoxWidth = 140; static const int kBoxWidth = 140;
static const int kBoxHeight = 140; static const int kBoxHeight = 140;
static const int kSpeed = 20; static const int kSpeed = 20;
......
...@@ -17,6 +17,10 @@ namespace remoting { ...@@ -17,6 +17,10 @@ namespace remoting {
// See remoting/host/video_frame_capturer.h. // See remoting/host/video_frame_capturer.h.
class VideoFrameCapturerFake : public VideoFrameCapturer { class VideoFrameCapturerFake : public VideoFrameCapturer {
public: public:
// VideoFrameCapturerFake generates a picture of size kWidth x kHeight.
static const int kWidth = 800;
static const int kHeight = 600;
VideoFrameCapturerFake(); VideoFrameCapturerFake();
virtual ~VideoFrameCapturerFake(); virtual ~VideoFrameCapturerFake();
......
...@@ -244,8 +244,6 @@ class ChromotingHostTest : public testing::Test { ...@@ -244,8 +244,6 @@ class ChromotingHostTest : public testing::Test {
desktop_environment_factory_.get(), desktop_environment_factory_.get(),
base::TimeDelta()); base::TimeDelta());
connection_ptr->set_host_stub(client); connection_ptr->set_host_stub(client);
connection_ptr->set_input_stub(
client->desktop_environment()->event_executor());
ui_task_runner_->PostTask( ui_task_runner_->PostTask(
FROM_HERE, base::Bind(&ChromotingHostTest::AddClientToHost, FROM_HERE, base::Bind(&ChromotingHostTest::AddClientToHost,
......
...@@ -41,13 +41,10 @@ ClientSession::ClientSession( ...@@ -41,13 +41,10 @@ ClientSession::ClientSession(
connection_factory_(connection_.get()), connection_factory_(connection_.get()),
desktop_environment_(desktop_environment_factory->Create()), desktop_environment_(desktop_environment_factory->Create()),
client_jid_(connection_->session()->jid()), client_jid_(connection_->session()->jid()),
host_clipboard_stub_(desktop_environment_->event_executor()), input_tracker_(&host_input_filter_),
host_input_stub_(desktop_environment_->event_executor()),
input_tracker_(host_input_stub_),
remote_input_filter_(&input_tracker_), remote_input_filter_(&input_tracker_),
mouse_clamping_filter_(desktop_environment_->video_capturer(), mouse_clamping_filter_(&remote_input_filter_, connection_->video_stub()),
&remote_input_filter_), disable_input_filter_(mouse_clamping_filter_.input_filter()),
disable_input_filter_(&mouse_clamping_filter_),
disable_clipboard_filter_(clipboard_echo_filter_.host_filter()), disable_clipboard_filter_(clipboard_echo_filter_.host_filter()),
auth_input_filter_(&disable_input_filter_), auth_input_filter_(&disable_input_filter_),
auth_clipboard_filter_(&disable_clipboard_filter_), auth_clipboard_filter_(&disable_clipboard_filter_),
...@@ -66,7 +63,6 @@ ClientSession::ClientSession( ...@@ -66,7 +63,6 @@ ClientSession::ClientSession(
connection_->set_clipboard_stub(&auth_clipboard_filter_); connection_->set_clipboard_stub(&auth_clipboard_filter_);
connection_->set_host_stub(this); connection_->set_host_stub(this);
connection_->set_input_stub(&auth_input_filter_); connection_->set_input_stub(&auth_input_filter_);
clipboard_echo_filter_.set_host_stub(host_clipboard_stub_);
// |auth_*_filter_|'s states reflect whether the session is authenticated. // |auth_*_filter_|'s states reflect whether the session is authenticated.
auth_input_filter_.set_enabled(false); auth_input_filter_.set_enabled(false);
...@@ -127,6 +123,11 @@ void ClientSession::OnConnectionChannelsConnected( ...@@ -127,6 +123,11 @@ void ClientSession::OnConnectionChannelsConnected(
protocol::ConnectionToClient* connection) { protocol::ConnectionToClient* connection) {
DCHECK(CalledOnValidThread()); DCHECK(CalledOnValidThread());
DCHECK_EQ(connection_.get(), connection); DCHECK_EQ(connection_.get(), connection);
// Connect the host clipboard and input stubs.
host_input_filter_.set_input_stub(desktop_environment_->event_executor());
clipboard_echo_filter_.set_host_stub(desktop_environment_->event_executor());
SetDisableInputs(false); SetDisableInputs(false);
// Let the desktop environment notify us of local clipboard changes. // Let the desktop environment notify us of local clipboard changes.
...@@ -148,7 +149,7 @@ void ClientSession::OnConnectionChannelsConnected( ...@@ -148,7 +149,7 @@ void ClientSession::OnConnectionChannelsConnected(
desktop_environment_->video_capturer(), desktop_environment_->video_capturer(),
video_encoder.Pass(), video_encoder.Pass(),
connection_->client_stub(), connection_->client_stub(),
connection_->video_stub()); &mouse_clamping_filter_);
++active_recorders_; ++active_recorders_;
// Create an AudioScheduler if audio is enabled, to pump audio samples. // Create an AudioScheduler if audio is enabled, to pump audio samples.
......
...@@ -133,10 +133,6 @@ class ClientSession ...@@ -133,10 +133,6 @@ class ClientSession
return connection_.get(); return connection_.get();
} }
DesktopEnvironment* desktop_environment() const {
return desktop_environment_.get();
}
const std::string& client_jid() { return client_jid_; } const std::string& client_jid() { return client_jid_; }
bool is_authenticated() { return auth_input_filter_.enabled(); } bool is_authenticated() { return auth_input_filter_.enabled(); }
...@@ -181,11 +177,8 @@ class ClientSession ...@@ -181,11 +177,8 @@ class ClientSession
std::string client_jid_; std::string client_jid_;
// The host clipboard and input stubs to which this object delegates. // Filter used as the final element in the input pipeline.
// These are the final elements in the clipboard & input pipelines, which protocol::InputFilter host_input_filter_;
// appear in order below.
protocol::ClipboardStub* host_clipboard_stub_;
protocol::InputStub* host_input_stub_;
// Tracker used to release pressed keys and buttons when disconnecting. // Tracker used to release pressed keys and buttons when disconnecting.
protocol::InputEventTracker input_tracker_; protocol::InputEventTracker input_tracker_;
...@@ -197,7 +190,8 @@ class ClientSession ...@@ -197,7 +190,8 @@ class ClientSession
MouseClampingFilter mouse_clamping_filter_; MouseClampingFilter mouse_clamping_filter_;
// Filter to used to stop clipboard items sent from the client being echoed // Filter to used to stop clipboard items sent from the client being echoed
// back to it. // back to it. It is the final element in the clipboard (client -> host)
// pipeline.
protocol::ClipboardEchoFilter clipboard_echo_filter_; protocol::ClipboardEchoFilter clipboard_echo_filter_;
// Filters used to manage enabling & disabling of input & clipboard. // Filters used to manage enabling & disabling of input & clipboard.
......
This diff is collapsed.
...@@ -4,24 +4,34 @@ ...@@ -4,24 +4,34 @@
#include "remoting/host/mouse_clamping_filter.h" #include "remoting/host/mouse_clamping_filter.h"
#include "remoting/capturer/video_frame_capturer.h"
#include "remoting/proto/event.pb.h" #include "remoting/proto/event.pb.h"
#include "remoting/proto/video.pb.h"
namespace remoting { namespace remoting {
MouseClampingFilter::MouseClampingFilter(VideoFrameCapturer* capturer, MouseClampingFilter::MouseClampingFilter(
protocol::InputStub* input_stub) protocol::InputStub* input_stub,
: MouseInputFilter(input_stub), capturer_(capturer) { protocol::VideoStub* video_stub)
: input_filter_(input_stub),
video_stub_(video_stub) {
} }
MouseClampingFilter::~MouseClampingFilter() { MouseClampingFilter::~MouseClampingFilter() {
} }
void MouseClampingFilter::InjectMouseEvent(const protocol::MouseEvent& event) { void MouseClampingFilter::ProcessVideoPacket(
// Ensure that the MouseInputFilter is clamping to the current dimensions. scoped_ptr<VideoPacket> video_packet,
set_output_size(capturer_->size_most_recent()); const base::Closure& done) {
set_input_size(capturer_->size_most_recent()); // Configure the MouseInputFilter to clamp to the video dimensions.
MouseInputFilter::InjectMouseEvent(event); if (video_packet->format().has_screen_width() &&
video_packet->format().has_screen_height()) {
SkISize screen_size = SkISize::Make(video_packet->format().screen_width(),
video_packet->format().screen_height());
input_filter_.set_input_size(screen_size);
input_filter_.set_output_size(screen_size);
}
video_stub_->ProcessVideoPacket(video_packet.Pass(), done);
} }
} // namespace remoting } // namespace remoting
...@@ -7,25 +7,30 @@ ...@@ -7,25 +7,30 @@
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "remoting/protocol/mouse_input_filter.h" #include "remoting/protocol/mouse_input_filter.h"
#include "remoting/protocol/video_stub.h"
namespace remoting { namespace remoting {
class VideoFrameCapturer; // Filtering VideoStub implementation which configures a MouseInputFilter to
// clamp mouse events to fall within the dimensions of the most-recently
// Filtering InputStub implementation which clamps mouse each mouse event to // received video frame.
// the current dimensions of a VideoFrameCapturer instance before passing class MouseClampingFilter : public protocol::VideoStub {
// them on to the target |input_stub|.
class MouseClampingFilter : public protocol::MouseInputFilter {
public: public:
MouseClampingFilter(VideoFrameCapturer* capturer, MouseClampingFilter(protocol::InputStub* input_stub,
protocol::InputStub* input_stub); protocol::VideoStub* video_stub);
virtual ~MouseClampingFilter(); virtual ~MouseClampingFilter();
// InputStub overrides. protocol::InputStub* input_filter() { return &input_filter_; }
virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE;
// protocol::VideoStub implementation.
virtual void ProcessVideoPacket(scoped_ptr<VideoPacket> video_packet,
const base::Closure& done) OVERRIDE;
private: private:
VideoFrameCapturer* capturer_; // Clamps mouse event coordinates to the video dimensions.
protocol::MouseInputFilter input_filter_;
protocol::VideoStub* video_stub_;
DISALLOW_COPY_AND_ASSIGN(MouseClampingFilter); DISALLOW_COPY_AND_ASSIGN(MouseClampingFilter);
}; };
......
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