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

Side by Side Diff: cc/layers/video_frame_provider.h

Issue 1053113002: Prime the landing pad for the new video rendering pipeline. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove visibility stuff. Created 5 years, 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_LAYERS_VIDEO_FRAME_PROVIDER_H_ 5 #ifndef CC_LAYERS_VIDEO_FRAME_PROVIDER_H_
6 #define CC_LAYERS_VIDEO_FRAME_PROVIDER_H_ 6 #define CC_LAYERS_VIDEO_FRAME_PROVIDER_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/time/time.h"
9 #include "cc/base/cc_export.h" 10 #include "cc/base/cc_export.h"
10 11
11 namespace media { 12 namespace media {
12 class VideoFrame; 13 class VideoFrame;
13 } 14 }
14 15
15 namespace cc { 16 namespace cc {
16 17
17 // Threading notes: This class may be used in a multi threaded manner. 18 // VideoFrameProvider and VideoFrameProvider::Client define the relationship by
18 // Specifically, the implementation may call GetCurrentFrame() or 19 // which video frames are exchanged between a provider and client.
19 // PutCurrentFrame() from the compositor thread. If so, the caller is 20 //
20 // responsible for making sure Client::DidReceiveFrame() and 21 // Threading notes: This class may be used in a multithreaded manner. However,
21 // Client::DidUpdateMatrix() are only called from this same thread. 22 // if the Client implementation calls GetCurrentFrame()/PutCurrentFrame() from
23 // one thread, the provider must ensure that all client methods are called from
24 // that thread (typically the compositor thread).
22 class CC_EXPORT VideoFrameProvider { 25 class CC_EXPORT VideoFrameProvider {
23 public: 26 public:
24 virtual ~VideoFrameProvider() {}
25
26 class CC_EXPORT Client { 27 class CC_EXPORT Client {
27 public: 28 public:
28 // Provider will call this method to tell the client to stop using it. 29 // The provider will call this method to tell the client to stop using it.
29 // StopUsingProvider() may be called from any thread. The client should 30 // StopUsingProvider() may be called from any thread. The client should
xhwang 2015/04/13 20:50:29 This is inconsistent with the previous comment tha
DaleCurtis 2015/04/13 23:15:06 Looks like the current comment is correct, StopUsi
30 // block until it has PutCurrentFrame() any outstanding frames. 31 // block until it has PutCurrentFrame() any outstanding frames.
31 virtual void StopUsingProvider() = 0; 32 virtual void StopUsingProvider() = 0;
32 33
34 // Notifies the client that it should start or stop making regular Render()
35 // calls to the provider. No further calls to Render() will be made after
36 // StopRendering() returns. Clients should handle redundant calls.
xhwang 2015/04/13 20:50:28 Maybe add an example to explain why these are need
DaleCurtis 2015/04/13 23:15:05 Done.
37 virtual void StartRendering() = 0;
38 virtual void StopRendering() = 0;
39
33 // Notifies the provider's client that a call to GetCurrentFrame() will 40 // Notifies the provider's client that a call to GetCurrentFrame() will
xhwang 2015/04/13 20:50:29 nit: s/provider's//?
DaleCurtis 2015/04/13 23:15:05 Done.
34 // return new data. 41 // return new data.
42 // TODO(dalecurtis): Nuke this once VideoFrameProviderClientImpl is using a
43 // BeginFrameObserver based approach. http://crbug.com/336733
xhwang 2015/04/13 20:50:29 What's the relationship b/w this and the return va
DaleCurtis 2015/04/13 23:15:06 Nothing, it's only for the old path. UpdateCurrent
35 virtual void DidReceiveFrame() = 0; 44 virtual void DidReceiveFrame() = 0;
36 45
37 // Notifies the provider's client of a new UV transform matrix to be used. 46 // Notifies the client of a new UV transform matrix to be used.
38 virtual void DidUpdateMatrix(const float* matrix) = 0; 47 virtual void DidUpdateMatrix(const float* matrix) = 0;
39 48
40 protected: 49 protected:
41 virtual ~Client() {} 50 virtual ~Client() {}
42 }; 51 };
43 52
44 // May be called from any thread, but there must be some external guarantee 53 // May be called from any thread, but there must be some external guarantee
45 // that the provider is not destroyed before this call returns. 54 // that the provider is not destroyed before this call returns.
46 virtual void SetVideoFrameProviderClient(Client* client) = 0; 55 virtual void SetVideoFrameProviderClient(Client* client) = 0;
47 56
48 // This function places a lock on the current frame and returns a pointer to 57 // Called by the client on a regular interval. Returns true if a new frame
49 // it. Calls to this method should always be followed with a call to 58 // will be available via GetCurrentFrame() which should be displayed within
50 // PutCurrentFrame(). 59 // the presentation interval [|deadline_min|, |deadline_max|].
xhwang 2015/04/13 20:50:28 nit to double check: Are you sure it's [] instead
DaleCurtis 2015/04/13 23:15:06 Double checked with Sunny, it's [].
xhwang 2015/04/14 00:29:52 Okay, but a bit surprised... I assume cc code will
51 // Only the current provider client should call this function. 60 virtual bool UpdateCurrentFrame(base::TimeTicks deadline_min,
61 base::TimeTicks deadline_max) = 0;
62
63 // Returns the last frame that was acquired during UpdateCurrentFrame(). A
xhwang 2015/04/13 20:50:29 nit: "acquired" is not mentioned in the documentat
DaleCurtis 2015/04/13 23:15:05 I've reworded the text to refer to calling UpdateC
64 // call to this method does not ensure that the frame will be rendered. A
65 // subsequent call to PutCurrentFrame() will be made if the frame is rendered.
52 virtual scoped_refptr<media::VideoFrame> GetCurrentFrame() = 0; 66 virtual scoped_refptr<media::VideoFrame> GetCurrentFrame() = 0;
53 67
54 // This function releases the lock on the video frame. It should always be 68 // Indicates that the frame returned via GetCurrentFrame() was rendered. Must
55 // called after GetCurrentFrame(). Frames passed into this method 69 // only occur after a previous call to GetCurrentFrame().
56 // should no longer be referenced after the call is made. Only the current 70 virtual void PutCurrentFrame() = 0;
xhwang 2015/04/13 20:50:29 nit: This naming is really confusing. It probably
DaleCurtis 2015/04/13 23:15:06 Unfortunately it doesn't necessary mean rendered e
xhwang 2015/04/14 00:29:52 Acknowledged.
57 // provider client should call this function. 71
58 virtual void PutCurrentFrame( 72 protected:
59 const scoped_refptr<media::VideoFrame>& frame) = 0; 73 virtual ~VideoFrameProvider() {}
60 }; 74 };
61 75
62 } // namespace cc 76 } // namespace cc
63 77
64 #endif // CC_LAYERS_VIDEO_FRAME_PROVIDER_H_ 78 #endif // CC_LAYERS_VIDEO_FRAME_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698