Chromium Code Reviews| Index: media/base/video_renderer_sink.h |
| diff --git a/media/base/video_renderer_sink.h b/media/base/video_renderer_sink.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..25159430dda7cdbfc9b2edbed43f5b9c0325ccdc |
| --- /dev/null |
| +++ b/media/base/video_renderer_sink.h |
| @@ -0,0 +1,65 @@ |
| +// 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_BASE_VIDEO_RENDERER_SINK_H_ |
| +#define MEDIA_BASE_VIDEO_RENDERER_SINK_H_ |
| + |
| +#include <vector> |
| + |
| +#include "base/basictypes.h" |
| +#include "base/logging.h" |
| +#include "media/base/media_export.h" |
| +#include "media/base/video_frame.h" |
| + |
| +namespace media { |
| + |
| +// VideoRendererSink is an interface representing the end-point for rendered |
| +// video frames. An implementation is expected to periodically call Render() on |
| +// a callback object. |
| +class MEDIA_EXPORT VideoRendererSink { |
| + public: |
| + class RenderCallback { |
| + public: |
| + // Returns a VideoFrame for rendering which should be displayed within the |
| + // 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.
|
| + // no frame or no new frame (since the last Render() call) is available for |
| + // rendering within the requested interval. |
| + // |
| + // If |is_visible| is false, the returned frame may not be rendered; clients |
| + // may use this information to stop counting dropped frames (as the deadline |
| + // interval may be extend while render frequency is reduced to conserve on |
| + // power consumption). |
| + virtual scoped_refptr<VideoFrame> Render(base::TimeTicks deadline_min, |
| + base::TimeTicks deadline_max, |
| + 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
|
| + |
| + // Called by the sink when a VideoFrame previously returned via Render() was |
| + // not actually rendered. Must be called before the next Render() call. |
| + // Must not be called if |is_visible| was false when Render() was called. |
| + virtual void OnFrameDropped() = 0; |
| + |
| + virtual ~RenderCallback() {} |
| + }; |
| + |
| + // Starts video rendering. See RenderCallback for more details. |
| + virtual void Start(RenderCallback* callback) = 0; |
| + |
| + // Stops video rendering, waits for any outstanding calls to |callback| to |
| + // complete before returning. No new calls to |callback| will be issued after |
| + // this method returns. |
| + virtual void Stop() = 0; |
| + |
| + // Instead of using a callback driven rendering path, allow clients to paint |
| + // frames as they see fit without regard for the compositor. |
| + // TODO(dalecurtis): This should be nuked once experiments show the new path |
| + // is amazing and the old path is not! http://crbug.com/439548 |
| + virtual void PaintFrameUsingOldRenderingPath( |
| + const scoped_refptr<VideoFrame>& frame) = 0; |
| + |
| + virtual ~VideoRendererSink() {} |
| +}; |
| + |
| +} // namespace media |
| + |
| +#endif // MEDIA_BASE_VIDEO_RENDERER_SINK_H_ |