Index: remoting/test/cyclic_frame_generator.h |
diff --git a/remoting/test/cyclic_frame_generator.h b/remoting/test/cyclic_frame_generator.h |
index 4c2fa4581117e23add57302ba83fc0ddeb936cfc..d03118a718921b4c705322c33e8d83faf5d0b4e0 100644 |
--- a/remoting/test/cyclic_frame_generator.h |
+++ b/remoting/test/cyclic_frame_generator.h |
@@ -9,10 +9,8 @@ |
#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 { |
@@ -23,7 +21,8 @@ |
// 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 protocol::InputEventTimestampsSource { |
+class CyclicFrameGenerator |
+ : public base::RefCountedThreadSafe<CyclicFrameGenerator> { |
public: |
enum class ChangeType { |
// No changes. |
@@ -61,22 +60,25 @@ |
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_; } |
- // 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; |
+ // 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); |
private: |
- ~CyclicFrameGenerator() override; |
+ ~CyclicFrameGenerator(); |
friend class base::RefCountedThreadSafe<CyclicFrameGenerator>; |
std::vector<std::unique_ptr<webrtc::DesktopFrame>> reference_frames_; |
@@ -90,6 +92,9 @@ |
// 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; |
@@ -97,6 +102,8 @@ |
bool last_cursor_state_ = false; |
ChangeType last_frame_type_ = ChangeType::NO_CHANGES; |
+ |
+ bool draw_barcode_ = false; |
base::TimeTicks started_time_; |