| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "cc/output/gl_renderer.h" | 8 #include "cc/output/gl_renderer.h" |
| 9 #include "cc/resources/resource_provider.h" | 9 #include "cc/resources/resource_provider.h" |
| 10 #include "gpu/GLES2/gl2extchromium.h" | 10 #include "gpu/GLES2/gl2extchromium.h" |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 base::Bind(&RecycleResource, AsWeakPtr(), recycle_data)); | 275 base::Bind(&RecycleResource, AsWeakPtr(), recycle_data)); |
| 276 } | 276 } |
| 277 | 277 |
| 278 external_resources.type = VideoFrameExternalResources::YUV_RESOURCE; | 278 external_resources.type = VideoFrameExternalResources::YUV_RESOURCE; |
| 279 return external_resources; | 279 return external_resources; |
| 280 } | 280 } |
| 281 | 281 |
| 282 static void ReturnTexture(const scoped_refptr<media::VideoFrame>& frame, | 282 static void ReturnTexture(const scoped_refptr<media::VideoFrame>& frame, |
| 283 uint32 sync_point, | 283 uint32 sync_point, |
| 284 bool lost_resource) { | 284 bool lost_resource) { |
| 285 frame->mailbox_holder()->sync_point = sync_point; | 285 frame->AppendReleaseSyncPoint(sync_point); |
| 286 } | 286 } |
| 287 | 287 |
| 288 VideoFrameExternalResources VideoResourceUpdater::CreateForHardwarePlanes( | 288 VideoFrameExternalResources VideoResourceUpdater::CreateForHardwarePlanes( |
| 289 const scoped_refptr<media::VideoFrame>& video_frame) { | 289 const scoped_refptr<media::VideoFrame>& video_frame) { |
| 290 media::VideoFrame::Format frame_format = video_frame->format(); | 290 media::VideoFrame::Format frame_format = video_frame->format(); |
| 291 | 291 |
| 292 DCHECK_EQ(frame_format, media::VideoFrame::NATIVE_TEXTURE); | 292 DCHECK_EQ(frame_format, media::VideoFrame::NATIVE_TEXTURE); |
| 293 if (frame_format != media::VideoFrame::NATIVE_TEXTURE) | 293 if (frame_format != media::VideoFrame::NATIVE_TEXTURE) |
| 294 return VideoFrameExternalResources(); | 294 return VideoFrameExternalResources(); |
| 295 | 295 |
| 296 if (!context_provider_) | 296 if (!context_provider_) |
| 297 return VideoFrameExternalResources(); | 297 return VideoFrameExternalResources(); |
| 298 | 298 |
| 299 gpu::MailboxHolder* mailbox_holder = video_frame->mailbox_holder(); | 299 const gpu::MailboxHolder* mailbox_holder = video_frame->mailbox_holder(); |
| 300 VideoFrameExternalResources external_resources; | 300 VideoFrameExternalResources external_resources; |
| 301 switch (mailbox_holder->texture_target) { | 301 switch (mailbox_holder->texture_target) { |
| 302 case GL_TEXTURE_2D: | 302 case GL_TEXTURE_2D: |
| 303 external_resources.type = VideoFrameExternalResources::RGB_RESOURCE; | 303 external_resources.type = VideoFrameExternalResources::RGB_RESOURCE; |
| 304 break; | 304 break; |
| 305 case GL_TEXTURE_EXTERNAL_OES: | 305 case GL_TEXTURE_EXTERNAL_OES: |
| 306 external_resources.type = | 306 external_resources.type = |
| 307 VideoFrameExternalResources::STREAM_TEXTURE_RESOURCE; | 307 VideoFrameExternalResources::STREAM_TEXTURE_RESOURCE; |
| 308 break; | 308 break; |
| 309 case GL_TEXTURE_RECTANGLE_ARB: | 309 case GL_TEXTURE_RECTANGLE_ARB: |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 } | 354 } |
| 355 | 355 |
| 356 PlaneResource recycled_resource(data.resource_id, | 356 PlaneResource recycled_resource(data.resource_id, |
| 357 data.resource_size, | 357 data.resource_size, |
| 358 data.resource_format, | 358 data.resource_format, |
| 359 data.mailbox); | 359 data.mailbox); |
| 360 updater->recycled_resources_.push_back(recycled_resource); | 360 updater->recycled_resources_.push_back(recycled_resource); |
| 361 } | 361 } |
| 362 | 362 |
| 363 } // namespace cc | 363 } // namespace cc |
| OLD | NEW |