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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 void VideoResourceUpdater::SetPlaneResourceUniqueId( | 79 void VideoResourceUpdater::SetPlaneResourceUniqueId( |
80 const media::VideoFrame* video_frame, | 80 const media::VideoFrame* video_frame, |
81 size_t plane_index, | 81 size_t plane_index, |
82 PlaneResource* plane_resource) { | 82 PlaneResource* plane_resource) { |
83 plane_resource->frame_ptr = video_frame; | 83 plane_resource->frame_ptr = video_frame; |
84 plane_resource->plane_index = plane_index; | 84 plane_resource->plane_index = plane_index; |
85 plane_resource->timestamp = video_frame->timestamp(); | 85 plane_resource->timestamp = video_frame->timestamp(); |
86 } | 86 } |
87 | 87 |
88 VideoFrameExternalResources::VideoFrameExternalResources() : type(NONE) {} | 88 VideoFrameExternalResources::VideoFrameExternalResources() |
| 89 : type(NONE), read_lock_fences_enabled(false) { |
| 90 } |
89 | 91 |
90 VideoFrameExternalResources::~VideoFrameExternalResources() {} | 92 VideoFrameExternalResources::~VideoFrameExternalResources() {} |
91 | 93 |
92 VideoResourceUpdater::VideoResourceUpdater(ContextProvider* context_provider, | 94 VideoResourceUpdater::VideoResourceUpdater(ContextProvider* context_provider, |
93 ResourceProvider* resource_provider) | 95 ResourceProvider* resource_provider) |
94 : context_provider_(context_provider), | 96 : context_provider_(context_provider), |
95 resource_provider_(resource_provider) { | 97 resource_provider_(resource_provider) { |
96 } | 98 } |
97 | 99 |
98 VideoResourceUpdater::~VideoResourceUpdater() { | 100 VideoResourceUpdater::~VideoResourceUpdater() { |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 VideoFrameExternalResources VideoResourceUpdater::CreateForHardwarePlanes( | 368 VideoFrameExternalResources VideoResourceUpdater::CreateForHardwarePlanes( |
367 const scoped_refptr<media::VideoFrame>& video_frame) { | 369 const scoped_refptr<media::VideoFrame>& video_frame) { |
368 TRACE_EVENT0("cc", "VideoResourceUpdater::CreateForHardwarePlanes"); | 370 TRACE_EVENT0("cc", "VideoResourceUpdater::CreateForHardwarePlanes"); |
369 DCHECK(video_frame->HasTextures()); | 371 DCHECK(video_frame->HasTextures()); |
370 if (!context_provider_) | 372 if (!context_provider_) |
371 return VideoFrameExternalResources(); | 373 return VideoFrameExternalResources(); |
372 | 374 |
373 const size_t textures = media::VideoFrame::NumPlanes(video_frame->format()); | 375 const size_t textures = media::VideoFrame::NumPlanes(video_frame->format()); |
374 DCHECK_GE(textures, 1u); | 376 DCHECK_GE(textures, 1u); |
375 VideoFrameExternalResources external_resources; | 377 VideoFrameExternalResources external_resources; |
| 378 external_resources.read_lock_fences_enabled = true; |
376 switch (video_frame->format()) { | 379 switch (video_frame->format()) { |
377 case media::VideoFrame::ARGB: | 380 case media::VideoFrame::ARGB: |
378 case media::VideoFrame::XRGB: | 381 case media::VideoFrame::XRGB: |
379 DCHECK_EQ(1u, textures); | 382 DCHECK_EQ(1u, textures); |
380 switch (video_frame->mailbox_holder(0).texture_target) { | 383 switch (video_frame->mailbox_holder(0).texture_target) { |
381 case GL_TEXTURE_2D: | 384 case GL_TEXTURE_2D: |
382 external_resources.type = | 385 external_resources.type = |
383 (video_frame->format() == media::VideoFrame::XRGB) | 386 (video_frame->format() == media::VideoFrame::XRGB) |
384 ? VideoFrameExternalResources::RGB_RESOURCE | 387 ? VideoFrameExternalResources::RGB_RESOURCE |
385 : VideoFrameExternalResources::RGBA_RESOURCE; | 388 : VideoFrameExternalResources::RGBA_RESOURCE; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 resource_it->ref_count = 0; | 458 resource_it->ref_count = 0; |
456 updater->DeleteResource(resource_it); | 459 updater->DeleteResource(resource_it); |
457 return; | 460 return; |
458 } | 461 } |
459 | 462 |
460 --resource_it->ref_count; | 463 --resource_it->ref_count; |
461 DCHECK_GE(resource_it->ref_count, 0); | 464 DCHECK_GE(resource_it->ref_count, 0); |
462 } | 465 } |
463 | 466 |
464 } // namespace cc | 467 } // namespace cc |
OLD | NEW |