| 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 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 int source_stride, | 230 int source_stride, |
| 231 uint8* output, | 231 uint8* output, |
| 232 int dest_stride, | 232 int dest_stride, |
| 233 const base::Closure& done) { | 233 const base::Closure& done) { |
| 234 TRACE_EVENT2("media", "CopyRowsToI420Buffer", "bytes_per_row", bytes_per_row, | 234 TRACE_EVENT2("media", "CopyRowsToI420Buffer", "bytes_per_row", bytes_per_row, |
| 235 "rows", rows); | 235 "rows", rows); |
| 236 if (output) { | 236 if (output) { |
| 237 DCHECK_NE(dest_stride, 0); | 237 DCHECK_NE(dest_stride, 0); |
| 238 DCHECK_LE(bytes_per_row, std::abs(dest_stride)); | 238 DCHECK_LE(bytes_per_row, std::abs(dest_stride)); |
| 239 DCHECK_LE(bytes_per_row, source_stride); | 239 DCHECK_LE(bytes_per_row, source_stride); |
| 240 for (int row = first_row; row < first_row + rows; ++row) { | 240 |
| 241 memcpy(output + dest_stride * row, source + source_stride * row, | 241 libyuv::CopyPlane(source + source_stride * first_row, source_stride, |
| 242 bytes_per_row); | 242 output + dest_stride * first_row, dest_stride, |
| 243 } | 243 bytes_per_row, rows); |
| 244 } | 244 } |
| 245 done.Run(); | 245 done.Run(); |
| 246 } | 246 } |
| 247 | 247 |
| 248 void CopyRowsToNV12Buffer(int first_row, | 248 void CopyRowsToNV12Buffer(int first_row, |
| 249 int rows, | 249 int rows, |
| 250 int bytes_per_row, | 250 int bytes_per_row, |
| 251 const scoped_refptr<VideoFrame>& source_frame, | 251 const scoped_refptr<VideoFrame>& source_frame, |
| 252 uint8* dest_y, | 252 uint8* dest_y, |
| 253 int dest_stride_y, | 253 int dest_stride_y, |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 } | 697 } |
| 698 | 698 |
| 699 void GpuMemoryBufferVideoFramePool::MaybeCreateHardwareFrame( | 699 void GpuMemoryBufferVideoFramePool::MaybeCreateHardwareFrame( |
| 700 const scoped_refptr<VideoFrame>& video_frame, | 700 const scoped_refptr<VideoFrame>& video_frame, |
| 701 const FrameReadyCB& frame_ready_cb) { | 701 const FrameReadyCB& frame_ready_cb) { |
| 702 DCHECK(video_frame); | 702 DCHECK(video_frame); |
| 703 pool_impl_->CreateHardwareFrame(video_frame, frame_ready_cb); | 703 pool_impl_->CreateHardwareFrame(video_frame, frame_ready_cb); |
| 704 } | 704 } |
| 705 | 705 |
| 706 } // namespace media | 706 } // namespace media |
| OLD | NEW |