Migrate away from the PrefMetricsService-based device ID in PrefHashCalculator.
[chromium-blink-merge.git] / media / filters / video_frame_scheduler.h
blobf90726211cd44d7c52a515daf7a39c151f8d2973
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.
5 #ifndef MEDIA_FILTERS_VIDEO_FRAME_SCHEDULER_H_
6 #define MEDIA_FILTERS_VIDEO_FRAME_SCHEDULER_H_
8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/time/time.h"
11 #include "media/base/media_export.h"
13 namespace media {
15 class VideoFrame;
17 // Defines an abstract video frame scheduler that is capable of managing the
18 // display of video frames at explicit times.
19 class MEDIA_EXPORT VideoFrameScheduler {
20 public:
21 VideoFrameScheduler() {}
22 virtual ~VideoFrameScheduler() {}
24 enum Reason {
25 DISPLAYED, // Frame was displayed.
26 DROPPED, // Frame was dropped.
28 typedef base::Callback<void(const scoped_refptr<VideoFrame>&, Reason)> DoneCB;
30 // Schedule |frame| to be displayed at |wall_ticks|, firing |done_cb| when
31 // the scheduler has finished with the frame.
33 // To avoid reentrancy issues, |done_cb| is run on a separate calling stack.
34 virtual void ScheduleVideoFrame(const scoped_refptr<VideoFrame>& frame,
35 base::TimeTicks wall_ticks,
36 const DoneCB& done_cb) = 0;
38 // Causes the scheduler to cancel any previously scheduled frames.
40 // There is no guarantee that |done_cb|'s for previously scheduled frames
41 // will not be run. Clients should implement callback tracking/cancellation
42 // if they are sensitive to old callbacks being run.
43 virtual void Reset() = 0;
46 } // namespace media
48 #endif // MEDIA_FILTERS_VIDEO_FRAME_SCHEDULER_H_