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 #include "cc/resources/video_resource_updater.h" | 5 #include "cc/resources/video_resource_updater.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "cc/resources/resource_provider.h" | 10 #include "cc/resources/resource_provider.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 static void ReleaseMailboxCB(const gpu::SyncToken& sync_token) {} | 121 static void ReleaseMailboxCB(const gpu::SyncToken& sync_token) {} |
122 | 122 |
123 scoped_refptr<media::VideoFrame> CreateTestHardwareVideoFrame( | 123 scoped_refptr<media::VideoFrame> CreateTestHardwareVideoFrame( |
124 unsigned target) { | 124 unsigned target) { |
125 const int kDimension = 10; | 125 const int kDimension = 10; |
126 gfx::Size size(kDimension, kDimension); | 126 gfx::Size size(kDimension, kDimension); |
127 | 127 |
128 gpu::Mailbox mailbox; | 128 gpu::Mailbox mailbox; |
129 mailbox.name[0] = 51; | 129 mailbox.name[0] = 51; |
130 | 130 |
131 const gpu::SyncToken sync_token(7); | 131 const gpu::SyncToken sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, |
| 132 0x123, 7); |
132 scoped_refptr<media::VideoFrame> video_frame = | 133 scoped_refptr<media::VideoFrame> video_frame = |
133 media::VideoFrame::WrapNativeTexture( | 134 media::VideoFrame::WrapNativeTexture( |
134 media::PIXEL_FORMAT_ARGB, | 135 media::PIXEL_FORMAT_ARGB, |
135 gpu::MailboxHolder(mailbox, sync_token, target), | 136 gpu::MailboxHolder(mailbox, sync_token, target), |
136 base::Bind(&ReleaseMailboxCB), | 137 base::Bind(&ReleaseMailboxCB), |
137 size, // coded_size | 138 size, // coded_size |
138 gfx::Rect(size), // visible_rect | 139 gfx::Rect(size), // visible_rect |
139 size, // natural_size | 140 size, // natural_size |
140 base::TimeDelta()); // timestamp | 141 base::TimeDelta()); // timestamp |
141 EXPECT_TRUE(video_frame); | 142 EXPECT_TRUE(video_frame); |
(...skipping 15 matching lines...) Expand all Loading... |
157 | 158 |
158 scoped_refptr<media::VideoFrame> CreateTestYUVHardareVideoFrame() { | 159 scoped_refptr<media::VideoFrame> CreateTestYUVHardareVideoFrame() { |
159 const int kDimension = 10; | 160 const int kDimension = 10; |
160 gfx::Size size(kDimension, kDimension); | 161 gfx::Size size(kDimension, kDimension); |
161 | 162 |
162 const int kPlanesNum = 3; | 163 const int kPlanesNum = 3; |
163 gpu::Mailbox mailbox[kPlanesNum]; | 164 gpu::Mailbox mailbox[kPlanesNum]; |
164 for (int i = 0; i < kPlanesNum; ++i) { | 165 for (int i = 0; i < kPlanesNum; ++i) { |
165 mailbox[i].name[0] = 50 + 1; | 166 mailbox[i].name[0] = 50 + 1; |
166 } | 167 } |
167 const gpu::SyncToken sync_token(7); | 168 const gpu::SyncToken sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, |
| 169 0x123, 7); |
168 const unsigned target = GL_TEXTURE_RECTANGLE_ARB; | 170 const unsigned target = GL_TEXTURE_RECTANGLE_ARB; |
169 scoped_refptr<media::VideoFrame> video_frame = | 171 scoped_refptr<media::VideoFrame> video_frame = |
170 media::VideoFrame::WrapYUV420NativeTextures( | 172 media::VideoFrame::WrapYUV420NativeTextures( |
171 gpu::MailboxHolder(mailbox[media::VideoFrame::kYPlane], sync_token, | 173 gpu::MailboxHolder(mailbox[media::VideoFrame::kYPlane], sync_token, |
172 target), | 174 target), |
173 gpu::MailboxHolder(mailbox[media::VideoFrame::kUPlane], sync_token, | 175 gpu::MailboxHolder(mailbox[media::VideoFrame::kUPlane], sync_token, |
174 target), | 176 target), |
175 gpu::MailboxHolder(mailbox[media::VideoFrame::kVPlane], sync_token, | 177 gpu::MailboxHolder(mailbox[media::VideoFrame::kVPlane], sync_token, |
176 target), | 178 target), |
177 base::Bind(&ReleaseMailboxCB), | 179 base::Bind(&ReleaseMailboxCB), |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 resources = updater.CreateExternalResourcesFromVideoFrame(video_frame); | 380 resources = updater.CreateExternalResourcesFromVideoFrame(video_frame); |
379 EXPECT_EQ(VideoFrameExternalResources::RGBA_RESOURCE, resources.type); | 381 EXPECT_EQ(VideoFrameExternalResources::RGBA_RESOURCE, resources.type); |
380 EXPECT_EQ(1u, resources.mailboxes.size()); | 382 EXPECT_EQ(1u, resources.mailboxes.size()); |
381 EXPECT_EQ((GLenum)GL_TEXTURE_2D, resources.mailboxes[0].target()); | 383 EXPECT_EQ((GLenum)GL_TEXTURE_2D, resources.mailboxes[0].target()); |
382 EXPECT_EQ(1u, resources.release_callbacks.size()); | 384 EXPECT_EQ(1u, resources.release_callbacks.size()); |
383 EXPECT_EQ(0u, resources.software_resources.size()); | 385 EXPECT_EQ(0u, resources.software_resources.size()); |
384 EXPECT_EQ(1, context3d_->TextureCreationCount()); | 386 EXPECT_EQ(1, context3d_->TextureCreationCount()); |
385 } | 387 } |
386 } // namespace | 388 } // namespace |
387 } // namespace cc | 389 } // namespace cc |
OLD | NEW |