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 <algorithm> | 10 #include <algorithm> |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 DCHECK_EQ(ref_count_, 1); | 145 DCHECK_EQ(ref_count_, 1); |
146 plane_index_ = plane_index; | 146 plane_index_ = plane_index; |
147 unique_frame_id_ = unique_frame_id; | 147 unique_frame_id_ = unique_frame_id; |
148 has_unique_frame_id_and_plane_index_ = true; | 148 has_unique_frame_id_and_plane_index_ = true; |
149 } | 149 } |
150 | 150 |
151 VideoFrameExternalResources::VideoFrameExternalResources() | 151 VideoFrameExternalResources::VideoFrameExternalResources() |
152 : type(NONE), | 152 : type(NONE), |
153 read_lock_fences_enabled(false), | 153 read_lock_fences_enabled(false), |
154 offset(0.0f), | 154 offset(0.0f), |
155 multiplier(1.0f) {} | 155 multiplier(1.0f), |
| 156 bits_per_channel(8) {} |
156 | 157 |
157 VideoFrameExternalResources::VideoFrameExternalResources( | 158 VideoFrameExternalResources::VideoFrameExternalResources( |
158 const VideoFrameExternalResources& other) = default; | 159 const VideoFrameExternalResources& other) = default; |
159 | 160 |
160 VideoFrameExternalResources::~VideoFrameExternalResources() {} | 161 VideoFrameExternalResources::~VideoFrameExternalResources() {} |
161 | 162 |
162 VideoResourceUpdater::VideoResourceUpdater(ContextProvider* context_provider, | 163 VideoResourceUpdater::VideoResourceUpdater(ContextProvider* context_provider, |
163 ResourceProvider* resource_provider) | 164 ResourceProvider* resource_provider) |
164 : context_provider_(context_provider), | 165 : context_provider_(context_provider), |
165 resource_provider_(resource_provider) { | 166 resource_provider_(resource_provider) { |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 | 369 |
369 if (plane_resources.size() != output_plane_count) { | 370 if (plane_resources.size() != output_plane_count) { |
370 // Allocation failed, nothing will be returned so restore reference counts. | 371 // Allocation failed, nothing will be returned so restore reference counts. |
371 for (ResourceList::iterator resource_it : plane_resources) | 372 for (ResourceList::iterator resource_it : plane_resources) |
372 resource_it->remove_ref(); | 373 resource_it->remove_ref(); |
373 return VideoFrameExternalResources(); | 374 return VideoFrameExternalResources(); |
374 } | 375 } |
375 | 376 |
376 VideoFrameExternalResources external_resources; | 377 VideoFrameExternalResources external_resources; |
377 | 378 |
| 379 external_resources.bits_per_channel = bits_per_channel; |
| 380 |
378 if (software_compositor) { | 381 if (software_compositor) { |
379 DCHECK_EQ(plane_resources.size(), 1u); | 382 DCHECK_EQ(plane_resources.size(), 1u); |
380 PlaneResource& plane_resource = *plane_resources[0]; | 383 PlaneResource& plane_resource = *plane_resources[0]; |
381 DCHECK_EQ(plane_resource.resource_format(), kRGBResourceFormat); | 384 DCHECK_EQ(plane_resource.resource_format(), kRGBResourceFormat); |
382 DCHECK(plane_resource.mailbox().IsZero()); | 385 DCHECK(plane_resource.mailbox().IsZero()); |
383 | 386 |
384 if (!plane_resource.Matches(video_frame->unique_id(), 0)) { | 387 if (!plane_resource.Matches(video_frame->unique_id(), 0)) { |
385 // We need to transfer data from |video_frame| to the plane resource. | 388 // We need to transfer data from |video_frame| to the plane resource. |
386 if (!video_renderer_) | 389 if (!video_renderer_) |
387 video_renderer_.reset(new media::SkCanvasVideoRenderer); | 390 video_renderer_.reset(new media::SkCanvasVideoRenderer); |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 if (lost_resource) { | 695 if (lost_resource) { |
693 resource_it->clear_refs(); | 696 resource_it->clear_refs(); |
694 updater->DeleteResource(resource_it); | 697 updater->DeleteResource(resource_it); |
695 return; | 698 return; |
696 } | 699 } |
697 | 700 |
698 resource_it->remove_ref(); | 701 resource_it->remove_ref(); |
699 } | 702 } |
700 | 703 |
701 } // namespace cc | 704 } // namespace cc |
OLD | NEW |