| OLD | NEW |
| 1 // Copyright 2015 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/protocol/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/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" | 10 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 frame->mutable_updated_region()->SetRect( | 108 frame->mutable_updated_region()->SetRect( |
| 109 webrtc::DesktopRect::MakeXYWH(0, 0, kWidth, kHeight)); | 109 webrtc::DesktopRect::MakeXYWH(0, 0, kWidth, kHeight)); |
| 110 first_frame_ = false; | 110 first_frame_ = false; |
| 111 } else { | 111 } else { |
| 112 frame->mutable_updated_region()->SetRect(webrtc::DesktopRect::MakeXYWH( | 112 frame->mutable_updated_region()->SetRect(webrtc::DesktopRect::MakeXYWH( |
| 113 old_box_pos_x, old_box_pos_y, kBoxWidth, kBoxHeight)); | 113 old_box_pos_x, old_box_pos_y, kBoxWidth, kBoxHeight)); |
| 114 frame->mutable_updated_region()->AddRect(webrtc::DesktopRect::MakeXYWH( | 114 frame->mutable_updated_region()->AddRect(webrtc::DesktopRect::MakeXYWH( |
| 115 box_pos_x_, box_pos_y_, kBoxWidth, kBoxHeight)); | 115 box_pos_x_, box_pos_y_, kBoxWidth, kBoxHeight)); |
| 116 } | 116 } |
| 117 | 117 |
| 118 return frame.Pass(); | 118 return frame; |
| 119 } | 119 } |
| 120 | 120 |
| 121 } // namespace | 121 } // namespace |
| 122 | 122 |
| 123 FakeDesktopCapturer::FakeDesktopCapturer() | 123 FakeDesktopCapturer::FakeDesktopCapturer() |
| 124 : callback_(nullptr) { | 124 : callback_(nullptr) { |
| 125 frame_generator_ = base::Bind(&DefaultFrameGenerator::GenerateFrame, | 125 frame_generator_ = base::Bind(&DefaultFrameGenerator::GenerateFrame, |
| 126 new DefaultFrameGenerator()); | 126 new DefaultFrameGenerator()); |
| 127 } | 127 } |
| 128 | 128 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 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 protocol |
| 154 } // namespace remoting | 154 } // namespace remoting |
| OLD | NEW |