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 #ifndef REMOTING_TEST_SCROLL_FRAME_GENERATOR_H_ | 5 #ifndef REMOTING_TEST_SCROLL_FRAME_GENERATOR_H_ |
6 #define REMOTING_TEST_SCROLL_FRAME_GENERATOR_H_ | 6 #define REMOTING_TEST_SCROLL_FRAME_GENERATOR_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <unordered_map> | 9 #include <unordered_map> |
10 | 10 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "remoting/protocol/input_event_timestamps.h" |
13 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" | 14 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" |
14 | 15 |
15 namespace remoting { | 16 namespace remoting { |
16 namespace test { | 17 namespace test { |
17 | 18 |
18 class ScrollFrameGenerator | 19 class ScrollFrameGenerator : public protocol::InputEventTimestampsSource { |
19 : public base::RefCountedThreadSafe<ScrollFrameGenerator> { | |
20 public: | 20 public: |
21 ScrollFrameGenerator(); | 21 ScrollFrameGenerator(); |
22 | 22 |
23 std::unique_ptr<webrtc::DesktopFrame> GenerateFrame( | 23 std::unique_ptr<webrtc::DesktopFrame> GenerateFrame( |
24 webrtc::SharedMemoryFactory* shared_memory_factory); | 24 webrtc::SharedMemoryFactory* shared_memory_factory); |
25 | 25 |
26 base::TimeDelta GetFrameLatency(const webrtc::DesktopFrame& frame); | 26 // InputEventTimestampsSource interface. |
| 27 protocol::InputEventTimestamps TakeLastEventTimestamps() override; |
27 | 28 |
28 private: | 29 private: |
29 ~ScrollFrameGenerator(); | 30 ~ScrollFrameGenerator() override; |
30 friend class base::RefCountedThreadSafe<ScrollFrameGenerator>; | |
31 | 31 |
32 std::unique_ptr<webrtc::DesktopFrame> base_frame_; | 32 std::unique_ptr<webrtc::DesktopFrame> base_frame_; |
33 base::TimeTicks start_time_; | 33 base::TimeTicks start_time_; |
34 | 34 |
35 std::unordered_map<int, base::TimeTicks> frame_timestamp_; | 35 std::unordered_map<int, base::TimeTicks> frame_timestamp_; |
36 | 36 |
37 // Id of the last frame encoded on the barcode. | |
38 int last_frame_id_ = -1; | |
39 | |
40 DISALLOW_COPY_AND_ASSIGN(ScrollFrameGenerator); | 37 DISALLOW_COPY_AND_ASSIGN(ScrollFrameGenerator); |
41 }; | 38 }; |
42 | 39 |
43 } // namespace test | 40 } // namespace test |
44 } // namespace remoting | 41 } // namespace remoting |
45 | 42 |
46 #endif // REMOTING_TEST_SCROLL_FRAME_GENERATOR_H_ | 43 #endif // REMOTING_TEST_SCROLL_FRAME_GENERATOR_H_ |
OLD | NEW |