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

Side by Side Diff: media/gpu/ipc/service/gpu_video_decode_accelerator.cc

Issue 2881553002: Add |texture_target_| and |pixel_format_| to media::PictureBuffer (Closed)
Patch Set: addressed review comments Created 3 years, 7 months 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 "media/gpu/ipc/service/gpu_video_decode_accelerator.h" 5 #include "media/gpu/ipc/service/gpu_video_decode_accelerator.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 // Runs on IO thread if VDA::TryToSetupDecodeOnSeparateThread() succeeded, 393 // Runs on IO thread if VDA::TryToSetupDecodeOnSeparateThread() succeeded,
394 // otherwise on the main thread. 394 // otherwise on the main thread.
395 void GpuVideoDecodeAccelerator::OnDecode( 395 void GpuVideoDecodeAccelerator::OnDecode(
396 const BitstreamBuffer& bitstream_buffer) { 396 const BitstreamBuffer& bitstream_buffer) {
397 DCHECK(video_decode_accelerator_); 397 DCHECK(video_decode_accelerator_);
398 video_decode_accelerator_->Decode(bitstream_buffer); 398 video_decode_accelerator_->Decode(bitstream_buffer);
399 } 399 }
400 400
401 void GpuVideoDecodeAccelerator::OnAssignPictureBuffers( 401 void GpuVideoDecodeAccelerator::OnAssignPictureBuffers(
402 const std::vector<int32_t>& buffer_ids, 402 const std::vector<int32_t>& buffer_ids,
403 const std::vector<PictureBuffer::TextureIds>& texture_ids) { 403 const std::vector<PictureBuffer::TextureIds>& texture_ids,
404 const std::vector<uint32_t>& texture_targets,
405 const std::vector<VideoPixelFormat>& formats,
406 const std::vector<gfx::Size>& sizes) {
404 if (buffer_ids.size() != texture_ids.size()) { 407 if (buffer_ids.size() != texture_ids.size()) {
405 NotifyError(VideoDecodeAccelerator::INVALID_ARGUMENT); 408 NotifyError(VideoDecodeAccelerator::INVALID_ARGUMENT);
406 return; 409 return;
407 } 410 }
408 411
409 gpu::gles2::GLES2Decoder* command_decoder = stub_->decoder(); 412 gpu::gles2::GLES2Decoder* command_decoder = stub_->decoder();
410 gpu::gles2::TextureManager* texture_manager = 413 gpu::gles2::TextureManager* texture_manager =
411 command_decoder->GetContextGroup()->texture_manager(); 414 command_decoder->GetContextGroup()->texture_manager();
412 415
413 std::vector<PictureBuffer> buffers; 416 std::vector<PictureBuffer> buffers;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 DCHECK(format == GL_BGRA_EXT); 474 DCHECK(format == GL_BGRA_EXT);
472 texture_manager->SetLevelInfo(texture_ref, texture_target_, 0, format, 475 texture_manager->SetLevelInfo(texture_ref, texture_target_, 0, format,
473 width, height, 1, 0, format, 476 width, height, 1, 0, format,
474 GL_UNSIGNED_BYTE, gfx::Rect()); 477 GL_UNSIGNED_BYTE, gfx::Rect());
475 } 478 }
476 } 479 }
477 service_ids.push_back(texture_ref->service_id()); 480 service_ids.push_back(texture_ref->service_id());
478 current_textures.push_back(texture_ref); 481 current_textures.push_back(texture_ref);
479 } 482 }
480 textures.push_back(current_textures); 483 textures.push_back(current_textures);
481 buffers.push_back(PictureBuffer(buffer_ids[i], texture_dimensions_, 484 buffers.push_back(PictureBuffer(buffer_ids[i], texture_dimensions_,
liberato (no reviews please) 2017/05/12 21:26:42 i had forgotten that |texture_dimensions_| is cach
Chandan 2017/05/16 14:29:30 Done.
482 buffer_texture_ids, service_ids)); 485 buffer_texture_ids, service_ids));
483 } 486 }
484 { 487 {
485 DebugAutoLock auto_lock(debug_uncleared_textures_lock_); 488 DebugAutoLock auto_lock(debug_uncleared_textures_lock_);
486 for (uint32_t i = 0; i < buffer_ids.size(); ++i) 489 for (uint32_t i = 0; i < buffer_ids.size(); ++i)
487 uncleared_textures_[buffer_ids[i]] = textures[i]; 490 uncleared_textures_[buffer_ids[i]] = textures[i];
488 } 491 }
489 video_decode_accelerator_->AssignPictureBuffers(buffers); 492 video_decode_accelerator_->AssignPictureBuffers(buffers);
490 } 493 }
491 494
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 for (auto texture_ref : it->second) { 534 for (auto texture_ref : it->second) {
532 GLenum target = texture_ref->texture()->target(); 535 GLenum target = texture_ref->texture()->target();
533 gpu::gles2::TextureManager* texture_manager = 536 gpu::gles2::TextureManager* texture_manager =
534 stub_->decoder()->GetContextGroup()->texture_manager(); 537 stub_->decoder()->GetContextGroup()->texture_manager();
535 texture_manager->SetLevelCleared(texture_ref.get(), target, 0, true); 538 texture_manager->SetLevelCleared(texture_ref.get(), target, 0, true);
536 } 539 }
537 uncleared_textures_.erase(it); 540 uncleared_textures_.erase(it);
538 } 541 }
539 542
540 } // namespace media 543 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698