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 const bool isYuvPlanar = media::IsYuvPlanar(input_frame_format); |
danakj
2016/10/24 21:46:37
use chromium style please for isYuvPlanar
aleksandar.stojiljkovic
2016/10/25 10:12:28
Done.
| |
433 | 433 if (!(isYuvPlanar || input_frame_format == media::PIXEL_FORMAT_Y16)) { |
434 // Only YUV software video frames are supported. | |
435 if (!media::IsYuvPlanar(input_frame_format)) { | |
436 NOTREACHED() << media::VideoPixelFormatToString(input_frame_format); | 434 NOTREACHED() << media::VideoPixelFormatToString(input_frame_format); |
danakj
2016/10/24 21:46:37
Hm where did this NOTREACHED();return; come from?
aleksandar.stojiljkovic
2016/10/25 10:12:28
NOTREACHED();return; is there from previous code;
| |
437 return VideoFrameExternalResources(); | 435 return VideoFrameExternalResources(); |
438 } | 436 } |
439 | 437 |
440 const bool software_compositor = context_provider_ == NULL; | 438 const bool software_compositor = context_provider_ == NULL; |
441 | 439 |
442 ResourceFormat output_resource_format = | 440 ResourceFormat output_resource_format = |
443 resource_provider_->YuvResourceFormat(bits_per_channel); | 441 isYuvPlanar ? resource_provider_->YuvResourceFormat(bits_per_channel) |
442 : ResourceFormat::RGBA_8888; | |
danakj
2016/10/24 21:46:37
Can you leave a comment explaining this in the con
aleksandar.stojiljkovic
2016/10/25 10:12:28
Done. Thanks.
| |
444 | 443 |
445 // If GPU compositing is enabled, but the output resource format | 444 // If GPU compositing is enabled, but the output resource format |
446 // returned by the resource provider is RGBA_8888, then a GPU driver | 445 // returned by the resource provider is RGBA_8888, then a GPU driver |
447 // bug workaround requires that YUV frames must be converted to RGB | 446 // bug workaround requires that YUV frames must be converted to RGB |
448 // before texture upload. | 447 // before texture upload. |
449 bool texture_needs_rgb_conversion = | 448 bool texture_needs_rgb_conversion = |
450 !software_compositor && | 449 !software_compositor && |
451 output_resource_format == ResourceFormat::RGBA_8888; | 450 output_resource_format == ResourceFormat::RGBA_8888; |
452 size_t output_plane_count = media::VideoFrame::NumPlanes(input_frame_format); | 451 size_t output_plane_count = media::VideoFrame::NumPlanes(input_frame_format); |
453 | 452 |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
801 if (lost_resource) { | 800 if (lost_resource) { |
802 resource_it->clear_refs(); | 801 resource_it->clear_refs(); |
803 updater->DeleteResource(resource_it); | 802 updater->DeleteResource(resource_it); |
804 return; | 803 return; |
805 } | 804 } |
806 | 805 |
807 resource_it->remove_ref(); | 806 resource_it->remove_ref(); |
808 } | 807 } |
809 | 808 |
810 } // namespace cc | 809 } // namespace cc |
OLD | NEW |