Index: remoting/test/cyclic_frame_generator.h |
diff --git a/remoting/test/cyclic_frame_generator.h b/remoting/test/cyclic_frame_generator.h |
index d03118a718921b4c705322c33e8d83faf5d0b4e0..4c2fa4581117e23add57302ba83fc0ddeb936cfc 100644 |
--- a/remoting/test/cyclic_frame_generator.h |
+++ b/remoting/test/cyclic_frame_generator.h |
@@ -9,8 +9,10 @@ |
#include <memory> |
#include <vector> |
+#include "base/callback.h" |
#include "base/memory/ref_counted.h" |
#include "base/time/default_tick_clock.h" |
+#include "remoting/protocol/input_event_timestamps.h" |
#include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" |
namespace remoting { |
@@ -21,8 +23,7 @@ namespace test { |
// loads a sequence of reference frames and switches between them with the |
// specified frequency (every 2 seconds by default). Between reference frames it |
// also generate frames with small changes which simulate a blinking cursor. |
-class CyclicFrameGenerator |
- : public base::RefCountedThreadSafe<CyclicFrameGenerator> { |
+class CyclicFrameGenerator : public protocol::InputEventTimestampsSource { |
public: |
enum class ChangeType { |
// No changes. |
@@ -60,25 +61,22 @@ class CyclicFrameGenerator |
void SetTickClock(base::TickClock* tick_clock); |
- // When |draw_barcode| is set to true a barcode is drawn on each generated |
- // frame. This makes it possible to call GetChangeList() to identify the frame |
- // by its content. |
- void set_draw_barcode(bool draw_barcode) { draw_barcode_ = draw_barcode; } |
- |
std::unique_ptr<webrtc::DesktopFrame> GenerateFrame( |
webrtc::SharedMemoryFactory* shared_memory_factory); |
ChangeType last_frame_type() { return last_frame_type_; } |
- // Identifies |frame| by its content and returns list of ChangeInfo for all |
- // changes between the frame passed to the previous GetChangeList() call and |
- // this one. GetChangeList() must be called for the frames in the order in |
- // which they were received, which is expected to match the order in which |
- // they are generated. |
- ChangeInfoList GetChangeList(webrtc::DesktopFrame* frame); |
+ // Returns list of changes for the frame with the specified |timestamp|, which |
+ // should be an event timestamp generated by InputEventTimestampsSource |
+ // implemented in this class. Must be called in the same order in which frames |
+ // were generated. |
+ ChangeInfoList GetChangeList(base::TimeTicks timestamp); |
+ |
+ // InputEventTimestampsSource interface. |
+ protocol::InputEventTimestamps TakeLastEventTimestamps() override; |
private: |
- ~CyclicFrameGenerator(); |
+ ~CyclicFrameGenerator() override; |
friend class base::RefCountedThreadSafe<CyclicFrameGenerator>; |
std::vector<std::unique_ptr<webrtc::DesktopFrame>> reference_frames_; |
@@ -92,9 +90,6 @@ class CyclicFrameGenerator |
// By default blink the cursor 4 times per seconds. |
base::TimeDelta cursor_blink_period_ = base::TimeDelta::FromMilliseconds(250); |
- // Id of the last frame encoded on the barcode. |
- int last_frame_id_ = -1; |
- |
// Index of the reference frame used to render the last generated frame. |
int last_reference_frame_ = -1; |
@@ -103,8 +98,6 @@ class CyclicFrameGenerator |
ChangeType last_frame_type_ = ChangeType::NO_CHANGES; |
- bool draw_barcode_ = false; |
- |
base::TimeTicks started_time_; |
// frame_id of the frame passed to the last GetChangeList() call. |