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

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

Issue 1547073003: Switch to standard integer types in content/renderer/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_accelerator_factories.h" 5 #include "content/renderer/media/renderer_gpu_video_accelerator_factories.h"
6 6
7 #include <GLES2/gl2.h> 7 #include <GLES2/gl2.h>
8 #include <GLES2/gl2ext.h> 8 #include <GLES2/gl2ext.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 scoped_ptr<media::VideoEncodeAccelerator> 99 scoped_ptr<media::VideoEncodeAccelerator>
100 RendererGpuVideoAcceleratorFactories::CreateVideoEncodeAccelerator() { 100 RendererGpuVideoAcceleratorFactories::CreateVideoEncodeAccelerator() {
101 DCHECK(video_accelerator_enabled_); 101 DCHECK(video_accelerator_enabled_);
102 DCHECK(task_runner_->BelongsToCurrentThread()); 102 DCHECK(task_runner_->BelongsToCurrentThread());
103 if (CheckContextLost()) 103 if (CheckContextLost())
104 return nullptr; 104 return nullptr;
105 return context_provider_->GetCommandBufferProxy()->CreateVideoEncoder(); 105 return context_provider_->GetCommandBufferProxy()->CreateVideoEncoder();
106 } 106 }
107 107
108 bool RendererGpuVideoAcceleratorFactories::CreateTextures( 108 bool RendererGpuVideoAcceleratorFactories::CreateTextures(
109 int32 count, 109 int32_t count,
110 const gfx::Size& size, 110 const gfx::Size& size,
111 std::vector<uint32>* texture_ids, 111 std::vector<uint32_t>* texture_ids,
112 std::vector<gpu::Mailbox>* texture_mailboxes, 112 std::vector<gpu::Mailbox>* texture_mailboxes,
113 uint32 texture_target) { 113 uint32_t texture_target) {
114 DCHECK(task_runner_->BelongsToCurrentThread()); 114 DCHECK(task_runner_->BelongsToCurrentThread());
115 DCHECK(texture_target); 115 DCHECK(texture_target);
116 116
117 if (CheckContextLost()) 117 if (CheckContextLost())
118 return false; 118 return false;
119 cc::ContextProvider::ScopedContextLock lock(context_provider_); 119 cc::ContextProvider::ScopedContextLock lock(context_provider_);
120 gpu::gles2::GLES2Interface* gles2 = lock.ContextGL(); 120 gpu::gles2::GLES2Interface* gles2 = lock.ContextGL();
121 texture_ids->resize(count); 121 texture_ids->resize(count);
122 texture_mailboxes->resize(count); 122 texture_mailboxes->resize(count);
123 gles2->GenTextures(count, &texture_ids->at(0)); 123 gles2->GenTextures(count, &texture_ids->at(0));
124 for (int i = 0; i < count; ++i) { 124 for (int i = 0; i < count; ++i) {
125 gles2->ActiveTexture(GL_TEXTURE0); 125 gles2->ActiveTexture(GL_TEXTURE0);
126 uint32 texture_id = texture_ids->at(i); 126 uint32_t texture_id = texture_ids->at(i);
127 gles2->BindTexture(texture_target, texture_id); 127 gles2->BindTexture(texture_target, texture_id);
128 gles2->TexParameteri(texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 128 gles2->TexParameteri(texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
129 gles2->TexParameteri(texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 129 gles2->TexParameteri(texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
130 gles2->TexParameteri(texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 130 gles2->TexParameteri(texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
131 gles2->TexParameteri(texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 131 gles2->TexParameteri(texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
132 if (texture_target == GL_TEXTURE_2D) { 132 if (texture_target == GL_TEXTURE_2D) {
133 gles2->TexImage2D(texture_target, 133 gles2->TexImage2D(texture_target,
134 0, 134 0,
135 GL_RGBA, 135 GL_RGBA,
136 size.width(), 136 size.width(),
(...skipping 10 matching lines...) Expand all
147 147
148 // We need ShallowFlushCHROMIUM() here to order the command buffer commands 148 // We need ShallowFlushCHROMIUM() here to order the command buffer commands
149 // with respect to IPC to the GPU process, to guarantee that the decoder in 149 // with respect to IPC to the GPU process, to guarantee that the decoder in
150 // the GPU process can use these textures as soon as it receives IPC 150 // the GPU process can use these textures as soon as it receives IPC
151 // notification of them. 151 // notification of them.
152 gles2->ShallowFlushCHROMIUM(); 152 gles2->ShallowFlushCHROMIUM();
153 DCHECK_EQ(gles2->GetError(), static_cast<GLenum>(GL_NO_ERROR)); 153 DCHECK_EQ(gles2->GetError(), static_cast<GLenum>(GL_NO_ERROR));
154 return true; 154 return true;
155 } 155 }
156 156
157 void RendererGpuVideoAcceleratorFactories::DeleteTexture(uint32 texture_id) { 157 void RendererGpuVideoAcceleratorFactories::DeleteTexture(uint32_t texture_id) {
158 DCHECK(task_runner_->BelongsToCurrentThread()); 158 DCHECK(task_runner_->BelongsToCurrentThread());
159 if (CheckContextLost()) 159 if (CheckContextLost())
160 return; 160 return;
161 161
162 cc::ContextProvider::ScopedContextLock lock(context_provider_); 162 cc::ContextProvider::ScopedContextLock lock(context_provider_);
163 gpu::gles2::GLES2Interface* gles2 = lock.ContextGL(); 163 gpu::gles2::GLES2Interface* gles2 = lock.ContextGL();
164 gles2->DeleteTextures(1, &texture_id); 164 gles2->DeleteTextures(1, &texture_id);
165 DCHECK_EQ(gles2->GetError(), static_cast<GLenum>(GL_NO_ERROR)); 165 DCHECK_EQ(gles2->GetError(), static_cast<GLenum>(GL_NO_ERROR));
166 } 166 }
167 167
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 gpu_channel_host_->gpu_info() 259 gpu_channel_host_->gpu_info()
260 .video_encode_accelerator_supported_profiles); 260 .video_encode_accelerator_supported_profiles);
261 } 261 }
262 262
263 void RendererGpuVideoAcceleratorFactories::ReleaseContextProvider() { 263 void RendererGpuVideoAcceleratorFactories::ReleaseContextProvider() {
264 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); 264 DCHECK(main_thread_task_runner_->BelongsToCurrentThread());
265 context_provider_refptr_ = nullptr; 265 context_provider_refptr_ = nullptr;
266 } 266 }
267 267
268 } // namespace content 268 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698