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" | |
14 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" | 13 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" |
15 | 14 |
16 namespace remoting { | 15 namespace remoting { |
17 namespace test { | 16 namespace test { |
18 | 17 |
19 class ScrollFrameGenerator : public protocol::InputEventTimestampsSource { | 18 class ScrollFrameGenerator |
| 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 // InputEventTimestampsSource interface. | 26 base::TimeDelta GetFrameLatency(const webrtc::DesktopFrame& frame); |
27 protocol::InputEventTimestamps TakeLastEventTimestamps() override; | |
28 | 27 |
29 private: | 28 private: |
30 ~ScrollFrameGenerator() override; | 29 ~ScrollFrameGenerator(); |
| 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 |
37 DISALLOW_COPY_AND_ASSIGN(ScrollFrameGenerator); | 40 DISALLOW_COPY_AND_ASSIGN(ScrollFrameGenerator); |
38 }; | 41 }; |
39 | 42 |
40 } // namespace test | 43 } // namespace test |
41 } // namespace remoting | 44 } // namespace remoting |
42 | 45 |
43 #endif // REMOTING_TEST_SCROLL_FRAME_GENERATOR_H_ | 46 #endif // REMOTING_TEST_SCROLL_FRAME_GENERATOR_H_ |
OLD | NEW |