| OLD | NEW |
| 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 "base/time/time.h" |
| 10 #include "cc/base/cc_export.h" | 10 #include "cc/base/cc_export.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 // UpdateCurrentFrame() calls to the provider. No further calls to | 36 // UpdateCurrentFrame() calls to the provider. No further calls to |
| 37 // UpdateCurrentFrame() should be made once StopRendering() returns. | 37 // UpdateCurrentFrame() should be made once StopRendering() returns. |
| 38 // | 38 // |
| 39 // Callers should use these methods to indicate when it expects and no | 39 // Callers should use these methods to indicate when it expects and no |
| 40 // longer expects (respectively) to have new frames for the client. Clients | 40 // longer expects (respectively) to have new frames for the client. Clients |
| 41 // may use this information for power conservation. | 41 // may use this information for power conservation. |
| 42 virtual void StartRendering() = 0; | 42 virtual void StartRendering() = 0; |
| 43 virtual void StopRendering() = 0; | 43 virtual void StopRendering() = 0; |
| 44 | 44 |
| 45 // Notifies the client that GetCurrentFrame() will return new data. | 45 // Notifies the client that GetCurrentFrame() will return new data. |
| 46 // TODO(dalecurtis): Nuke this once VideoFrameProviderClientImpl is using a | |
| 47 // BeginFrameObserver based approach. http://crbug.com/336733 | |
| 48 virtual void DidReceiveFrame() = 0; | 46 virtual void DidReceiveFrame() = 0; |
| 49 | 47 |
| 50 protected: | 48 protected: |
| 51 virtual ~Client() {} | 49 virtual ~Client() {} |
| 52 }; | 50 }; |
| 53 | 51 |
| 54 // May be called from any thread, but there must be some external guarantee | 52 // May be called from any thread, but there must be some external guarantee |
| 55 // that the provider is not destroyed before this call returns. | 53 // that the provider is not destroyed before this call returns. |
| 56 virtual void SetVideoFrameProviderClient(Client* client) = 0; | 54 virtual void SetVideoFrameProviderClient(Client* client) = 0; |
| 57 | 55 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 68 // otherwise. Aside from thread locks, the state won't change. | 66 // otherwise. Aside from thread locks, the state won't change. |
| 69 virtual bool HasCurrentFrame() = 0; | 67 virtual bool HasCurrentFrame() = 0; |
| 70 | 68 |
| 71 // Returns the current frame, which may have been updated by a recent call to | 69 // Returns the current frame, which may have been updated by a recent call to |
| 72 // UpdateCurrentFrame(). A call to this method does not ensure that the frame | 70 // UpdateCurrentFrame(). A call to this method does not ensure that the frame |
| 73 // will be rendered. A subsequent call to PutCurrentFrame() must be made if | 71 // will be rendered. A subsequent call to PutCurrentFrame() must be made if |
| 74 // the frame is expected to be rendered. | 72 // the frame is expected to be rendered. |
| 75 // | 73 // |
| 76 // Clients should call this in response to UpdateCurrentFrame() returning true | 74 // Clients should call this in response to UpdateCurrentFrame() returning true |
| 77 // or in response to a DidReceiveFrame() call. | 75 // or in response to a DidReceiveFrame() call. |
| 78 // | |
| 79 // TODO(dalecurtis): Remove text about DidReceiveFrame() once the old path | |
| 80 // has been removed. http://crbug.com/439548 | |
| 81 virtual scoped_refptr<media::VideoFrame> GetCurrentFrame() = 0; | 76 virtual scoped_refptr<media::VideoFrame> GetCurrentFrame() = 0; |
| 82 | 77 |
| 83 // Called in response to DidReceiveFrame() or a return value of true from | 78 // Called in response to DidReceiveFrame() or a return value of true from |
| 84 // UpdateCurrentFrame() if the current frame was considered for rendering; the | 79 // UpdateCurrentFrame() if the current frame was considered for rendering; the |
| 85 // frame may not been rendered for a variety of reasons (occlusion, etc). | 80 // frame may not been rendered for a variety of reasons (occlusion, etc). |
| 86 // Providers may use the absence of this call as a signal to detect when a new | 81 // Providers may use the absence of this call as a signal to detect when a new |
| 87 // frame missed its intended deadline. | 82 // frame missed its intended deadline. |
| 88 virtual void PutCurrentFrame() = 0; | 83 virtual void PutCurrentFrame() = 0; |
| 89 | 84 |
| 90 protected: | 85 protected: |
| 91 virtual ~VideoFrameProvider() {} | 86 virtual ~VideoFrameProvider() {} |
| 92 }; | 87 }; |
| 93 | 88 |
| 94 } // namespace cc | 89 } // namespace cc |
| 95 | 90 |
| 96 #endif // CC_LAYERS_VIDEO_FRAME_PROVIDER_H_ | 91 #endif // CC_LAYERS_VIDEO_FRAME_PROVIDER_H_ |
| OLD | NEW |