OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/browser/renderer_host/media/video_capture_texture_wrapper.h" | 5 #include "content/browser/renderer_host/media/video_capture_texture_wrapper.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "content/browser/compositor/image_transport_factory.h" | 8 #include "content/browser/compositor/image_transport_factory.h" |
9 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 9 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
10 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | 10 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 | 285 |
286 uint8* mapped_buffer = static_cast<uint8*>(gpu_memory_buffer->Map()); | 286 uint8* mapped_buffer = static_cast<uint8*>(gpu_memory_buffer->Map()); |
287 DCHECK(mapped_buffer); | 287 DCHECK(mapped_buffer); |
288 libyuv::ARGBCopy( | 288 libyuv::ARGBCopy( |
289 reinterpret_cast<uint8*>(argb_buffer->data()), frame_size.width() * 4, | 289 reinterpret_cast<uint8*>(argb_buffer->data()), frame_size.width() * 4, |
290 mapped_buffer, frame_size.width() * 4, | 290 mapped_buffer, frame_size.width() * 4, |
291 frame_size.width(), frame_size.height()); | 291 frame_size.width(), frame_size.height()); |
292 gpu_memory_buffer->Unmap(); | 292 gpu_memory_buffer->Unmap(); |
293 | 293 |
294 gpu::gles2::GLES2Interface* gl = capture_thread_context_->ContextGL(); | 294 gpu::gles2::GLES2Interface* gl = capture_thread_context_->ContextGL(); |
295 GLuint image_id = gl->CreateImageCHROMIUM(gpu_memory_buffer->AsClientBuffer(), | 295 ClientBuffer buffers[] = {gpu_memory_buffer->AsClientBuffer()}; |
296 frame_size.width(), | 296 GLuint image_id = gl->CreateImageCHROMIUM(buffers, frame_size.width(), |
297 frame_size.height(), | 297 frame_size.height(), GL_RGBA); |
298 GL_RGBA); | |
299 DCHECK(image_id); | 298 DCHECK(image_id); |
300 | 299 |
301 GLuint texture_id = gl_helper_->CreateTexture(); | 300 GLuint texture_id = gl_helper_->CreateTexture(); |
302 DCHECK(texture_id); | 301 DCHECK(texture_id); |
303 { | 302 { |
304 content::ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl, texture_id); | 303 content::ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl, texture_id); |
305 gl->BindTexImage2DCHROMIUM(GL_TEXTURE_2D, image_id); | 304 gl->BindTexImage2DCHROMIUM(GL_TEXTURE_2D, image_id); |
306 } | 305 } |
307 | 306 |
308 scoped_ptr<gpu::MailboxHolder> mailbox_holder(new gpu::MailboxHolder( | 307 scoped_ptr<gpu::MailboxHolder> mailbox_holder(new gpu::MailboxHolder( |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 void VideoCaptureTextureWrapper::TextureWrapperDelegate::OnError( | 447 void VideoCaptureTextureWrapper::TextureWrapperDelegate::OnError( |
449 const std::string& message) { | 448 const std::string& message) { |
450 DCHECK(capture_task_runner_->BelongsToCurrentThread()); | 449 DCHECK(capture_task_runner_->BelongsToCurrentThread()); |
451 DLOG(ERROR) << message; | 450 DLOG(ERROR) << message; |
452 BrowserThread::PostTask( | 451 BrowserThread::PostTask( |
453 BrowserThread::IO, FROM_HERE, | 452 BrowserThread::IO, FROM_HERE, |
454 base::Bind(&VideoCaptureController::DoErrorOnIOThread, controller_)); | 453 base::Bind(&VideoCaptureController::DoErrorOnIOThread, controller_)); |
455 } | 454 } |
456 | 455 |
457 } // namespace content | 456 } // namespace content |
OLD | NEW |