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

Side by Side Diff: content/renderer/pepper/video_decoder_shim.cc

Issue 1751323002: Allow multiple texture ids per picture buffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « content/renderer/pepper/ppb_video_decoder_impl.cc ('k') | media/filters/gpu_video_decoder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 DCHECK_EQ(1u, buffers[i].texture_ids().size());
947 local_texture_ids[i] = gles2->CreateAndConsumeTextureCHROMIUM( 948 local_texture_ids[i] = gles2->CreateAndConsumeTextureCHROMIUM(
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_ids()[0];
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_t 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);
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « content/renderer/pepper/ppb_video_decoder_impl.cc ('k') | media/filters/gpu_video_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698