OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/test/scroll_frame_generator.h" | 5 #include "remoting/test/scroll_frame_generator.h" |
6 | 6 |
7 #include "remoting/test/frame_generator_util.h" | 7 #include "remoting/test/frame_generator_util.h" |
8 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" | 8 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
9 | 9 |
10 namespace remoting { | 10 namespace remoting { |
(...skipping 23 matching lines...) Expand all Loading... |
34 webrtc::DesktopRect::MakeLTRB( | 34 webrtc::DesktopRect::MakeLTRB( |
35 0, 0, base_frame_->size().width(), top_height)); | 35 0, 0, base_frame_->size().width(), top_height)); |
36 result->CopyPixelsFrom( | 36 result->CopyPixelsFrom( |
37 *base_frame_, webrtc::DesktopVector(0, 0), | 37 *base_frame_, webrtc::DesktopVector(0, 0), |
38 webrtc::DesktopRect::MakeLTRB(0, top_height, base_frame_->size().width(), | 38 webrtc::DesktopRect::MakeLTRB(0, top_height, base_frame_->size().width(), |
39 base_frame_->size().height())); | 39 base_frame_->size().height())); |
40 | 40 |
41 result->mutable_updated_region()->SetRect( | 41 result->mutable_updated_region()->SetRect( |
42 webrtc::DesktopRect::MakeSize(result->size())); | 42 webrtc::DesktopRect::MakeSize(result->size())); |
43 | 43 |
44 ++last_frame_id_; | |
45 frame_timestamp_[last_frame_id_] = now; | |
46 DrawBarcode(last_frame_id_, true, result.get()); | |
47 | |
48 return result; | 44 return result; |
49 } | 45 } |
50 | 46 |
51 base::TimeDelta ScrollFrameGenerator::GetFrameLatency( | 47 protocol::InputEventTimestamps ScrollFrameGenerator::TakeLastEventTimestamps() { |
52 const webrtc::DesktopFrame& frame) { | 48 base::TimeTicks now = base::TimeTicks::Now(); |
53 int frame_id = ReadBarcode(frame); | 49 return protocol::InputEventTimestamps{now, now}; |
54 if (!frame_timestamp_.count(frame_id)) | |
55 LOG(FATAL) << "Unknown frame_id."; | |
56 return base::TimeTicks::Now() - frame_timestamp_[frame_id]; | |
57 } | 50 } |
58 | 51 |
59 } // namespace test | 52 } // namespace test |
60 } // namespace remoting | 53 } // namespace remoting |
OLD | NEW |