Commit 47176547 authored by Geoff Lang's avatar Geoff Lang Committed by Commit Bot

Make sure TextureManager is non-null before querying TextureRefs

GpuVideoDecodeAccelerator already handles the texture manager returning
null TextureRefs to support the passthrough command decoder. Now that
we skip allocating the TextureManager entirely, also protect against it
being null.

BUG=1059068

Change-Id: I2d1d2a3fbf8166002379724ab97eca5082621374
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2140674Reviewed-by: default avatarZhenyao Mo <zmo@chromium.org>
Reviewed-by: default avatarFrank Liberato <liberato@chromium.org>
Commit-Queue: Frank Liberato <liberato@chromium.org>
Cr-Commit-Position: refs/heads/master@{#757445}
parent f3f0c811
...@@ -466,6 +466,7 @@ void GpuVideoDecodeAccelerator::OnAssignPictureBuffers( ...@@ -466,6 +466,7 @@ void GpuVideoDecodeAccelerator::OnAssignPictureBuffers(
return; return;
} }
if (texture_manager) {
gpu::gles2::TextureRef* texture_ref = gpu::gles2::TextureRef* texture_ref =
texture_manager->GetTexture(buffer_texture_ids[j]); texture_manager->GetTexture(buffer_texture_ids[j]);
if (texture_ref) { if (texture_ref) {
...@@ -475,9 +476,9 @@ void GpuVideoDecodeAccelerator::OnAssignPictureBuffers( ...@@ -475,9 +476,9 @@ void GpuVideoDecodeAccelerator::OnAssignPictureBuffers(
// These textures have their dimensions defined by the underlying // These textures have their dimensions defined by the underlying
// storage. // storage.
// Use |texture_dimensions_| for this size. // Use |texture_dimensions_| for this size.
texture_manager->SetLevelInfo(texture_ref, texture_target_, 0, texture_manager->SetLevelInfo(
GL_RGBA, texture_dimensions_.width(), texture_ref, texture_target_, 0, GL_RGBA,
texture_dimensions_.height(), 1, 0, texture_dimensions_.width(), texture_dimensions_.height(), 1, 0,
GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect()); GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect());
} else { } else {
// For other targets, texture dimensions should already be defined. // For other targets, texture dimensions should already be defined.
...@@ -493,7 +494,8 @@ void GpuVideoDecodeAccelerator::OnAssignPictureBuffers( ...@@ -493,7 +494,8 @@ void GpuVideoDecodeAccelerator::OnAssignPictureBuffers(
// TODO(dshwang): after moving to D3D11, remove this. // TODO(dshwang): after moving to D3D11, remove this.
// https://crbug.com/438691 // https://crbug.com/438691
GLenum format = video_decode_accelerator_->GetSurfaceInternalFormat(); GLenum format =
video_decode_accelerator_->GetSurfaceInternalFormat();
if (format != GL_RGBA) { if (format != GL_RGBA) {
DCHECK(format == GL_BGRA_EXT); DCHECK(format == GL_BGRA_EXT);
texture_manager->SetLevelInfo(texture_ref, texture_target_, 0, texture_manager->SetLevelInfo(texture_ref, texture_target_, 0,
...@@ -503,6 +505,7 @@ void GpuVideoDecodeAccelerator::OnAssignPictureBuffers( ...@@ -503,6 +505,7 @@ void GpuVideoDecodeAccelerator::OnAssignPictureBuffers(
} }
current_textures.push_back(texture_ref); current_textures.push_back(texture_ref);
} }
}
service_ids.push_back(texture_base->service_id()); service_ids.push_back(texture_base->service_id());
} }
textures.push_back(current_textures); textures.push_back(current_textures);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment