Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ | 5 #ifndef CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ |
| 6 #define CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ | 6 #define CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 PlaneResource(unsigned resource_id, | 104 PlaneResource(unsigned resource_id, |
| 105 const gfx::Size& resource_size, | 105 const gfx::Size& resource_size, |
| 106 ResourceFormat resource_format, | 106 ResourceFormat resource_format, |
| 107 gpu::Mailbox mailbox); | 107 gpu::Mailbox mailbox); |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 static bool PlaneResourceMatchesUniqueID(const PlaneResource& plane_resource, | 110 static bool PlaneResourceMatchesUniqueID(const PlaneResource& plane_resource, |
| 111 const media::VideoFrame* video_frame, | 111 const media::VideoFrame* video_frame, |
| 112 size_t plane_index); | 112 size_t plane_index); |
| 113 | 113 |
| 114 static void SetPlaneResourceUniqueId(const media::VideoFrame* video_frame, | 114 // Side effect: Sets RESOURCE_UPDATER_FLAG boolean in the video frame's |
| 115 // metadata. This is used to prevent reusing the resource in the case that | |
| 116 // the original VideoFrame is destroyed and a new VideoFrame is re-created | |
| 117 // with the same pointer and the timestamps are all set to zero (or not set) | |
| 118 // by the client. | |
|
xhwang
2016/02/23 17:48:51
One question: Is it possible to require the timest
xjz
2016/02/23 23:53:15
It is difficult to check whether the timestamp is
| |
| 119 static void SetPlaneResourceUniqueId(media::VideoFrame* video_frame, | |
| 115 size_t plane_index, | 120 size_t plane_index, |
| 116 PlaneResource* plane_resource); | 121 PlaneResource* plane_resource); |
| 117 | 122 |
| 118 // This needs to be a container where iterators can be erased without | 123 // This needs to be a container where iterators can be erased without |
| 119 // invalidating other iterators. | 124 // invalidating other iterators. |
| 120 typedef std::list<PlaneResource> ResourceList; | 125 typedef std::list<PlaneResource> ResourceList; |
| 121 ResourceList::iterator AllocateResource(const gfx::Size& plane_size, | 126 ResourceList::iterator AllocateResource(const gfx::Size& plane_size, |
| 122 ResourceFormat format, | 127 ResourceFormat format, |
| 123 bool has_mailbox, | 128 bool has_mailbox, |
| 124 bool immutable_hint); | 129 bool immutable_hint); |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 151 // Recycle resources so that we can reduce the number of allocations and | 156 // Recycle resources so that we can reduce the number of allocations and |
| 152 // data transfers. | 157 // data transfers. |
| 153 ResourceList all_resources_; | 158 ResourceList all_resources_; |
| 154 | 159 |
| 155 DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater); | 160 DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater); |
| 156 }; | 161 }; |
| 157 | 162 |
| 158 } // namespace cc | 163 } // namespace cc |
| 159 | 164 |
| 160 #endif // CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ | 165 #endif // CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ |
| OLD | NEW |