Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: media/video/gpu_memory_buffer_video_frame_pool.cc

Issue 1993463002: Fix overlay computation in GpuMemoryBufferVideoFramePool (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/resources/video_resource_updater.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 593
594 auto release_mailbox_callback = BindToCurrentLoop( 594 auto release_mailbox_callback = BindToCurrentLoop(
595 base::Bind(&PoolImpl::MailboxHoldersReleased, this, frame_resources)); 595 base::Bind(&PoolImpl::MailboxHoldersReleased, this, frame_resources));
596 596
597 // Create the VideoFrame backed by native textures. 597 // Create the VideoFrame backed by native textures.
598 gfx::Size visible_size = video_frame->visible_rect().size(); 598 gfx::Size visible_size = video_frame->visible_rect().size();
599 scoped_refptr<VideoFrame> frame = VideoFrame::WrapNativeTextures( 599 scoped_refptr<VideoFrame> frame = VideoFrame::WrapNativeTextures(
600 output_format_, mailbox_holders, release_mailbox_callback, coded_size, 600 output_format_, mailbox_holders, release_mailbox_callback, coded_size,
601 gfx::Rect(visible_size), video_frame->natural_size(), 601 gfx::Rect(visible_size), video_frame->natural_size(),
602 video_frame->timestamp()); 602 video_frame->timestamp());
603 if (frame &&
604 video_frame->metadata()->IsTrue(VideoFrameMetadata::ALLOW_OVERLAY))
605 frame->metadata()->SetBoolean(VideoFrameMetadata::ALLOW_OVERLAY, true);
606 603
607 if (!frame) { 604 if (!frame) {
608 release_mailbox_callback.Run(gpu::SyncToken()); 605 release_mailbox_callback.Run(gpu::SyncToken());
609 frame_ready_cb.Run(video_frame); 606 frame_ready_cb.Run(video_frame);
610 return; 607 return;
611 } 608 }
612 609
610 // Compute whether or not this frame may be displayed as an overlay.
hubbe 2016/05/18 00:03:32 Not a very good comment, as it doesn't explain why
ccameron 2016/05/18 03:04:00 Good point -- removed the comment, since it doesn'
611 bool allow_overlay = false;
612 switch (output_format_) {
613 case PIXEL_FORMAT_I420:
614 allow_overlay =
615 video_frame->metadata()->IsTrue(VideoFrameMetadata::ALLOW_OVERLAY);
616 break;
617 case PIXEL_FORMAT_NV12:
618 case PIXEL_FORMAT_UYVY:
619 allow_overlay = true;
620 break;
621 default:
622 break;
623 }
624 frame->metadata()->SetBoolean(VideoFrameMetadata::ALLOW_OVERLAY,
625 allow_overlay);
626
613 base::TimeTicks render_time; 627 base::TimeTicks render_time;
614 if (video_frame->metadata()->GetTimeTicks(VideoFrameMetadata::REFERENCE_TIME, 628 if (video_frame->metadata()->GetTimeTicks(VideoFrameMetadata::REFERENCE_TIME,
615 &render_time)) { 629 &render_time)) {
616 frame->metadata()->SetTimeTicks(VideoFrameMetadata::REFERENCE_TIME, 630 frame->metadata()->SetTimeTicks(VideoFrameMetadata::REFERENCE_TIME,
617 render_time); 631 render_time);
618 } 632 }
619 633
620 frame->metadata()->SetBoolean(VideoFrameMetadata::READ_LOCK_FENCES_ENABLED, 634 frame->metadata()->SetBoolean(VideoFrameMetadata::READ_LOCK_FENCES_ENABLED,
621 true); 635 true);
622 636
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 } 764 }
751 765
752 void GpuMemoryBufferVideoFramePool::MaybeCreateHardwareFrame( 766 void GpuMemoryBufferVideoFramePool::MaybeCreateHardwareFrame(
753 const scoped_refptr<VideoFrame>& video_frame, 767 const scoped_refptr<VideoFrame>& video_frame,
754 const FrameReadyCB& frame_ready_cb) { 768 const FrameReadyCB& frame_ready_cb) {
755 DCHECK(video_frame); 769 DCHECK(video_frame);
756 pool_impl_->CreateHardwareFrame(video_frame, frame_ready_cb); 770 pool_impl_->CreateHardwareFrame(video_frame, frame_ready_cb);
757 } 771 }
758 772
759 } // namespace media 773 } // namespace media
OLDNEW
« no previous file with comments | « cc/resources/video_resource_updater.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698