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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 case media::PIXEL_FORMAT_YUV420P12: | 421 case media::PIXEL_FORMAT_YUV420P12: |
422 case media::PIXEL_FORMAT_YUV422P12: | 422 case media::PIXEL_FORMAT_YUV422P12: |
423 case media::PIXEL_FORMAT_YUV444P12: | 423 case media::PIXEL_FORMAT_YUV444P12: |
424 bits_per_channel = 12; | 424 bits_per_channel = 12; |
425 break; | 425 break; |
426 case media::PIXEL_FORMAT_Y16: | 426 case media::PIXEL_FORMAT_Y16: |
427 bits_per_channel = 16; | 427 bits_per_channel = 16; |
428 break; | 428 break; |
429 } | 429 } |
430 | 430 |
431 // TODO(dshwang): support PIXEL_FORMAT_Y16. crbug.com/624436 | 431 // Only YUV and Y16 software video frames are supported. |
432 DCHECK_NE(bits_per_channel, 16); | 432 DCHECK(media::IsYuvPlanar(input_frame_format) || |
433 | 433 input_frame_format == media::PIXEL_FORMAT_Y16); |
434 // Only YUV software video frames are supported. | |
435 DCHECK(media::IsYuvPlanar(input_frame_format)); | |
436 | 434 |
437 const bool software_compositor = context_provider_ == NULL; | 435 const bool software_compositor = context_provider_ == NULL; |
438 | 436 |
439 ResourceFormat output_resource_format = | 437 ResourceFormat output_resource_format; |
440 resource_provider_->YuvResourceFormat(bits_per_channel); | 438 if (input_frame_format == media::PIXEL_FORMAT_Y16) { |
| 439 // Unable to display directly as yuv planes so convert it to RGBA for |
| 440 // compositing. |
| 441 output_resource_format = RGBA_8888; |
| 442 } else { |
| 443 // Can be composited directly from yuv planes. |
| 444 output_resource_format = |
| 445 resource_provider_->YuvResourceFormat(bits_per_channel); |
| 446 } |
441 | 447 |
442 // If GPU compositing is enabled, but the output resource format | 448 // If GPU compositing is enabled, but the output resource format |
443 // returned by the resource provider is RGBA_8888, then a GPU driver | 449 // returned by the resource provider is RGBA_8888, then a GPU driver |
444 // bug workaround requires that YUV frames must be converted to RGB | 450 // bug workaround requires that YUV frames must be converted to RGB |
445 // before texture upload. | 451 // before texture upload. |
446 bool texture_needs_rgb_conversion = | 452 bool texture_needs_rgb_conversion = |
447 !software_compositor && | 453 !software_compositor && |
448 output_resource_format == ResourceFormat::RGBA_8888; | 454 output_resource_format == ResourceFormat::RGBA_8888; |
449 size_t output_plane_count = media::VideoFrame::NumPlanes(input_frame_format); | 455 size_t output_plane_count = media::VideoFrame::NumPlanes(input_frame_format); |
450 | 456 |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 if (lost_resource) { | 804 if (lost_resource) { |
799 resource_it->clear_refs(); | 805 resource_it->clear_refs(); |
800 updater->DeleteResource(resource_it); | 806 updater->DeleteResource(resource_it); |
801 return; | 807 return; |
802 } | 808 } |
803 | 809 |
804 resource_it->remove_ref(); | 810 resource_it->remove_ref(); |
805 } | 811 } |
806 | 812 |
807 } // namespace cc | 813 } // namespace cc |
OLD | NEW |