Chromium Code Reviews| 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 | |
| 26 // no frame or no new frame (since the last Render() call) is available for | |
| 27 // rendering within the requested interval. Intervals are expected to be | |
| 28 // regular, contiguous, and monotonically increasing. Irregular intervals | |
| 29 // may affect the rendering decisions made by the underlying callback. | |
| 30 virtual scoped_refptr<VideoFrame> Render(base::TimeTicks deadline_min, | |
|
DaleCurtis
2015/04/07 19:58:45
Since VideoFrameCompositor will need to pump and t
| |
| 31 base::TimeTicks deadline_max) = 0; | |
| 32 | |
| 33 // Called by the sink when a VideoFrame previously returned via Render() was | |
| 34 // not actually rendered. Must be called before the next Render() call. | |
| 35 virtual void OnFrameDropped() = 0; | |
| 36 | |
| 37 // Render() callbacks may be suspended for compositing reasons. There will | |
|
DaleCurtis
2015/04/07 19:58:45
As discussed offline, these don't work since Video
| |
| 38 // be no outstanding Render() callbacks when OnRenderSuspended() is called, | |
| 39 // nor any issued until after OnRenderResumed() has returned. | |
| 40 virtual void OnRenderResumed() = 0; | |
| 41 virtual void OnRenderSuspended() = 0; | |
| 42 | |
| 43 virtual ~RenderCallback() {} | |
| 44 }; | |
| 45 | |
| 46 // Starts video rendering. See RenderCallback for more details. | |
| 47 virtual void Start(RenderCallback* callback) = 0; | |
| 48 | |
| 49 // Stops video rendering, waits for any outstanding calls to |callback| to | |
| 50 // complete before returning. No new calls to |callback| will be issued after | |
| 51 // this method returns. | |
| 52 virtual void Stop() = 0; | |
| 53 | |
| 54 // Instead of using a callback driven rendering path, allow clients to paint | |
| 55 // frames as they see fit without regard for the compositor. | |
| 56 // TODO(dalecurtis): This should be nuked once experiments show the new path | |
| 57 // is amazing and the old path is not! http://crbug.com/439548 | |
| 58 virtual void PaintFrameUsingOldRenderingPath( | |
| 59 const scoped_refptr<VideoFrame>& frame) = 0; | |
| 60 | |
| 61 virtual ~VideoRendererSink() {} | |
| 62 }; | |
| 63 | |
| 64 } // namespace media | |
| 65 | |
| 66 #endif // MEDIA_BASE_VIDEO_RENDERER_SINK_H_ | |
| OLD | NEW |