Chromium Code Reviews| 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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 351 case media::PIXEL_FORMAT_YUV420P12: | 351 case media::PIXEL_FORMAT_YUV420P12: |
| 352 case media::PIXEL_FORMAT_YUV422P12: | 352 case media::PIXEL_FORMAT_YUV422P12: |
| 353 case media::PIXEL_FORMAT_YUV444P12: | 353 case media::PIXEL_FORMAT_YUV444P12: |
| 354 bits_per_channel = 12; | 354 bits_per_channel = 12; |
| 355 break; | 355 break; |
| 356 case media::PIXEL_FORMAT_Y16: | 356 case media::PIXEL_FORMAT_Y16: |
| 357 bits_per_channel = 16; | 357 bits_per_channel = 16; |
| 358 break; | 358 break; |
| 359 } | 359 } |
| 360 | 360 |
| 361 // TODO(dshwang): support PIXEL_FORMAT_Y16. crbug.com/624436 | 361 // Only YUV and Y16 software video frames are supported. |
| 362 DCHECK_NE(bits_per_channel, 16); | 362 const bool isYuvPlanar = media::IsYuvPlanar(input_frame_format); |
| 363 | 363 if (!(isYuvPlanar || input_frame_format == media::PIXEL_FORMAT_Y16)) { |
| 364 // Only YUV software video frames are supported. | |
| 365 if (!media::IsYuvPlanar(input_frame_format)) { | |
| 366 NOTREACHED() << media::VideoPixelFormatToString(input_frame_format); | 364 NOTREACHED() << media::VideoPixelFormatToString(input_frame_format); |
| 367 return VideoFrameExternalResources(); | 365 return VideoFrameExternalResources(); |
| 368 } | 366 } |
| 369 | 367 |
| 370 const bool software_compositor = context_provider_ == NULL; | 368 const bool software_compositor = context_provider_ == NULL; |
| 371 | 369 |
| 372 ResourceFormat output_resource_format = | 370 ResourceFormat output_resource_format = |
| 373 resource_provider_->YuvResourceFormat(bits_per_channel); | 371 isYuvPlanar ? resource_provider_->YuvResourceFormat(bits_per_channel) |
|
aleksandar.stojiljkovic
2016/10/20 21:52:49
Check above only allows Yuv and Y16, so ResourceFo
| |
| 372 : ResourceFormat::RGBA_8888; | |
| 374 | 373 |
| 375 // If GPU compositing is enabled, but the output resource format | 374 // If GPU compositing is enabled, but the output resource format |
| 376 // returned by the resource provider is RGBA_8888, then a GPU driver | 375 // returned by the resource provider is RGBA_8888, then a GPU driver |
| 377 // bug workaround requires that YUV frames must be converted to RGB | 376 // bug workaround requires that YUV frames must be converted to RGB |
| 378 // before texture upload. | 377 // before texture upload. |
| 379 bool texture_needs_rgb_conversion = | 378 bool texture_needs_rgb_conversion = |
| 380 !software_compositor && | 379 !software_compositor && |
| 381 output_resource_format == ResourceFormat::RGBA_8888; | 380 output_resource_format == ResourceFormat::RGBA_8888; |
| 382 size_t output_plane_count = media::VideoFrame::NumPlanes(input_frame_format); | 381 size_t output_plane_count = media::VideoFrame::NumPlanes(input_frame_format); |
| 383 | 382 |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 763 if (lost_resource) { | 762 if (lost_resource) { |
| 764 resource_it->clear_refs(); | 763 resource_it->clear_refs(); |
| 765 updater->DeleteResource(resource_it); | 764 updater->DeleteResource(resource_it); |
| 766 return; | 765 return; |
| 767 } | 766 } |
| 768 | 767 |
| 769 resource_it->remove_ref(); | 768 resource_it->remove_ref(); |
| 770 } | 769 } |
| 771 | 770 |
| 772 } // namespace cc | 771 } // namespace cc |
| OLD | NEW |