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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 DCHECK(!resource_it->has_refs()); | 265 DCHECK(!resource_it->has_refs()); |
266 resource_provider_->DeleteResource(resource_it->resource_id()); | 266 resource_provider_->DeleteResource(resource_it->resource_id()); |
267 all_resources_.erase(resource_it); | 267 all_resources_.erase(resource_it); |
268 } | 268 } |
269 | 269 |
270 VideoFrameExternalResources | 270 VideoFrameExternalResources |
271 VideoResourceUpdater::CreateExternalResourcesFromVideoFrame( | 271 VideoResourceUpdater::CreateExternalResourcesFromVideoFrame( |
272 scoped_refptr<media::VideoFrame> video_frame) { | 272 scoped_refptr<media::VideoFrame> video_frame) { |
273 if (video_frame->format() == media::PIXEL_FORMAT_UNKNOWN) | 273 if (video_frame->format() == media::PIXEL_FORMAT_UNKNOWN) |
274 return VideoFrameExternalResources(); | 274 return VideoFrameExternalResources(); |
| 275 // TODO(astojilj): Support PIXEL_FORMAT_Y16. crbug.com/624436 |
| 276 if (video_frame->format() == media::PIXEL_FORMAT_Y16) |
| 277 return VideoFrameExternalResources(); |
275 DCHECK(video_frame->HasTextures() || video_frame->IsMappable()); | 278 DCHECK(video_frame->HasTextures() || video_frame->IsMappable()); |
276 if (video_frame->HasTextures()) | 279 if (video_frame->HasTextures()) |
277 return CreateForHardwarePlanes(std::move(video_frame)); | 280 return CreateForHardwarePlanes(std::move(video_frame)); |
278 else | 281 else |
279 return CreateForSoftwarePlanes(std::move(video_frame)); | 282 return CreateForSoftwarePlanes(std::move(video_frame)); |
280 } | 283 } |
281 | 284 |
282 // For frames that we receive in software format, determine the dimensions of | 285 // For frames that we receive in software format, determine the dimensions of |
283 // each plane in the frame. | 286 // each plane in the frame. |
284 static gfx::Size SoftwarePlaneDimension(media::VideoFrame* input_frame, | 287 static gfx::Size SoftwarePlaneDimension(media::VideoFrame* input_frame, |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 case media::PIXEL_FORMAT_YUV420P12: | 353 case media::PIXEL_FORMAT_YUV420P12: |
351 case media::PIXEL_FORMAT_YUV422P12: | 354 case media::PIXEL_FORMAT_YUV422P12: |
352 case media::PIXEL_FORMAT_YUV444P12: | 355 case media::PIXEL_FORMAT_YUV444P12: |
353 bits_per_channel = 12; | 356 bits_per_channel = 12; |
354 break; | 357 break; |
355 case media::PIXEL_FORMAT_Y16: | 358 case media::PIXEL_FORMAT_Y16: |
356 bits_per_channel = 16; | 359 bits_per_channel = 16; |
357 break; | 360 break; |
358 } | 361 } |
359 | 362 |
360 // TODO(dshwang): support PIXEL_FORMAT_Y16. crbug.com/624436 | |
361 DCHECK_NE(bits_per_channel, 16); | |
362 | |
363 // Only YUV software video frames are supported. | 363 // Only YUV software video frames are supported. |
364 if (!media::IsYuvPlanar(input_frame_format)) { | 364 if (!media::IsYuvPlanar(input_frame_format)) { |
365 NOTREACHED() << media::VideoPixelFormatToString(input_frame_format); | 365 NOTREACHED() << media::VideoPixelFormatToString(input_frame_format); |
366 return VideoFrameExternalResources(); | 366 return VideoFrameExternalResources(); |
367 } | 367 } |
368 | 368 |
369 const bool software_compositor = context_provider_ == NULL; | 369 const bool software_compositor = context_provider_ == NULL; |
370 | 370 |
371 ResourceFormat output_resource_format = | 371 ResourceFormat output_resource_format = |
372 resource_provider_->YuvResourceFormat(bits_per_channel); | 372 resource_provider_->YuvResourceFormat(bits_per_channel); |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 if (lost_resource) { | 761 if (lost_resource) { |
762 resource_it->clear_refs(); | 762 resource_it->clear_refs(); |
763 updater->DeleteResource(resource_it); | 763 updater->DeleteResource(resource_it); |
764 return; | 764 return; |
765 } | 765 } |
766 | 766 |
767 resource_it->remove_ref(); | 767 resource_it->remove_ref(); |
768 } | 768 } |
769 | 769 |
770 } // namespace cc | 770 } // namespace cc |
OLD | NEW |