Chromium Code Reviews| 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 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 937 DCHECK_NE(state_, UNINITIALIZED); | 937 DCHECK_NE(state_, UNINITIALIZED); |
| 938 if (buffers.empty()) { | 938 if (buffers.empty()) { |
| 939 NOTREACHED(); | 939 NOTREACHED(); |
| 940 return; | 940 return; |
| 941 } | 941 } |
| 942 DCHECK_EQ(buffers.size(), pending_texture_mailboxes_.size()); | 942 DCHECK_EQ(buffers.size(), pending_texture_mailboxes_.size()); |
| 943 GLuint num_textures = base::checked_cast<GLuint>(buffers.size()); | 943 GLuint num_textures = base::checked_cast<GLuint>(buffers.size()); |
| 944 std::vector<uint32_t> local_texture_ids(num_textures); | 944 std::vector<uint32_t> local_texture_ids(num_textures); |
| 945 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); | 945 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); |
| 946 for (uint32_t i = 0; i < num_textures; i++) { | 946 for (uint32_t i = 0; i < num_textures; i++) { |
| 947 if (buffers[i].texture_ids().empty()) | |
| 948 continue; | |
|
raymes
2016/03/31 00:09:25
Could this case actually happen?
| |
| 947 local_texture_ids[i] = gles2->CreateAndConsumeTextureCHROMIUM( | 949 local_texture_ids[i] = gles2->CreateAndConsumeTextureCHROMIUM( |
| 948 GL_TEXTURE_2D, pending_texture_mailboxes_[i].name); | 950 GL_TEXTURE_2D, pending_texture_mailboxes_[i].name); |
| 949 // Map the plugin texture id to the local texture id. | 951 // Map the plugin texture id to the local texture id. |
| 950 uint32_t plugin_texture_id = buffers[i].texture_id(); | 952 uint32_t plugin_texture_id = buffers[i].texture_ids()[0]; |
| 951 texture_id_map_[plugin_texture_id] = local_texture_ids[i]; | 953 texture_id_map_[plugin_texture_id] = local_texture_ids[i]; |
| 952 available_textures_.insert(plugin_texture_id); | 954 available_textures_.insert(plugin_texture_id); |
| 953 } | 955 } |
| 954 pending_texture_mailboxes_.clear(); | 956 pending_texture_mailboxes_.clear(); |
| 955 SendPictures(); | 957 SendPictures(); |
| 956 } | 958 } |
| 957 | 959 |
| 958 void VideoDecoderShim::ReusePictureBuffer(int32_t picture_buffer_id) { | 960 void VideoDecoderShim::ReusePictureBuffer(int32_t picture_buffer_id) { |
| 959 DCHECK(RenderThreadImpl::current()); | 961 DCHECK(RenderThreadImpl::current()); |
| 960 uint32_t texture_id = static_cast<uint32_t>(picture_buffer_id); | 962 uint32_t texture_id = static_cast<uint32_t>(picture_buffer_id); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1120 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) { | 1122 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) { |
| 1121 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); | 1123 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); |
| 1122 gles2->DeleteTextures(1, &texture_id); | 1124 gles2->DeleteTextures(1, &texture_id); |
| 1123 } | 1125 } |
| 1124 | 1126 |
| 1125 void VideoDecoderShim::FlushCommandBuffer() { | 1127 void VideoDecoderShim::FlushCommandBuffer() { |
| 1126 context_provider_->ContextGL()->Flush(); | 1128 context_provider_->ContextGL()->Flush(); |
| 1127 } | 1129 } |
| 1128 | 1130 |
| 1129 } // namespace content | 1131 } // namespace content |
| OLD | NEW |