| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" | 5 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 gpu::gles2::TextureManager* texture_manager = | 240 gpu::gles2::TextureManager* texture_manager = |
| 241 command_decoder->GetContextGroup()->texture_manager(); | 241 command_decoder->GetContextGroup()->texture_manager(); |
| 242 | 242 |
| 243 std::vector<media::PictureBuffer> buffers; | 243 std::vector<media::PictureBuffer> buffers; |
| 244 for (uint32 i = 0; i < buffer_ids.size(); ++i) { | 244 for (uint32 i = 0; i < buffer_ids.size(); ++i) { |
| 245 if (buffer_ids[i] < 0) { | 245 if (buffer_ids[i] < 0) { |
| 246 DLOG(FATAL) << "Buffer id " << buffer_ids[i] << " out of range"; | 246 DLOG(FATAL) << "Buffer id " << buffer_ids[i] << " out of range"; |
| 247 NotifyError(media::VideoDecodeAccelerator::INVALID_ARGUMENT); | 247 NotifyError(media::VideoDecodeAccelerator::INVALID_ARGUMENT); |
| 248 return; | 248 return; |
| 249 } | 249 } |
| 250 gpu::gles2::Texture* info = texture_manager->GetTexture(texture_ids[i]); | 250 gpu::gles2::TextureRef* texture_ref = texture_manager->GetTexture( |
| 251 if (!info) { | 251 texture_ids[i]); |
| 252 if (!texture_ref) { |
| 252 DLOG(FATAL) << "Failed to find texture id " << texture_ids[i]; | 253 DLOG(FATAL) << "Failed to find texture id " << texture_ids[i]; |
| 253 NotifyError(media::VideoDecodeAccelerator::INVALID_ARGUMENT); | 254 NotifyError(media::VideoDecodeAccelerator::INVALID_ARGUMENT); |
| 254 return; | 255 return; |
| 255 } | 256 } |
| 257 gpu::gles2::Texture* info = texture_ref->texture(); |
| 256 if (info->target() != texture_target_) { | 258 if (info->target() != texture_target_) { |
| 257 DLOG(FATAL) << "Texture target mismatch for texture id " | 259 DLOG(FATAL) << "Texture target mismatch for texture id " |
| 258 << texture_ids[i]; | 260 << texture_ids[i]; |
| 259 NotifyError(media::VideoDecodeAccelerator::INVALID_ARGUMENT); | 261 NotifyError(media::VideoDecodeAccelerator::INVALID_ARGUMENT); |
| 260 return; | 262 return; |
| 261 } | 263 } |
| 262 // GL_TEXTURE_EXTERNAL_OES textures have their dimensions defined by the | 264 // GL_TEXTURE_EXTERNAL_OES textures have their dimensions defined by the |
| 263 // underlying EGLImage. | 265 // underlying EGLImage. |
| 264 if (texture_target_ != GL_TEXTURE_EXTERNAL_OES) { | 266 if (texture_target_ != GL_TEXTURE_EXTERNAL_OES) { |
| 265 GLsizei width = 0, height = 0; | 267 GLsizei width = 0, height = 0; |
| 266 info->GetLevelSize(texture_target_, 0, &width, &height); | 268 info->GetLevelSize(texture_target_, 0, &width, &height); |
| 267 if (width != sizes[i].width() || height != sizes[i].height()) { | 269 if (width != sizes[i].width() || height != sizes[i].height()) { |
| 268 DLOG(FATAL) << "Size mismatch for texture id " << texture_ids[i]; | 270 DLOG(FATAL) << "Size mismatch for texture id " << texture_ids[i]; |
| 269 NotifyError(media::VideoDecodeAccelerator::INVALID_ARGUMENT); | 271 NotifyError(media::VideoDecodeAccelerator::INVALID_ARGUMENT); |
| 270 return; | 272 return; |
| 271 } | 273 } |
| 272 } | 274 } |
| 273 if (!texture_manager->ClearRenderableLevels(command_decoder, info)) { | 275 if (!texture_manager->ClearRenderableLevels(command_decoder, texture_ref)) { |
| 274 DLOG(FATAL) << "Failed to Clear texture id " << texture_ids[i]; | 276 DLOG(FATAL) << "Failed to Clear texture id " << texture_ids[i]; |
| 275 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); | 277 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); |
| 276 return; | 278 return; |
| 277 } | 279 } |
| 278 uint32 service_texture_id; | 280 uint32 service_texture_id; |
| 279 if (!command_decoder->GetServiceTextureId( | 281 if (!command_decoder->GetServiceTextureId( |
| 280 texture_ids[i], &service_texture_id)) { | 282 texture_ids[i], &service_texture_id)) { |
| 281 DLOG(FATAL) << "Failed to translate texture!"; | 283 DLOG(FATAL) << "Failed to translate texture!"; |
| 282 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); | 284 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); |
| 283 return; | 285 return; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 void GpuVideoDecodeAccelerator::OnWillDestroyStub() { | 342 void GpuVideoDecodeAccelerator::OnWillDestroyStub() { |
| 341 delete this; | 343 delete this; |
| 342 } | 344 } |
| 343 | 345 |
| 344 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) { | 346 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) { |
| 345 DCHECK(stub_); | 347 DCHECK(stub_); |
| 346 return stub_->channel()->Send(message); | 348 return stub_->channel()->Send(message); |
| 347 } | 349 } |
| 348 | 350 |
| 349 } // namespace content | 351 } // namespace content |
| OLD | NEW |