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 "media/video/gpu_memory_buffer_video_frame_pool.h" | 5 #include "media/video/gpu_memory_buffer_video_frame_pool.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 <stddef.h> | 9 #include <stddef.h> |
10 #include <stdint.h> | 10 #include <stdint.h> |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 resources_pool_.push_back(frame_resources); | 746 resources_pool_.push_back(frame_resources); |
747 for (size_t i = 0; i < NumGpuMemoryBuffers(output_format_); i++) { | 747 for (size_t i = 0; i < NumGpuMemoryBuffers(output_format_); i++) { |
748 PlaneResource& plane_resource = frame_resources->plane_resources[i]; | 748 PlaneResource& plane_resource = frame_resources->plane_resources[i]; |
749 const size_t width = | 749 const size_t width = |
750 VideoFrame::Columns(i, VideoFormat(format), size.width()); | 750 VideoFrame::Columns(i, VideoFormat(format), size.width()); |
751 const size_t height = | 751 const size_t height = |
752 VideoFrame::Rows(i, VideoFormat(format), size.height()); | 752 VideoFrame::Rows(i, VideoFormat(format), size.height()); |
753 plane_resource.size = gfx::Size(width, height); | 753 plane_resource.size = gfx::Size(width, height); |
754 | 754 |
755 const gfx::BufferFormat buffer_format = GpuMemoryBufferFormat(format, i); | 755 const gfx::BufferFormat buffer_format = GpuMemoryBufferFormat(format, i); |
756 plane_resource.gpu_memory_buffer = gpu_factories_->AllocateGpuMemoryBuffer( | 756 plane_resource.gpu_memory_buffer = gpu_factories_->CreateGpuMemoryBuffer( |
757 plane_resource.size, buffer_format, | 757 plane_resource.size, buffer_format, |
758 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE); | 758 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE); |
759 | 759 |
760 unsigned texture_target = gpu_factories_->ImageTextureTarget(buffer_format); | 760 unsigned texture_target = gpu_factories_->ImageTextureTarget(buffer_format); |
761 gles2->GenTextures(1, &plane_resource.texture_id); | 761 gles2->GenTextures(1, &plane_resource.texture_id); |
762 gles2->BindTexture(texture_target, plane_resource.texture_id); | 762 gles2->BindTexture(texture_target, plane_resource.texture_id); |
763 gles2->TexParameteri(texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 763 gles2->TexParameteri(texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
764 gles2->TexParameteri(texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | 764 gles2->TexParameteri(texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
765 gles2->TexParameteri(texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 765 gles2->TexParameteri(texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
766 gles2->TexParameteri(texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 766 gles2->TexParameteri(texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 } | 826 } |
827 | 827 |
828 void GpuMemoryBufferVideoFramePool::MaybeCreateHardwareFrame( | 828 void GpuMemoryBufferVideoFramePool::MaybeCreateHardwareFrame( |
829 const scoped_refptr<VideoFrame>& video_frame, | 829 const scoped_refptr<VideoFrame>& video_frame, |
830 const FrameReadyCB& frame_ready_cb) { | 830 const FrameReadyCB& frame_ready_cb) { |
831 DCHECK(video_frame); | 831 DCHECK(video_frame); |
832 pool_impl_->CreateHardwareFrame(video_frame, frame_ready_cb); | 832 pool_impl_->CreateHardwareFrame(video_frame, frame_ready_cb); |
833 } | 833 } |
834 | 834 |
835 } // namespace media | 835 } // namespace media |
OLD | NEW |