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
3 // found in the LICENSE file.
5 #include "remoting/host/mouse_clamping_filter.h"
7 #include "remoting/proto/event.pb.h"
8 #include "remoting/proto/video.pb.h"
12 MouseClampingFilter::MouseClampingFilter(
13 protocol::InputStub
* input_stub
)
14 : input_filter_(input_stub
),
15 video_stub_(nullptr) {
18 MouseClampingFilter::~MouseClampingFilter() {
21 void MouseClampingFilter::ProcessVideoPacket(
22 scoped_ptr
<VideoPacket
> video_packet
,
23 const base::Closure
& done
) {
24 // Configure the MouseInputFilter to clamp to the video dimensions.
25 if (video_packet
->format().has_screen_width() &&
26 video_packet
->format().has_screen_height()) {
27 webrtc::DesktopSize screen_size
=
28 webrtc::DesktopSize(video_packet
->format().screen_width(),
29 video_packet
->format().screen_height());
30 input_filter_
.set_input_size(screen_size
);
31 input_filter_
.set_output_size(screen_size
);
34 video_stub_
->ProcessVideoPacket(video_packet
.Pass(), done
);
37 } // namespace remoting