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

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

Issue 2088273003: Video Color Managament (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: bugfix Created 4 years, 5 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
« cc/output/gl_renderer.cc ('K') | « media/media.gyp ('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>
11 11
12 #include <algorithm> 12 #include <algorithm>
13 #include <list> 13 #include <list>
14 #include <memory> 14 #include <memory>
15 #include <utility> 15 #include <utility>
16 16
17 #include "base/barrier_closure.h" 17 #include "base/barrier_closure.h"
18 #include "base/bind.h" 18 #include "base/bind.h"
19 #include "base/containers/stack_container.h" 19 #include "base/containers/stack_container.h"
20 #include "base/location.h" 20 #include "base/location.h"
21 #include "base/macros.h" 21 #include "base/macros.h"
22 #include "base/memory/linked_ptr.h" 22 #include "base/memory/linked_ptr.h"
23 #include "base/strings/stringprintf.h" 23 #include "base/strings/stringprintf.h"
24 #include "base/trace_event/memory_dump_provider.h" 24 #include "base/trace_event/memory_dump_provider.h"
25 #include "base/trace_event/trace_event.h" 25 #include "base/trace_event/trace_event.h"
26 #include "gpu/GLES2/gl2extchromium.h" 26 #include "gpu/GLES2/gl2extchromium.h"
27 #include "gpu/command_buffer/client/gles2_interface.h" 27 #include "gpu/command_buffer/client/gles2_interface.h"
28 #include "media/base/bind_to_current_loop.h" 28 #include "media/base/bind_to_current_loop.h"
29 #include "media/base/video_color_space.h"
29 #include "media/renderers/gpu_video_accelerator_factories.h" 30 #include "media/renderers/gpu_video_accelerator_factories.h"
30 #include "third_party/libyuv/include/libyuv.h" 31 #include "third_party/libyuv/include/libyuv.h"
31 #include "ui/gfx/buffer_format_util.h" 32 #include "ui/gfx/buffer_format_util.h"
32 #include "ui/gl/trace_util.h" 33 #include "ui/gl/trace_util.h"
33 34
34 namespace media { 35 namespace media {
35 36
36 // Implementation of a pool of GpuMemoryBuffers used to back VideoFrames. 37 // Implementation of a pool of GpuMemoryBuffers used to back VideoFrames.
37 class GpuMemoryBufferVideoFramePool::PoolImpl 38 class GpuMemoryBufferVideoFramePool::PoolImpl
38 : public base::RefCountedThreadSafe< 39 : public base::RefCountedThreadSafe<
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 return true; 434 return true;
434 } 435 }
435 436
436 void GpuMemoryBufferVideoFramePool::PoolImpl::OnCopiesDone( 437 void GpuMemoryBufferVideoFramePool::PoolImpl::OnCopiesDone(
437 const scoped_refptr<VideoFrame>& video_frame, 438 const scoped_refptr<VideoFrame>& video_frame,
438 FrameResources* frame_resources, 439 FrameResources* frame_resources,
439 const FrameReadyCB& frame_ready_cb) { 440 const FrameReadyCB& frame_ready_cb) {
440 for (const auto& plane_resource : frame_resources->plane_resources) { 441 for (const auto& plane_resource : frame_resources->plane_resources) {
441 if (plane_resource.gpu_memory_buffer) 442 if (plane_resource.gpu_memory_buffer)
442 plane_resource.gpu_memory_buffer->Unmap(); 443 plane_resource.gpu_memory_buffer->Unmap();
443 } 444 }
ccameron 2016/07/21 18:38:13 At this point we would call plane_resource.gpu_me
hubbe 2016/07/21 19:05:30 Are you suggesting that we don't set the color spa
444 445
445 media_task_runner_->PostTask( 446 media_task_runner_->PostTask(
446 FROM_HERE, 447 FROM_HERE,
447 base::Bind(&PoolImpl::BindAndCreateMailboxesHardwareFrameResources, this, 448 base::Bind(&PoolImpl::BindAndCreateMailboxesHardwareFrameResources, this,
448 video_frame, frame_resources, frame_ready_cb)); 449 video_frame, frame_resources, frame_ready_cb));
449 } 450 }
450 451
451 // Copies |video_frame| into |frame_resources| asynchronously, posting n tasks 452 // Copies |video_frame| into |frame_resources| asynchronously, posting n tasks
452 // that will be synchronized by a barrier. 453 // that will be synchronized by a barrier.
453 // After the barrier is passed OnCopiesDone will be called. 454 // After the barrier is passed OnCopiesDone will be called.
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 frame_format, mailbox_holders, release_mailbox_callback, coded_size, 596 frame_format, mailbox_holders, release_mailbox_callback, coded_size,
596 gfx::Rect(visible_size), video_frame->natural_size(), 597 gfx::Rect(visible_size), video_frame->natural_size(),
597 video_frame->timestamp()); 598 video_frame->timestamp());
598 599
599 if (!frame) { 600 if (!frame) {
600 release_mailbox_callback.Run(gpu::SyncToken()); 601 release_mailbox_callback.Run(gpu::SyncToken());
601 frame_ready_cb.Run(video_frame); 602 frame_ready_cb.Run(video_frame);
602 return; 603 return;
603 } 604 }
604 605
606 VideoColorSpace video_color_space(video_frame);
607 video_color_space.SetVideoFrameColorSpace(frame);
608
605 bool allow_overlay = false; 609 bool allow_overlay = false;
606 switch (output_format_) { 610 switch (output_format_) {
607 case PIXEL_FORMAT_I420: 611 case PIXEL_FORMAT_I420:
608 allow_overlay = 612 allow_overlay =
609 video_frame->metadata()->IsTrue(VideoFrameMetadata::ALLOW_OVERLAY); 613 video_frame->metadata()->IsTrue(VideoFrameMetadata::ALLOW_OVERLAY);
610 break; 614 break;
611 case PIXEL_FORMAT_NV12: 615 case PIXEL_FORMAT_NV12:
612 case PIXEL_FORMAT_UYVY: 616 case PIXEL_FORMAT_UYVY:
613 allow_overlay = true; 617 allow_overlay = true;
614 break; 618 break;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 } 762 }
759 763
760 void GpuMemoryBufferVideoFramePool::MaybeCreateHardwareFrame( 764 void GpuMemoryBufferVideoFramePool::MaybeCreateHardwareFrame(
761 const scoped_refptr<VideoFrame>& video_frame, 765 const scoped_refptr<VideoFrame>& video_frame,
762 const FrameReadyCB& frame_ready_cb) { 766 const FrameReadyCB& frame_ready_cb) {
763 DCHECK(video_frame); 767 DCHECK(video_frame);
764 pool_impl_->CreateHardwareFrame(video_frame, frame_ready_cb); 768 pool_impl_->CreateHardwareFrame(video_frame, frame_ready_cb);
765 } 769 }
766 770
767 } // namespace media 771 } // namespace media
OLDNEW
« cc/output/gl_renderer.cc ('K') | « media/media.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698