Chromium Code Reviews| Index: ui/gfx/mac/io_surface.cc |
| diff --git a/ui/gfx/mac/io_surface.cc b/ui/gfx/mac/io_surface.cc |
| index 52fe6014ea15d0a605e2cc7ddacfbdd2e135fd95..3dff42c52fb612f45814763bca923211c7369ef0 100644 |
| --- a/ui/gfx/mac/io_surface.cc |
| +++ b/ui/gfx/mac/io_surface.cc |
| @@ -164,6 +164,20 @@ IOSurfaceRef CreateIOSurface(const gfx::Size& size, gfx::BufferFormat format) { |
| DCHECK_EQ(kIOReturnSuccess, r); |
| } |
| + // Displaying an IOSurface that does not have a color space using an |
| + // AVSampleBufferDisplayLayer can result in a black screen. Specify the |
| + // main display's color profile by default, which will result in no color |
| + // correction being done for the main monitor (which is the behavior of not |
| + // specifying a color space). |
| + // https://crbug.com/608879 |
| + if (format == gfx::BufferFormat::YUV_420_BIPLANAR) { |
| + base::ScopedCFTypeRef<CGColorSpaceRef> color_space( |
| + CGDisplayCopyColorSpace(CGMainDisplayID())); |
| + base::ScopedCFTypeRef<CFDataRef> color_space_icc( |
| + CGColorSpaceCopyICCProfile(color_space)); |
|
erikchen
2016/05/04 18:14:45
CGColorSpaceCopyICCProfile might return NULL. I th
ccameron
2016/05/05 18:50:01
I tested passing NULL to IOSurfaceSetValue, and it
erikchen
2016/05/05 19:11:55
Ok, just add a comment about NULL a valid paramete
|
| + IOSurfaceSetValue(surface, CFSTR("IOSurfaceColorSpace"), color_space_icc); |
| + } |
| + |
| return surface; |
| } |