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

Side by Side Diff: content/renderer/media/renderer_gpu_video_decoder_factories.cc

Issue 9416087: Add texture target field to video frame (for use by native textures). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pass through tex target from higher above (texture creation time) Created 8 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/media/renderer_gpu_video_decoder_factories.h ('k') | media/base/video_frame.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/media/renderer_gpu_video_decoder_factories.h" 5 #include "content/renderer/media/renderer_gpu_video_decoder_factories.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/synchronization/waitable_event.h" 8 #include "base/synchronization/waitable_event.h"
9 #include "content/common/child_thread.h" 9 #include "content/common/child_thread.h"
10 #include "content/common/gpu/client/command_buffer_proxy.h" 10 #include "content/common/gpu/client/command_buffer_proxy.h"
(...skipping 30 matching lines...) Expand all
41 if (context_) { 41 if (context_) {
42 *vda = gpu_channel_host_->CreateVideoDecoder( 42 *vda = gpu_channel_host_->CreateVideoDecoder(
43 context_->GetCommandBufferProxy()->route_id(), profile, client); 43 context_->GetCommandBufferProxy()->route_id(), profile, client);
44 } else { 44 } else {
45 *vda = NULL; 45 *vda = NULL;
46 } 46 }
47 waiter->Signal(); 47 waiter->Signal();
48 } 48 }
49 49
50 bool RendererGpuVideoDecoderFactories::CreateTextures( 50 bool RendererGpuVideoDecoderFactories::CreateTextures(
51 int32 count, const gfx::Size& size, std::vector<uint32>* texture_ids) { 51 int32 count, const gfx::Size& size,
52 std::vector<uint32>* texture_ids,
53 uint32* texture_target) {
52 bool success = false; 54 bool success = false;
53 base::WaitableEvent waiter(false, false); 55 base::WaitableEvent waiter(false, false);
54 message_loop_->PostTask(FROM_HERE, base::Bind( 56 message_loop_->PostTask(FROM_HERE, base::Bind(
55 &RendererGpuVideoDecoderFactories::AsyncCreateTextures, this, 57 &RendererGpuVideoDecoderFactories::AsyncCreateTextures, this,
56 count, size, texture_ids, &success, &waiter)); 58 count, size, texture_ids, texture_target, &success, &waiter));
57 waiter.Wait(); 59 waiter.Wait();
58 return success; 60 return success;
59 } 61 }
60 62
61 void RendererGpuVideoDecoderFactories::AsyncCreateTextures( 63 void RendererGpuVideoDecoderFactories::AsyncCreateTextures(
62 int32 count, const gfx::Size& size, std::vector<uint32>* texture_ids, 64 int32 count, const gfx::Size& size, std::vector<uint32>* texture_ids,
63 bool* success, base::WaitableEvent* waiter) { 65 uint32* texture_target, bool* success, base::WaitableEvent* waiter) {
64 if (!context_) { 66 if (!context_) {
65 *success = false; 67 *success = false;
66 waiter->Signal(); 68 waiter->Signal();
67 return; 69 return;
68 } 70 }
69 gpu::gles2::GLES2Implementation* gles2 = context_->GetImplementation(); 71 gpu::gles2::GLES2Implementation* gles2 = context_->GetImplementation();
70 texture_ids->resize(count); 72 texture_ids->resize(count);
71 gles2->GenTextures(count, &texture_ids->at(0)); 73 gles2->GenTextures(count, &texture_ids->at(0));
74 *texture_target = GL_TEXTURE_2D;
72 for (int i = 0; i < count; ++i) { 75 for (int i = 0; i < count; ++i) {
73 gles2->ActiveTexture(GL_TEXTURE0); 76 gles2->ActiveTexture(GL_TEXTURE0);
74 uint32 texture_id = texture_ids->at(i); 77 uint32 texture_id = texture_ids->at(i);
75 gles2->BindTexture(GL_TEXTURE_2D, texture_id); 78 gles2->BindTexture(GL_TEXTURE_2D, texture_id);
Ami GONE FROM CHROMIUM 2012/02/22 23:44:48 Could as well replace all the GL_TEXTURE_2D's from
76 gles2->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 79 gles2->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
77 gles2->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 80 gles2->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
78 gles2->TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 81 gles2->TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
79 gles2->TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 82 gles2->TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
80 gles2->TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size.width(), size.height(), 83 gles2->TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size.width(), size.height(),
81 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); 84 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
82 } 85 }
83 // We need a glFlush here to guarantee the decoder (in the GPU process) can 86 // We need a glFlush here to guarantee the decoder (in the GPU process) can
84 // use the texture ids we return here. Since textures are expected to be 87 // use the texture ids we return here. Since textures are expected to be
85 // reused, this should not be unacceptably expensive. 88 // reused, this should not be unacceptably expensive.
(...skipping 26 matching lines...) Expand all
112 size, &shm, &waiter)); 115 size, &shm, &waiter));
113 waiter.Wait(); 116 waiter.Wait();
114 return shm; 117 return shm;
115 } 118 }
116 119
117 void RendererGpuVideoDecoderFactories::AsyncCreateSharedMemory( 120 void RendererGpuVideoDecoderFactories::AsyncCreateSharedMemory(
118 size_t size, base::SharedMemory** shm, base::WaitableEvent* waiter) { 121 size_t size, base::SharedMemory** shm, base::WaitableEvent* waiter) {
119 *shm = ChildThread::current()->AllocateSharedMemory(size); 122 *shm = ChildThread::current()->AllocateSharedMemory(size);
120 waiter->Signal(); 123 waiter->Signal();
121 } 124 }
OLDNEW
« no previous file with comments | « content/renderer/media/renderer_gpu_video_decoder_factories.h ('k') | media/base/video_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698