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 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 | 545 |
546 scoped_refptr<VideoFrame> frame; | 546 scoped_refptr<VideoFrame> frame; |
547 // Create the VideoFrame backed by native textures. | 547 // Create the VideoFrame backed by native textures. |
548 switch (output_format_) { | 548 switch (output_format_) { |
549 case PIXEL_FORMAT_I420: | 549 case PIXEL_FORMAT_I420: |
550 frame = VideoFrame::WrapYUV420NativeTextures( | 550 frame = VideoFrame::WrapYUV420NativeTextures( |
551 mailbox_holders[VideoFrame::kYPlane], | 551 mailbox_holders[VideoFrame::kYPlane], |
552 mailbox_holders[VideoFrame::kUPlane], | 552 mailbox_holders[VideoFrame::kUPlane], |
553 mailbox_holders[VideoFrame::kVPlane], | 553 mailbox_holders[VideoFrame::kVPlane], |
554 base::Bind(&PoolImpl::MailboxHoldersReleased, this, frame_resources), | 554 base::Bind(&PoolImpl::MailboxHoldersReleased, this, frame_resources), |
555 size, gfx::Rect(size), size, video_frame->timestamp()); | 555 size, gfx::Rect(size), video_frame->natural_size(), |
| 556 video_frame->timestamp()); |
556 if (video_frame->metadata()->IsTrue(VideoFrameMetadata::ALLOW_OVERLAY)) | 557 if (video_frame->metadata()->IsTrue(VideoFrameMetadata::ALLOW_OVERLAY)) |
557 frame->metadata()->SetBoolean(VideoFrameMetadata::ALLOW_OVERLAY, true); | 558 frame->metadata()->SetBoolean(VideoFrameMetadata::ALLOW_OVERLAY, true); |
558 break; | 559 break; |
559 case PIXEL_FORMAT_NV12: | 560 case PIXEL_FORMAT_NV12: |
560 case PIXEL_FORMAT_UYVY: | 561 case PIXEL_FORMAT_UYVY: |
561 frame = VideoFrame::WrapNativeTexture( | 562 frame = VideoFrame::WrapNativeTexture( |
562 output_format_, mailbox_holders[VideoFrame::kYPlane], | 563 output_format_, mailbox_holders[VideoFrame::kYPlane], |
563 base::Bind(&PoolImpl::MailboxHoldersReleased, this, frame_resources), | 564 base::Bind(&PoolImpl::MailboxHoldersReleased, this, frame_resources), |
564 size, gfx::Rect(size), size, video_frame->timestamp()); | 565 size, gfx::Rect(size), video_frame->natural_size(), |
| 566 video_frame->timestamp()); |
565 frame->metadata()->SetBoolean(VideoFrameMetadata::ALLOW_OVERLAY, true); | 567 frame->metadata()->SetBoolean(VideoFrameMetadata::ALLOW_OVERLAY, true); |
566 break; | 568 break; |
567 default: | 569 default: |
568 NOTREACHED(); | 570 NOTREACHED(); |
569 } | 571 } |
570 frame_ready_cb.Run(frame); | 572 frame_ready_cb.Run(frame); |
571 } | 573 } |
572 | 574 |
573 // Destroy all the resources posting one task per FrameResources | 575 // Destroy all the resources posting one task per FrameResources |
574 // to the |media_task_runner_|. | 576 // to the |media_task_runner_|. |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 } | 699 } |
698 | 700 |
699 void GpuMemoryBufferVideoFramePool::MaybeCreateHardwareFrame( | 701 void GpuMemoryBufferVideoFramePool::MaybeCreateHardwareFrame( |
700 const scoped_refptr<VideoFrame>& video_frame, | 702 const scoped_refptr<VideoFrame>& video_frame, |
701 const FrameReadyCB& frame_ready_cb) { | 703 const FrameReadyCB& frame_ready_cb) { |
702 DCHECK(video_frame); | 704 DCHECK(video_frame); |
703 pool_impl_->CreateHardwareFrame(video_frame, frame_ready_cb); | 705 pool_impl_->CreateHardwareFrame(video_frame, frame_ready_cb); |
704 } | 706 } |
705 | 707 |
706 } // namespace media | 708 } // namespace media |
OLD | NEW |