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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 source_frame->stride(VideoFrame::kVPlane), | 307 source_frame->stride(VideoFrame::kVPlane), |
308 output + first_row * dest_stride, dest_stride, width, rows); | 308 output + first_row * dest_stride, dest_stride, width, rows); |
309 } | 309 } |
310 done.Run(); | 310 done.Run(); |
311 } | 311 } |
312 | 312 |
313 gfx::Size CodedSize(const scoped_refptr<VideoFrame>& video_frame, | 313 gfx::Size CodedSize(const scoped_refptr<VideoFrame>& video_frame, |
314 VideoPixelFormat output_format) { | 314 VideoPixelFormat output_format) { |
315 DCHECK(gfx::Rect(video_frame->coded_size()) | 315 DCHECK(gfx::Rect(video_frame->coded_size()) |
316 .Contains(video_frame->visible_rect())); | 316 .Contains(video_frame->visible_rect())); |
317 DCHECK((video_frame->visible_rect().x() & 1) == 0); | |
318 gfx::Size output; | 317 gfx::Size output; |
319 switch (output_format) { | 318 switch (output_format) { |
320 case PIXEL_FORMAT_I420: | 319 case PIXEL_FORMAT_I420: |
321 case PIXEL_FORMAT_NV12: | 320 case PIXEL_FORMAT_NV12: |
322 DCHECK((video_frame->visible_rect().y() & 1) == 0); | |
323 output = gfx::Size((video_frame->visible_rect().width() + 1) & ~1, | 321 output = gfx::Size((video_frame->visible_rect().width() + 1) & ~1, |
324 (video_frame->visible_rect().height() + 1) & ~1); | 322 (video_frame->visible_rect().height() + 1) & ~1); |
325 break; | 323 break; |
326 case PIXEL_FORMAT_UYVY: | 324 case PIXEL_FORMAT_UYVY: |
327 output = gfx::Size((video_frame->visible_rect().width() + 1) & ~1, | 325 output = gfx::Size((video_frame->visible_rect().width() + 1) & ~1, |
328 video_frame->visible_rect().height()); | 326 video_frame->visible_rect().height()); |
329 break; | 327 break; |
330 default: | 328 default: |
331 NOTREACHED(); | 329 NOTREACHED(); |
332 } | 330 } |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 } | 761 } |
764 | 762 |
765 void GpuMemoryBufferVideoFramePool::MaybeCreateHardwareFrame( | 763 void GpuMemoryBufferVideoFramePool::MaybeCreateHardwareFrame( |
766 const scoped_refptr<VideoFrame>& video_frame, | 764 const scoped_refptr<VideoFrame>& video_frame, |
767 const FrameReadyCB& frame_ready_cb) { | 765 const FrameReadyCB& frame_ready_cb) { |
768 DCHECK(video_frame); | 766 DCHECK(video_frame); |
769 pool_impl_->CreateHardwareFrame(video_frame, frame_ready_cb); | 767 pool_impl_->CreateHardwareFrame(video_frame, frame_ready_cb); |
770 } | 768 } |
771 | 769 |
772 } // namespace media | 770 } // namespace media |
OLD | NEW |