| 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 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 if (info->target() != texture_target_) { | 472 if (info->target() != texture_target_) { |
| 473 DLOG(ERROR) << "Texture target mismatch for texture id " | 473 DLOG(ERROR) << "Texture target mismatch for texture id " |
| 474 << texture_ids[i]; | 474 << texture_ids[i]; |
| 475 NotifyError(media::VideoDecodeAccelerator::INVALID_ARGUMENT); | 475 NotifyError(media::VideoDecodeAccelerator::INVALID_ARGUMENT); |
| 476 return; | 476 return; |
| 477 } | 477 } |
| 478 if (texture_target_ == GL_TEXTURE_EXTERNAL_OES || | 478 if (texture_target_ == GL_TEXTURE_EXTERNAL_OES || |
| 479 texture_target_ == GL_TEXTURE_RECTANGLE_ARB) { | 479 texture_target_ == GL_TEXTURE_RECTANGLE_ARB) { |
| 480 // These textures have their dimensions defined by the underlying storage. | 480 // These textures have their dimensions defined by the underlying storage. |
| 481 // Use |texture_dimensions_| for this size. | 481 // Use |texture_dimensions_| for this size. |
| 482 texture_manager->SetLevelInfo(texture_ref, | 482 texture_manager->SetLevelInfo( |
| 483 texture_target_, | 483 texture_ref, texture_target_, 0, GL_RGBA, texture_dimensions_.width(), |
| 484 0, | 484 texture_dimensions_.height(), 1, 0, GL_RGBA, 0, gfx::Rect()); |
| 485 GL_RGBA, | |
| 486 texture_dimensions_.width(), | |
| 487 texture_dimensions_.height(), | |
| 488 1, | |
| 489 0, | |
| 490 GL_RGBA, | |
| 491 0, | |
| 492 false); | |
| 493 } else { | 485 } else { |
| 494 // For other targets, texture dimensions should already be defined. | 486 // For other targets, texture dimensions should already be defined. |
| 495 GLsizei width = 0, height = 0; | 487 GLsizei width = 0, height = 0; |
| 496 info->GetLevelSize(texture_target_, 0, &width, &height, nullptr); | 488 info->GetLevelSize(texture_target_, 0, &width, &height, nullptr); |
| 497 if (width != texture_dimensions_.width() || | 489 if (width != texture_dimensions_.width() || |
| 498 height != texture_dimensions_.height()) { | 490 height != texture_dimensions_.height()) { |
| 499 DLOG(ERROR) << "Size mismatch for texture id " << texture_ids[i]; | 491 DLOG(ERROR) << "Size mismatch for texture id " << texture_ids[i]; |
| 500 NotifyError(media::VideoDecodeAccelerator::INVALID_ARGUMENT); | 492 NotifyError(media::VideoDecodeAccelerator::INVALID_ARGUMENT); |
| 501 return; | 493 return; |
| 502 } | 494 } |
| 503 | 495 |
| 504 // TODO(dshwang): after moving to D3D11, remove this. crbug.com/438691 | 496 // TODO(dshwang): after moving to D3D11, remove this. crbug.com/438691 |
| 505 GLenum format = | 497 GLenum format = |
| 506 video_decode_accelerator_.get()->GetSurfaceInternalFormat(); | 498 video_decode_accelerator_.get()->GetSurfaceInternalFormat(); |
| 507 if (format != GL_RGBA) { | 499 if (format != GL_RGBA) { |
| 508 texture_manager->SetLevelInfo(texture_ref, texture_target_, 0, format, | 500 texture_manager->SetLevelInfo(texture_ref, texture_target_, 0, format, |
| 509 width, height, 1, 0, format, 0, false); | 501 width, height, 1, 0, format, 0, |
| 502 gfx::Rect()); |
| 510 } | 503 } |
| 511 } | 504 } |
| 512 buffers.push_back(media::PictureBuffer(buffer_ids[i], texture_dimensions_, | 505 buffers.push_back(media::PictureBuffer(buffer_ids[i], texture_dimensions_, |
| 513 texture_ref->service_id(), | 506 texture_ref->service_id(), |
| 514 texture_ids[i])); | 507 texture_ids[i])); |
| 515 textures.push_back(texture_ref); | 508 textures.push_back(texture_ref); |
| 516 } | 509 } |
| 517 video_decode_accelerator_->AssignPictureBuffers(buffers); | 510 video_decode_accelerator_->AssignPictureBuffers(buffers); |
| 518 DebugAutoLock auto_lock(debug_uncleared_textures_lock_); | 511 DebugAutoLock auto_lock(debug_uncleared_textures_lock_); |
| 519 for (uint32 i = 0; i < buffer_ids.size(); ++i) | 512 for (uint32 i = 0; i < buffer_ids.size(); ++i) |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 return stub_->channel()->Send(message); | 606 return stub_->channel()->Send(message); |
| 614 } | 607 } |
| 615 | 608 |
| 616 void GpuVideoDecodeAccelerator::SendCreateDecoderReply(IPC::Message* message, | 609 void GpuVideoDecodeAccelerator::SendCreateDecoderReply(IPC::Message* message, |
| 617 bool succeeded) { | 610 bool succeeded) { |
| 618 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(message, succeeded); | 611 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(message, succeeded); |
| 619 Send(message); | 612 Send(message); |
| 620 } | 613 } |
| 621 | 614 |
| 622 } // namespace content | 615 } // namespace content |
| OLD | NEW |