| 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 #include <utility> | 10 #include <utility> |
| (...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 933 DCHECK_NE(state_, UNINITIALIZED); | 933 DCHECK_NE(state_, UNINITIALIZED); |
| 934 if (buffers.empty()) { | 934 if (buffers.empty()) { |
| 935 NOTREACHED(); | 935 NOTREACHED(); |
| 936 return; | 936 return; |
| 937 } | 937 } |
| 938 DCHECK_EQ(buffers.size(), pending_texture_mailboxes_.size()); | 938 DCHECK_EQ(buffers.size(), pending_texture_mailboxes_.size()); |
| 939 GLuint num_textures = base::checked_cast<GLuint>(buffers.size()); | 939 GLuint num_textures = base::checked_cast<GLuint>(buffers.size()); |
| 940 std::vector<uint32_t> local_texture_ids(num_textures); | 940 std::vector<uint32_t> local_texture_ids(num_textures); |
| 941 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); | 941 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); |
| 942 for (uint32_t i = 0; i < num_textures; i++) { | 942 for (uint32_t i = 0; i < num_textures; i++) { |
| 943 DCHECK_EQ(1u, buffers[i].texture_ids().size()); | 943 DCHECK_EQ(1u, buffers[i].client_texture_ids().size()); |
| 944 local_texture_ids[i] = gles2->CreateAndConsumeTextureCHROMIUM( | 944 local_texture_ids[i] = gles2->CreateAndConsumeTextureCHROMIUM( |
| 945 GL_TEXTURE_2D, pending_texture_mailboxes_[i].name); | 945 GL_TEXTURE_2D, pending_texture_mailboxes_[i].name); |
| 946 // Map the plugin texture id to the local texture id. | 946 // Map the plugin texture id to the local texture id. |
| 947 uint32_t plugin_texture_id = buffers[i].texture_ids()[0]; | 947 uint32_t plugin_texture_id = buffers[i].client_texture_ids()[0]; |
| 948 texture_id_map_[plugin_texture_id] = local_texture_ids[i]; | 948 texture_id_map_[plugin_texture_id] = local_texture_ids[i]; |
| 949 available_textures_.insert(plugin_texture_id); | 949 available_textures_.insert(plugin_texture_id); |
| 950 } | 950 } |
| 951 pending_texture_mailboxes_.clear(); | 951 pending_texture_mailboxes_.clear(); |
| 952 SendPictures(); | 952 SendPictures(); |
| 953 } | 953 } |
| 954 | 954 |
| 955 void VideoDecoderShim::ReusePictureBuffer(int32_t picture_buffer_id) { | 955 void VideoDecoderShim::ReusePictureBuffer(int32_t picture_buffer_id) { |
| 956 DCHECK(RenderThreadImpl::current()); | 956 DCHECK(RenderThreadImpl::current()); |
| 957 uint32_t texture_id = static_cast<uint32_t>(picture_buffer_id); | 957 uint32_t texture_id = static_cast<uint32_t>(picture_buffer_id); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) { | 1117 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) { |
| 1118 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); | 1118 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); |
| 1119 gles2->DeleteTextures(1, &texture_id); | 1119 gles2->DeleteTextures(1, &texture_id); |
| 1120 } | 1120 } |
| 1121 | 1121 |
| 1122 void VideoDecoderShim::FlushCommandBuffer() { | 1122 void VideoDecoderShim::FlushCommandBuffer() { |
| 1123 context_provider_->ContextGL()->Flush(); | 1123 context_provider_->ContextGL()->Flush(); |
| 1124 } | 1124 } |
| 1125 | 1125 |
| 1126 } // namespace content | 1126 } // namespace content |
| OLD | NEW |