Index: media/gpu/ipc/service/gpu_video_decode_accelerator.cc |
diff --git a/media/gpu/ipc/service/gpu_video_decode_accelerator.cc b/media/gpu/ipc/service/gpu_video_decode_accelerator.cc |
index d26f19a0a213f255ce594dda26d0346e1947ff0d..e2560cf12585e6db194e47025b28cb66f069195f 100644 |
--- a/media/gpu/ipc/service/gpu_video_decode_accelerator.cc |
+++ b/media/gpu/ipc/service/gpu_video_decode_accelerator.cc |
@@ -161,7 +161,6 @@ GpuVideoDecodeAccelerator::GpuVideoDecodeAccelerator( |
const AndroidOverlayMojoFactoryCB& overlay_factory_cb) |
: host_route_id_(host_route_id), |
stub_(stub), |
- texture_target_(0), |
textures_per_buffer_(0), |
filter_removed_(base::WaitableEvent::ResetPolicy::MANUAL, |
base::WaitableEvent::InitialState::NOT_SIGNALED), |
@@ -241,9 +240,7 @@ void GpuVideoDecodeAccelerator::ProvidePictureBuffers( |
DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ProvidePictureBuffers) " |
<< "failed"; |
} |
- texture_dimensions_ = dimensions; |
textures_per_buffer_ = textures_per_buffer; |
- texture_target_ = texture_target; |
} |
void GpuVideoDecodeAccelerator::DismissPictureBuffer( |
@@ -402,7 +399,10 @@ void GpuVideoDecodeAccelerator::OnDecode( |
void GpuVideoDecodeAccelerator::OnAssignPictureBuffers( |
const std::vector<int32_t>& buffer_ids, |
- const std::vector<PictureBuffer::TextureIds>& texture_ids) { |
+ const std::vector<PictureBuffer::TextureIds>& texture_ids, |
+ uint32_t texture_target, |
+ VideoPixelFormat pixel_format, |
+ const gfx::Size& dimensions) { |
if (buffer_ids.size() != texture_ids.size()) { |
NotifyError(VideoDecodeAccelerator::INVALID_ARGUMENT); |
return; |
@@ -439,27 +439,25 @@ void GpuVideoDecodeAccelerator::OnAssignPictureBuffers( |
return; |
} |
gpu::gles2::Texture* info = texture_ref->texture(); |
- if (info->target() != texture_target_) { |
+ if (info->target() != texture_target) { |
DLOG(ERROR) << "Texture target mismatch for texture id " |
<< buffer_texture_ids[j]; |
NotifyError(VideoDecodeAccelerator::INVALID_ARGUMENT); |
return; |
} |
- if (texture_target_ == GL_TEXTURE_EXTERNAL_OES || |
- texture_target_ == GL_TEXTURE_RECTANGLE_ARB) { |
+ if (texture_target == GL_TEXTURE_EXTERNAL_OES || |
+ texture_target == GL_TEXTURE_RECTANGLE_ARB) { |
// These textures have their dimensions defined by the underlying |
// storage. |
- // Use |texture_dimensions_| for this size. |
- texture_manager->SetLevelInfo(texture_ref, texture_target_, 0, GL_RGBA, |
- texture_dimensions_.width(), |
- texture_dimensions_.height(), 1, 0, |
- GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect()); |
+ // Use |dimensions| for this size. |
+ texture_manager->SetLevelInfo( |
+ texture_ref, texture_target, 0, GL_RGBA, dimensions.width(), |
+ dimensions.height(), 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect()); |
} else { |
// For other targets, texture dimensions should already be defined. |
GLsizei width = 0, height = 0; |
- info->GetLevelSize(texture_target_, 0, &width, &height, nullptr); |
- if (width != texture_dimensions_.width() || |
- height != texture_dimensions_.height()) { |
+ info->GetLevelSize(texture_target, 0, &width, &height, nullptr); |
+ if (width != dimensions.width() || height != dimensions.height()) { |
DLOG(ERROR) << "Size mismatch for texture id " |
<< buffer_texture_ids[j]; |
NotifyError(VideoDecodeAccelerator::INVALID_ARGUMENT); |
@@ -471,7 +469,7 @@ void GpuVideoDecodeAccelerator::OnAssignPictureBuffers( |
video_decode_accelerator_.get()->GetSurfaceInternalFormat(); |
if (format != GL_RGBA) { |
DCHECK(format == GL_BGRA_EXT); |
- texture_manager->SetLevelInfo(texture_ref, texture_target_, 0, format, |
+ texture_manager->SetLevelInfo(texture_ref, texture_target, 0, format, |
width, height, 1, 0, format, |
GL_UNSIGNED_BYTE, gfx::Rect()); |
} |
@@ -480,8 +478,9 @@ void GpuVideoDecodeAccelerator::OnAssignPictureBuffers( |
current_textures.push_back(texture_ref); |
} |
textures.push_back(current_textures); |
- buffers.push_back(PictureBuffer(buffer_ids[i], texture_dimensions_, |
- buffer_texture_ids, service_ids)); |
+ buffers.push_back(PictureBuffer(buffer_ids[i], dimensions, |
+ buffer_texture_ids, service_ids, |
+ texture_target, pixel_format)); |
} |
{ |
DebugAutoLock auto_lock(debug_uncleared_textures_lock_); |