Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: content/common/gpu/media/gpu_video_decode_accelerator.cc

Issue 775863005: gpu: Make GPU command decoder know right format of a GPU video texture in Win. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dxva_video_decode_accelerator.cc to fetch BGRA Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 NotifyError(media::VideoDecodeAccelerator::INVALID_ARGUMENT); 363 NotifyError(media::VideoDecodeAccelerator::INVALID_ARGUMENT);
364 return; 364 return;
365 } 365 }
366 gpu::gles2::Texture* info = texture_ref->texture(); 366 gpu::gles2::Texture* info = texture_ref->texture();
367 if (info->target() != texture_target_) { 367 if (info->target() != texture_target_) {
368 DLOG(ERROR) << "Texture target mismatch for texture id " 368 DLOG(ERROR) << "Texture target mismatch for texture id "
369 << texture_ids[i]; 369 << texture_ids[i];
370 NotifyError(media::VideoDecodeAccelerator::INVALID_ARGUMENT); 370 NotifyError(media::VideoDecodeAccelerator::INVALID_ARGUMENT);
371 return; 371 return;
372 } 372 }
373 GLenum format = GL_RGBA;
374 // FIXME: after moving to D3D11, remove this workaround. crbug.com/438691
375 #if defined(OS_WIN)
376 format = static_cast<DXVAVideoDecodeAccelerator*>(
Ken Russell (switch to Gerrit) 2014/12/05 20:53:43 Could you please avoid this downcast by defining a
dshwang 2014/12/08 13:47:28 Done.
377 video_decode_accelerator_.get())->GetSufaceInternalFormat();
378 #endif
373 if (texture_target_ == GL_TEXTURE_EXTERNAL_OES || 379 if (texture_target_ == GL_TEXTURE_EXTERNAL_OES ||
374 texture_target_ == GL_TEXTURE_RECTANGLE) { 380 texture_target_ == GL_TEXTURE_RECTANGLE || format != GL_RGBA) {
375 // These textures have their dimensions defined by the underlying storage. 381 // These textures have their dimensions defined by the underlying storage.
376 // Use |texture_dimensions_| for this size. 382 // Use |texture_dimensions_| for this size.
377 texture_manager->SetLevelInfo(texture_ref, 383 texture_manager->SetLevelInfo(
378 texture_target_, 384 texture_ref, texture_target_, 0, format, texture_dimensions_.width(),
379 0, 385 texture_dimensions_.height(), 1, 0, format, 0, false);
380 GL_RGBA,
381 texture_dimensions_.width(),
382 texture_dimensions_.height(),
383 1,
384 0,
385 GL_RGBA,
386 0,
387 false);
388 } else { 386 } else {
389 // For other targets, texture dimensions should already be defined. 387 // For other targets, texture dimensions should already be defined.
390 GLsizei width = 0, height = 0; 388 GLsizei width = 0, height = 0;
391 info->GetLevelSize(texture_target_, 0, &width, &height); 389 info->GetLevelSize(texture_target_, 0, &width, &height);
392 if (width != texture_dimensions_.width() || 390 if (width != texture_dimensions_.width() ||
393 height != texture_dimensions_.height()) { 391 height != texture_dimensions_.height()) {
394 DLOG(ERROR) << "Size mismatch for texture id " << texture_ids[i]; 392 DLOG(ERROR) << "Size mismatch for texture id " << texture_ids[i];
395 NotifyError(media::VideoDecodeAccelerator::INVALID_ARGUMENT); 393 NotifyError(media::VideoDecodeAccelerator::INVALID_ARGUMENT);
396 return; 394 return;
397 } 395 }
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 return stub_->channel()->Send(message); 504 return stub_->channel()->Send(message);
507 } 505 }
508 506
509 void GpuVideoDecodeAccelerator::SendCreateDecoderReply(IPC::Message* message, 507 void GpuVideoDecodeAccelerator::SendCreateDecoderReply(IPC::Message* message,
510 bool succeeded) { 508 bool succeeded) {
511 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(message, succeeded); 509 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(message, succeeded);
512 Send(message); 510 Send(message);
513 } 511 }
514 512
515 } // namespace content 513 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698