| Index: ui/gl/gl_image_io_surface.mm
|
| diff --git a/ui/gl/gl_image_io_surface.mm b/ui/gl/gl_image_io_surface.mm
|
| index 9c31c07b3efc4e845db4d87025a9853dbaa7d94b..3059333cc8896feb96c15f2b4147e3e927a3f417 100644
|
| --- a/ui/gl/gl_image_io_surface.mm
|
| +++ b/ui/gl/gl_image_io_surface.mm
|
| @@ -6,9 +6,7 @@
|
|
|
| #include <map>
|
|
|
| -#include "base/callback_helpers.h"
|
| #include "base/lazy_instance.h"
|
| -#include "base/mac/bind_objc_block.h"
|
| #include "base/mac/foundation_util.h"
|
| #include "base/strings/stringize_macros.h"
|
| #include "base/strings/stringprintf.h"
|
| @@ -232,6 +230,7 @@
|
| glDeleteShader(fragment_shader_);
|
| glDeleteBuffersARB(1, &vertex_buffer_);
|
| glDeleteFramebuffersEXT(1, &framebuffer_);
|
| + glDeleteTextures(2, yuv_textures_);
|
| }
|
| io_surface_.reset();
|
| }
|
| @@ -285,19 +284,6 @@
|
| LOG(ERROR) << "YUV_420_BIPLANAR requires GL_TEXTURE_RECTANGLE_ARB target";
|
| return false;
|
| }
|
| -
|
| - // Ensure that all textures bound to IOSurfaces be destroyed before the
|
| - // function exits. If they are not destroyed they may cause deadlocks between
|
| - // VTDecompressionSession at CGLContextDestroy.
|
| - // https://crbug.com/598388
|
| - unsigned y_texture = 0;
|
| - glGenTextures(1, &y_texture);
|
| - unsigned uv_texture = 0;
|
| - glGenTextures(1, &uv_texture);
|
| - base::ScopedClosureRunner destroy_resources_runner(base::BindBlock(^{
|
| - glDeleteTextures(1, &y_texture);
|
| - glDeleteTextures(1, &uv_texture);
|
| - }));
|
|
|
| if (!framebuffer_) {
|
| glGenFramebuffersEXT(1, &framebuffer_);
|
| @@ -322,6 +308,10 @@
|
|
|
| glUniform1i(y_sampler_location, 0);
|
| glUniform1i(uv_sampler_location, 1);
|
| +
|
| + glGenTextures(2, yuv_textures_);
|
| + DCHECK(yuv_textures_[0]);
|
| + DCHECK(yuv_textures_[1]);
|
| }
|
|
|
| CGLContextObj cgl_context =
|
| @@ -339,7 +329,7 @@
|
|
|
| gfx::ScopedActiveTexture active_texture0(GL_TEXTURE0);
|
| gfx::ScopedTextureBinder texture_y_binder(GL_TEXTURE_RECTANGLE_ARB,
|
| - y_texture);
|
| + yuv_textures_[0]);
|
| cgl_error = CGLTexImageIOSurface2D(
|
| cgl_context, GL_TEXTURE_RECTANGLE_ARB, GL_RED, size_.width(),
|
| size_.height(), GL_RED, GL_UNSIGNED_BYTE, io_surface_.get(), 0);
|
| @@ -351,7 +341,7 @@
|
| {
|
| gfx::ScopedActiveTexture active_texture1(GL_TEXTURE1);
|
| gfx::ScopedTextureBinder texture_uv_binder(GL_TEXTURE_RECTANGLE_ARB,
|
| - uv_texture);
|
| + yuv_textures_[1]);
|
| cgl_error = CGLTexImageIOSurface2D(
|
| cgl_context, GL_TEXTURE_RECTANGLE_ARB, GL_RG, size_.width() / 2,
|
| size_.height() / 2, GL_RG, GL_UNSIGNED_BYTE, io_surface_.get(), 1);
|
|
|