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 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/location.h" | 12 #include "base/location.h" |
| 13 #include "base/macros.h" |
13 #include "base/thread_task_runner_handle.h" | 14 #include "base/thread_task_runner_handle.h" |
14 #ifndef NDEBUG | 15 #ifndef NDEBUG |
15 #include "base/logging.h" | 16 #include "base/logging.h" |
16 #endif | 17 #endif |
17 #include "base/numerics/safe_conversions.h" | 18 #include "base/numerics/safe_conversions.h" |
18 #include "base/single_thread_task_runner.h" | 19 #include "base/single_thread_task_runner.h" |
19 #include "cc/blink/context_provider_web_context.h" | 20 #include "cc/blink/context_provider_web_context.h" |
20 #include "content/public/renderer/render_thread.h" | 21 #include "content/public/renderer/render_thread.h" |
21 #include "content/renderer/pepper/pepper_video_decoder_host.h" | 22 #include "content/renderer/pepper/pepper_video_decoder_host.h" |
22 #include "content/renderer/render_thread_impl.h" | 23 #include "content/renderer/render_thread_impl.h" |
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
948 GL_TEXTURE_2D, pending_texture_mailboxes_[i].name); | 949 GL_TEXTURE_2D, pending_texture_mailboxes_[i].name); |
949 // Map the plugin texture id to the local texture id. | 950 // Map the plugin texture id to the local texture id. |
950 uint32_t plugin_texture_id = buffers[i].texture_id(); | 951 uint32_t plugin_texture_id = buffers[i].texture_id(); |
951 texture_id_map_[plugin_texture_id] = local_texture_ids[i]; | 952 texture_id_map_[plugin_texture_id] = local_texture_ids[i]; |
952 available_textures_.insert(plugin_texture_id); | 953 available_textures_.insert(plugin_texture_id); |
953 } | 954 } |
954 pending_texture_mailboxes_.clear(); | 955 pending_texture_mailboxes_.clear(); |
955 SendPictures(); | 956 SendPictures(); |
956 } | 957 } |
957 | 958 |
958 void VideoDecoderShim::ReusePictureBuffer(int32 picture_buffer_id) { | 959 void VideoDecoderShim::ReusePictureBuffer(int32_t picture_buffer_id) { |
959 DCHECK(RenderThreadImpl::current()); | 960 DCHECK(RenderThreadImpl::current()); |
960 uint32_t texture_id = static_cast<uint32_t>(picture_buffer_id); | 961 uint32_t texture_id = static_cast<uint32_t>(picture_buffer_id); |
961 if (textures_to_dismiss_.find(texture_id) != textures_to_dismiss_.end()) { | 962 if (textures_to_dismiss_.find(texture_id) != textures_to_dismiss_.end()) { |
962 DismissTexture(texture_id); | 963 DismissTexture(texture_id); |
963 } else if (texture_id_map_.find(texture_id) != texture_id_map_.end()) { | 964 } else if (texture_id_map_.find(texture_id) != texture_id_map_.end()) { |
964 available_textures_.insert(texture_id); | 965 available_textures_.insert(texture_id); |
965 SendPictures(); | 966 SendPictures(); |
966 } else { | 967 } else { |
967 NOTREACHED(); | 968 NOTREACHED(); |
968 } | 969 } |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1120 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) { | 1121 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) { |
1121 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); | 1122 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); |
1122 gles2->DeleteTextures(1, &texture_id); | 1123 gles2->DeleteTextures(1, &texture_id); |
1123 } | 1124 } |
1124 | 1125 |
1125 void VideoDecoderShim::FlushCommandBuffer() { | 1126 void VideoDecoderShim::FlushCommandBuffer() { |
1126 context_provider_->ContextGL()->Flush(); | 1127 context_provider_->ContextGL()->Flush(); |
1127 } | 1128 } |
1128 | 1129 |
1129 } // namespace content | 1130 } // namespace content |
OLD | NEW |