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

Side by Side Diff: media/filters/test_video_frame_scheduler.cc

Issue 257793004: Update VideoFrameScheduler API and add clockless and testing implementations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/filters/test_video_frame_scheduler.h ('k') | media/filters/video_frame_scheduler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 #include "media/filters/test_video_frame_scheduler.h"
6
7 #include "media/base/video_frame.h"
8
9 namespace media {
10
11 TestVideoFrameScheduler::ScheduledFrame::ScheduledFrame(
12 const scoped_refptr<VideoFrame> frame,
13 base::TimeTicks wall_ticks,
14 const DoneCB& done_cb)
15 : frame(frame), wall_ticks(wall_ticks), done_cb(done_cb) {
16 }
17
18 TestVideoFrameScheduler::ScheduledFrame::~ScheduledFrame() {
19 }
20
21 TestVideoFrameScheduler::TestVideoFrameScheduler() {
22 }
23
24 TestVideoFrameScheduler::~TestVideoFrameScheduler() {
25 }
26
27 void TestVideoFrameScheduler::ScheduleVideoFrame(
28 const scoped_refptr<VideoFrame>& frame,
29 base::TimeTicks wall_ticks,
30 const DoneCB& done_cb) {
31 scheduled_frames_.push_back(ScheduledFrame(frame, wall_ticks, done_cb));
32 }
33
34 void TestVideoFrameScheduler::Reset() {
35 scheduled_frames_.clear();
36 }
37
38 void TestVideoFrameScheduler::DisplayFramesUpTo(base::TimeTicks wall_ticks) {
39 RunDoneCBForFramesUpTo(wall_ticks, DISPLAYED);
40 }
41
42 void TestVideoFrameScheduler::DropFramesUpTo(base::TimeTicks wall_ticks) {
43 RunDoneCBForFramesUpTo(wall_ticks, DROPPED);
44 }
45
46 void TestVideoFrameScheduler::RunDoneCBForFramesUpTo(base::TimeTicks wall_ticks,
47 Reason reason) {
48 std::vector<ScheduledFrame> done_frames;
49 std::vector<ScheduledFrame> remaining_frames;
50
51 for (size_t i = 0; i < scheduled_frames_.size(); ++i) {
52 if (scheduled_frames_[i].wall_ticks <= wall_ticks) {
53 done_frames.push_back(scheduled_frames_[i]);
54 } else {
55 remaining_frames.push_back(scheduled_frames_[i]);
56 }
57 }
58
59 scheduled_frames_.swap(remaining_frames);
60
61 for (size_t i = 0; i < done_frames.size(); ++i) {
62 done_frames[i].done_cb.Run(done_frames[i].frame, reason);
63 }
64 }
65
66 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/test_video_frame_scheduler.h ('k') | media/filters/video_frame_scheduler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698