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

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

Issue 10703184: Mac HW Video Decode: Fix texture creation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review comments Created 8 years, 5 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 | « no previous file | no next file » | 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 <GLES2/gl2.h>
8 #include <GLES2/gl2ext.h>
9
7 #include "base/bind.h" 10 #include "base/bind.h"
8 #include "base/synchronization/waitable_event.h" 11 #include "base/synchronization/waitable_event.h"
9 #include "content/common/child_thread.h" 12 #include "content/common/child_thread.h"
10 #include "content/common/gpu/client/gpu_channel_host.h" 13 #include "content/common/gpu/client/gpu_channel_host.h"
11 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 14 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
12 #include "gpu/command_buffer/client/gles2_implementation.h" 15 #include "gpu/command_buffer/client/gles2_implementation.h"
13 #include "gpu/ipc/command_buffer_proxy.h" 16 #include "gpu/ipc/command_buffer_proxy.h"
14 17
15 RendererGpuVideoDecoderFactories::~RendererGpuVideoDecoderFactories() {} 18 RendererGpuVideoDecoderFactories::~RendererGpuVideoDecoderFactories() {}
16 RendererGpuVideoDecoderFactories::RendererGpuVideoDecoderFactories( 19 RendererGpuVideoDecoderFactories::RendererGpuVideoDecoderFactories(
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 texture_ids->resize(count); 105 texture_ids->resize(count);
103 gles2->GenTextures(count, &texture_ids->at(0)); 106 gles2->GenTextures(count, &texture_ids->at(0));
104 for (int i = 0; i < count; ++i) { 107 for (int i = 0; i < count; ++i) {
105 gles2->ActiveTexture(GL_TEXTURE0); 108 gles2->ActiveTexture(GL_TEXTURE0);
106 uint32 texture_id = texture_ids->at(i); 109 uint32 texture_id = texture_ids->at(i);
107 gles2->BindTexture(texture_target, texture_id); 110 gles2->BindTexture(texture_target, texture_id);
108 gles2->TexParameteri(texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 111 gles2->TexParameteri(texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
109 gles2->TexParameteri(texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 112 gles2->TexParameteri(texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
110 gles2->TexParameterf(texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 113 gles2->TexParameterf(texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
111 gles2->TexParameterf(texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 114 gles2->TexParameterf(texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
112 gles2->TexImage2D(texture_target, 0, GL_RGBA, size.width(), size.height(), 115 if (texture_target == GL_TEXTURE_2D) {
113 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); 116 gles2->TexImage2D(texture_target, 0, GL_RGBA, size.width(), size.height(),
117 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
118 }
114 } 119 }
115 // We need a glFlush here to guarantee the decoder (in the GPU process) can 120 // We need a glFlush here to guarantee the decoder (in the GPU process) can
116 // use the texture ids we return here. Since textures are expected to be 121 // use the texture ids we return here. Since textures are expected to be
117 // reused, this should not be unacceptably expensive. 122 // reused, this should not be unacceptably expensive.
118 gles2->Flush(); 123 gles2->Flush();
119 DCHECK_EQ(gles2->GetError(), static_cast<GLenum>(GL_NO_ERROR)); 124 DCHECK_EQ(gles2->GetError(), static_cast<GLenum>(GL_NO_ERROR));
120 *success = true; 125 *success = true;
121 waiter->Signal(); 126 waiter->Signal();
122 } 127 }
123 128
(...skipping 23 matching lines...) Expand all
147 waiter.Wait(); 152 waiter.Wait();
148 return shm; 153 return shm;
149 } 154 }
150 155
151 void RendererGpuVideoDecoderFactories::AsyncCreateSharedMemory( 156 void RendererGpuVideoDecoderFactories::AsyncCreateSharedMemory(
152 size_t size, base::SharedMemory** shm, base::WaitableEvent* waiter) { 157 size_t size, base::SharedMemory** shm, base::WaitableEvent* waiter) {
153 DCHECK_EQ(MessageLoop::current(), ChildThread::current()->message_loop()); 158 DCHECK_EQ(MessageLoop::current(), ChildThread::current()->message_loop());
154 *shm = ChildThread::current()->AllocateSharedMemory(size); 159 *shm = ChildThread::current()->AllocateSharedMemory(size);
155 waiter->Signal(); 160 waiter->Signal();
156 } 161 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698