| Index: cc/resources/video_resource_updater.cc
|
| diff --git a/cc/resources/video_resource_updater.cc b/cc/resources/video_resource_updater.cc
|
| index 2ad91ae0674558bb9ad7f5963aa68c50d6554c38..842a6f2310a9b668797224433796e49a388af7c9 100644
|
| --- a/cc/resources/video_resource_updater.cc
|
| +++ b/cc/resources/video_resource_updater.cc
|
| @@ -11,6 +11,7 @@
|
|
|
| #include "base/bind.h"
|
| #include "base/bit_cast.h"
|
| +#include "base/feature_list.h"
|
| #include "base/trace_event/trace_event.h"
|
| #include "cc/base/math_util.h"
|
| #include "cc/output/gl_renderer.h"
|
| @@ -19,6 +20,7 @@
|
| #include "cc/resources/resource_util.h"
|
| #include "gpu/GLES2/gl2extchromium.h"
|
| #include "gpu/command_buffer/client/gles2_interface.h"
|
| +#include "media/base/media_switches.h"
|
| #include "media/base/video_frame.h"
|
| #include "media/renderers/skcanvas_video_renderer.h"
|
| #include "third_party/khronos/GLES2/gl2.h"
|
| @@ -381,6 +383,20 @@ VideoResourceUpdater::NewHalfFloatMaker(int bits_per_channel) {
|
| }
|
| }
|
|
|
| +gfx::ColorSpace VideoResourceUpdater::GetColorSpace(
|
| + media::VideoFrame* video_frame) {
|
| + int videoframe_color_space;
|
| + if (video_frame->metadata()->GetInteger(
|
| + media::VideoFrameMetadata::COLOR_SPACE, &videoframe_color_space)) {
|
| + if (videoframe_color_space == media::COLOR_SPACE_JPEG) {
|
| + return gfx::ColorSpace::CreateJpeg();
|
| + } else if (videoframe_color_space == media::COLOR_SPACE_HD_REC709) {
|
| + return gfx::ColorSpace::CreateREC709();
|
| + }
|
| + }
|
| + return gfx::ColorSpace::CreateREC601();
|
| +}
|
| +
|
| VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes(
|
| scoped_refptr<media::VideoFrame> video_frame) {
|
| TRACE_EVENT0("cc", "VideoResourceUpdater::CreateForSoftwarePlanes");
|
| @@ -526,6 +542,9 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes(
|
| external_resources.multiplier = half_float_maker->Multiplier();
|
| }
|
|
|
| + if (!base::FeatureList::IsEnabled(media::kVideoColorManagement))
|
| + output_color_space = GetColorSpace(video_frame.get());
|
| +
|
| for (size_t i = 0; i < plane_resources.size(); ++i) {
|
| PlaneResource& plane_resource = *plane_resources[i];
|
| // Update each plane's resource id with its content.
|
| @@ -713,8 +732,11 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForHardwarePlanes(
|
| << media::VideoPixelFormatToString(video_frame->format());
|
| return external_resources;
|
| }
|
| - if (external_resources.type == VideoFrameExternalResources::YUV_RESOURCE)
|
| + if (external_resources.type == VideoFrameExternalResources::YUV_RESOURCE) {
|
| resource_color_space = resource_color_space.GetAsFullRangeRGB();
|
| + if (!base::FeatureList::IsEnabled(media::kVideoColorManagement))
|
| + resource_color_space = GetColorSpace(video_frame.get());
|
| + }
|
|
|
| const size_t num_planes = media::VideoFrame::NumPlanes(video_frame->format());
|
| for (size_t i = 0; i < num_planes; ++i) {
|
|
|