OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MEDIA_FILTERS_TEST_VIDEO_FRAME_SCHEDULER_H_ | |
6 #define MEDIA_FILTERS_TEST_VIDEO_FRAME_SCHEDULER_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "media/filters/video_frame_scheduler.h" | |
11 | |
12 namespace media { | |
13 | |
14 // A scheduler that queues frames until told otherwise. | |
15 class TestVideoFrameScheduler : public VideoFrameScheduler { | |
16 public: | |
17 struct ScheduledFrame { | |
18 ScheduledFrame(const scoped_refptr<VideoFrame> frame, | |
19 base::TimeTicks wall_ticks, | |
20 const DoneCB& done_cb); | |
21 ~ScheduledFrame(); | |
22 | |
23 scoped_refptr<VideoFrame> frame; | |
24 base::TimeTicks wall_ticks; | |
25 DoneCB done_cb; | |
26 }; | |
27 | |
28 TestVideoFrameScheduler(); | |
29 virtual ~TestVideoFrameScheduler(); | |
30 | |
31 // VideoFrameScheduler implementation. | |
32 virtual void ScheduleVideoFrame(const scoped_refptr<VideoFrame>& frame, | |
33 base::TimeTicks wall_ticks, | |
34 const DoneCB& done_cb) OVERRIDE; | |
35 virtual void Reset() OVERRIDE; | |
36 | |
37 // Displays all frames with scheduled times <= |wall_ticks|. | |
38 void DisplayFrames(base::TimeTicks wall_ticks); | |
xhwang
2014/04/24 18:48:44
s/DisplayFrames/DisplayFramesUpTo/ ?
scherkus (not reviewing)
2014/04/25 02:04:47
Done.
| |
39 | |
40 // Drops all frames with scheduled times <= |wall_ticks|. | |
41 void DropFrames(base::TimeTicks wall_ticks); | |
xhwang
2014/04/24 18:48:44
ditto about "UpTo"
scherkus (not reviewing)
2014/04/25 02:04:47
Done.
| |
42 | |
43 void set_should_reset(bool should_reset) { should_reset_ = should_reset; } | |
44 const std::vector<ScheduledFrame>& scheduled_frames() { | |
45 return scheduled_frames_; | |
46 } | |
47 | |
48 private: | |
49 void RunDoneCBForFrames(base::TimeTicks wall_ticks, Reason reason); | |
50 | |
51 bool should_reset_; | |
52 std::vector<ScheduledFrame> scheduled_frames_; | |
xhwang
2014/04/24 18:48:44
Any reason we don't sort the frames by timestamp?
scherkus (not reviewing)
2014/04/25 02:04:47
it isn't required -- using a vector preserves the
| |
53 | |
54 DISALLOW_COPY_AND_ASSIGN(TestVideoFrameScheduler); | |
55 }; | |
56 | |
57 } // namespace media | |
58 | |
59 #endif // MEDIA_FILTERS_TEST_VIDEO_FRAME_SCHEDULER_H_ | |
OLD | NEW |