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_BASE_VIDEO_RENDERER_SINK_H_ | |
6 #define MEDIA_BASE_VIDEO_RENDERER_SINK_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "base/logging.h" | |
12 #include "media/base/media_export.h" | |
13 #include "media/base/video_frame.h" | |
14 | |
15 namespace media { | |
16 | |
17 // VideoRendererSink is an interface representing the end-point for rendered | |
18 // video frames. An implementation is expected to periodically call Render() on | |
19 // a callback object. | |
20 class MEDIA_EXPORT VideoRendererSink { | |
21 public: | |
22 class RenderCallback { | |
23 public: | |
24 // Returns a VideoFrame for rendering which should be displayed within the | |
25 // presentation interval [|deadline_min|, |deadline_max|]. Returns NULL if | |
xhwang
2015/04/03 07:00:13
ditto: What if there are multiple frames in that i
DaleCurtis
2015/04/03 17:14:52
It's expected to be contiguous and monotonically i
xhwang
2015/04/03 19:18:27
Yeah, that makes sense. Let's update the comment t
DaleCurtis
2015/04/07 00:40:51
Done.
| |
26 // no frame or no new frame (since the last Render() call) is available for | |
27 // rendering within the requested interval. | |
28 // | |
29 // If |is_visible| is false, the returned frame may not be rendered; clients | |
30 // may use this information to stop counting dropped frames (as the deadline | |
31 // interval may be extend while render frequency is reduced to conserve on | |
32 // power consumption). | |
33 virtual scoped_refptr<VideoFrame> Render(base::TimeTicks deadline_min, | |
34 base::TimeTicks deadline_max, | |
35 bool is_visible) = 0; | |
xhwang
2015/04/03 07:00:13
VideoFrameProvider has a separate SetVisible(bool
DaleCurtis
2015/04/03 17:14:52
I was hoping to avoid having to have the VideoRend
xhwang
2015/04/03 19:18:27
Agreed "visibility" should be a cc layer concept.
DaleCurtis
2015/04/03 19:59:16
Yes, it's power concern; which is why the cc/ time
DaleCurtis
2015/04/07 00:40:51
As discussed via chat, these have been replaced wi
| |
36 | |
37 // Called by the sink when a VideoFrame previously returned via Render() was | |
38 // not actually rendered. Must be called before the next Render() call. | |
39 // Must not be called if |is_visible| was false when Render() was called. | |
40 virtual void OnFrameDropped() = 0; | |
41 | |
42 virtual ~RenderCallback() {} | |
43 }; | |
44 | |
45 // Starts video rendering. See RenderCallback for more details. | |
46 virtual void Start(RenderCallback* callback) = 0; | |
47 | |
48 // Stops video rendering, waits for any outstanding calls to |callback| to | |
49 // complete before returning. No new calls to |callback| will be issued after | |
50 // this method returns. | |
51 virtual void Stop() = 0; | |
52 | |
53 // Instead of using a callback driven rendering path, allow clients to paint | |
54 // frames as they see fit without regard for the compositor. | |
55 // TODO(dalecurtis): This should be nuked once experiments show the new path | |
56 // is amazing and the old path is not! http://crbug.com/439548 | |
57 virtual void PaintFrameUsingOldRenderingPath( | |
58 const scoped_refptr<VideoFrame>& frame) = 0; | |
59 | |
60 virtual ~VideoRendererSink() {} | |
61 }; | |
62 | |
63 } // namespace media | |
64 | |
65 #endif // MEDIA_BASE_VIDEO_RENDERER_SINK_H_ | |
OLD | NEW |