Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1268)

Unified Diff: media/filters/test_video_frame_scheduler.h

Issue 237353007: Refactor VideoRendererImpl to use VideoFrameScheduler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: pretty much done Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/filters/test_video_frame_scheduler.h
diff --git a/media/filters/test_video_frame_scheduler.h b/media/filters/test_video_frame_scheduler.h
new file mode 100644
index 0000000000000000000000000000000000000000..234dcdbd9ca25071c70a2b57443a12beab0f329b
--- /dev/null
+++ b/media/filters/test_video_frame_scheduler.h
@@ -0,0 +1,59 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_FILTERS_TEST_VIDEO_FRAME_SCHEDULER_H_
+#define MEDIA_FILTERS_TEST_VIDEO_FRAME_SCHEDULER_H_
+
+#include <vector>
+
+#include "media/filters/video_frame_scheduler.h"
+
+namespace media {
+
+// A scheduler that queues frames until told otherwise.
+class TestVideoFrameScheduler : public VideoFrameScheduler {
+ public:
+ struct ScheduledFrame {
+ ScheduledFrame(const scoped_refptr<VideoFrame> frame,
+ base::TimeTicks wall_ticks,
+ const DoneCB& done_cb);
+ ~ScheduledFrame();
+
+ scoped_refptr<VideoFrame> frame;
+ base::TimeTicks wall_ticks;
+ DoneCB done_cb;
+ };
+
+ TestVideoFrameScheduler();
+ virtual ~TestVideoFrameScheduler();
+
+ // VideoFrameScheduler implementation.
+ virtual void ScheduleVideoFrame(const scoped_refptr<VideoFrame>& frame,
+ base::TimeTicks wall_ticks,
+ const DoneCB& done_cb) OVERRIDE;
+ virtual void Reset() OVERRIDE;
+
+ // Displays all frames with scheduled times <= |wall_ticks|.
+ 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.
+
+ // Drops all frames with scheduled times <= |wall_ticks|.
+ 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.
+
+ void set_should_reset(bool should_reset) { should_reset_ = should_reset; }
+ const std::vector<ScheduledFrame>& scheduled_frames() {
+ return scheduled_frames_;
+ }
+
+ private:
+ void RunDoneCBForFrames(base::TimeTicks wall_ticks, Reason reason);
+
+ bool should_reset_;
+ 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
+
+ DISALLOW_COPY_AND_ASSIGN(TestVideoFrameScheduler);
+};
+
+} // namespace media
+
+#endif // MEDIA_FILTERS_TEST_VIDEO_FRAME_SCHEDULER_H_

Powered by Google App Engine
This is Rietveld 408576698