OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/fake_desktop_capturer.h" | 5 #include "remoting/protocol/fake_desktop_capturer.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/ref_counted.h" | |
10 #include "base/time/time.h" | 9 #include "base/time/time.h" |
11 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" | 10 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" |
12 | 11 |
13 namespace remoting { | 12 namespace remoting { |
| 13 namespace protocol { |
14 | 14 |
15 // FakeDesktopCapturer generates a white picture of size kWidth x kHeight | 15 // FakeDesktopCapturer generates a white picture of size kWidth x kHeight |
16 // with a rectangle of size kBoxWidth x kBoxHeight. The rectangle moves kSpeed | 16 // with a rectangle of size kBoxWidth x kBoxHeight. The rectangle moves kSpeed |
17 // pixels per frame along both axes, and bounces off the sides of the screen. | 17 // pixels per frame along both axes, and bounces off the sides of the screen. |
18 static const int kWidth = FakeDesktopCapturer::kWidth; | 18 static const int kWidth = FakeDesktopCapturer::kWidth; |
19 static const int kHeight = FakeDesktopCapturer::kHeight; | 19 static const int kHeight = FakeDesktopCapturer::kHeight; |
20 static const int kBoxWidth = 140; | 20 static const int kBoxWidth = 140; |
21 static const int kBoxHeight = 140; | 21 static const int kBoxHeight = 140; |
22 static const int kSpeed = 20; | 22 static const int kSpeed = 20; |
23 | 23 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 void FakeDesktopCapturer::Capture(const webrtc::DesktopRegion& region) { | 143 void FakeDesktopCapturer::Capture(const webrtc::DesktopRegion& region) { |
144 base::Time capture_start_time = base::Time::Now(); | 144 base::Time capture_start_time = base::Time::Now(); |
145 scoped_ptr<webrtc::DesktopFrame> frame = frame_generator_.Run(callback_); | 145 scoped_ptr<webrtc::DesktopFrame> frame = frame_generator_.Run(callback_); |
146 if (frame) { | 146 if (frame) { |
147 frame->set_capture_time_ms( | 147 frame->set_capture_time_ms( |
148 (base::Time::Now() - capture_start_time).InMillisecondsRoundedUp()); | 148 (base::Time::Now() - capture_start_time).InMillisecondsRoundedUp()); |
149 } | 149 } |
150 callback_->OnCaptureCompleted(frame.release()); | 150 callback_->OnCaptureCompleted(frame.release()); |
151 } | 151 } |
152 | 152 |
| 153 } // namespace protocol |
153 } // namespace remoting | 154 } // namespace remoting |
OLD | NEW |