| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/renderer/pepper/video_decoder_shim.h" | 5 #include "content/renderer/pepper/video_decoder_shim.h" |
| 6 | 6 |
| 7 #include <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
| 8 #include <GLES2/gl2ext.h> | 8 #include <GLES2/gl2ext.h> |
| 9 #include <GLES2/gl2extchromium.h> | 9 #include <GLES2/gl2extchromium.h> |
| 10 | 10 |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 DCHECK(RenderThreadImpl::current()); | 378 DCHECK(RenderThreadImpl::current()); |
| 379 DCHECK_EQ(state_, DECODING); | 379 DCHECK_EQ(state_, DECODING); |
| 380 if (buffers.empty()) { | 380 if (buffers.empty()) { |
| 381 NOTREACHED(); | 381 NOTREACHED(); |
| 382 return; | 382 return; |
| 383 } | 383 } |
| 384 DCHECK_EQ(buffers.size(), pending_texture_mailboxes_.size()); | 384 DCHECK_EQ(buffers.size(), pending_texture_mailboxes_.size()); |
| 385 GLuint num_textures = base::checked_cast<GLuint>(buffers.size()); | 385 GLuint num_textures = base::checked_cast<GLuint>(buffers.size()); |
| 386 std::vector<uint32_t> local_texture_ids(num_textures); | 386 std::vector<uint32_t> local_texture_ids(num_textures); |
| 387 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); | 387 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); |
| 388 gles2->GenTextures(num_textures, &local_texture_ids.front()); | |
| 389 for (uint32_t i = 0; i < num_textures; i++) { | 388 for (uint32_t i = 0; i < num_textures; i++) { |
| 390 gles2->ActiveTexture(GL_TEXTURE0); | 389 local_texture_ids[i] = gles2->CreateAndConsumeTextureCHROMIUM( |
| 391 gles2->BindTexture(GL_TEXTURE_2D, local_texture_ids[i]); | 390 GL_TEXTURE_2D, pending_texture_mailboxes_[i].name); |
| 392 gles2->ConsumeTextureCHROMIUM(GL_TEXTURE_2D, | |
| 393 pending_texture_mailboxes_[i].name); | |
| 394 // Map the plugin texture id to the local texture id. | 391 // Map the plugin texture id to the local texture id. |
| 395 uint32_t plugin_texture_id = buffers[i].texture_id(); | 392 uint32_t plugin_texture_id = buffers[i].texture_id(); |
| 396 texture_id_map_[plugin_texture_id] = local_texture_ids[i]; | 393 texture_id_map_[plugin_texture_id] = local_texture_ids[i]; |
| 397 available_textures_.insert(plugin_texture_id); | 394 available_textures_.insert(plugin_texture_id); |
| 398 } | 395 } |
| 399 pending_texture_mailboxes_.clear(); | 396 pending_texture_mailboxes_.clear(); |
| 400 SendPictures(); | 397 SendPictures(); |
| 401 } | 398 } |
| 402 | 399 |
| 403 void VideoDecoderShim::ReusePictureBuffer(int32 picture_buffer_id) { | 400 void VideoDecoderShim::ReusePictureBuffer(int32 picture_buffer_id) { |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) { | 583 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) { |
| 587 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); | 584 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); |
| 588 gles2->DeleteTextures(1, &texture_id); | 585 gles2->DeleteTextures(1, &texture_id); |
| 589 } | 586 } |
| 590 | 587 |
| 591 void VideoDecoderShim::FlushCommandBuffer() { | 588 void VideoDecoderShim::FlushCommandBuffer() { |
| 592 context_provider_->ContextGL()->Flush(); | 589 context_provider_->ContextGL()->Flush(); |
| 593 } | 590 } |
| 594 | 591 |
| 595 } // namespace content | 592 } // namespace content |
| OLD | NEW |