| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer; | 79 std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer; |
| 80 unsigned texture_id = 0u; | 80 unsigned texture_id = 0u; |
| 81 unsigned image_id = 0u; | 81 unsigned image_id = 0u; |
| 82 gpu::Mailbox mailbox; | 82 gpu::Mailbox mailbox; |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 // All the resources needed to compose a frame. | 85 // All the resources needed to compose a frame. |
| 86 struct FrameResources { | 86 struct FrameResources { |
| 87 explicit FrameResources(const gfx::Size& size) : size(size) {} | 87 explicit FrameResources(const gfx::Size& size) : size(size) {} |
| 88 void SetIsInUse(bool in_use) { in_use_ = in_use; } | 88 void SetIsInUse(bool in_use) { in_use_ = in_use; } |
| 89 bool IsInUse() const { | 89 bool IsInUse() const { return in_use_; } |
| 90 if (in_use_) | |
| 91 return true; | |
| 92 for (const PlaneResource& plane_resource : plane_resources) { | |
| 93 if (plane_resource.gpu_memory_buffer && | |
| 94 plane_resource.gpu_memory_buffer->IsInUseByMacOSWindowServer()) { | |
| 95 return true; | |
| 96 } | |
| 97 } | |
| 98 return false; | |
| 99 } | |
| 100 | 90 |
| 101 const gfx::Size size; | 91 const gfx::Size size; |
| 102 PlaneResource plane_resources[VideoFrame::kMaxPlanes]; | 92 PlaneResource plane_resources[VideoFrame::kMaxPlanes]; |
| 103 | 93 |
| 104 private: | 94 private: |
| 105 bool in_use_ = true; | 95 bool in_use_ = true; |
| 106 }; | 96 }; |
| 107 | 97 |
| 108 // Copy |video_frame| data into |frame_resouces| | 98 // Copy |video_frame| data into |frame_resouces| |
| 109 // and calls |done| when done. | 99 // and calls |done| when done. |
| (...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 } | 757 } |
| 768 | 758 |
| 769 void GpuMemoryBufferVideoFramePool::MaybeCreateHardwareFrame( | 759 void GpuMemoryBufferVideoFramePool::MaybeCreateHardwareFrame( |
| 770 const scoped_refptr<VideoFrame>& video_frame, | 760 const scoped_refptr<VideoFrame>& video_frame, |
| 771 const FrameReadyCB& frame_ready_cb) { | 761 const FrameReadyCB& frame_ready_cb) { |
| 772 DCHECK(video_frame); | 762 DCHECK(video_frame); |
| 773 pool_impl_->CreateHardwareFrame(video_frame, frame_ready_cb); | 763 pool_impl_->CreateHardwareFrame(video_frame, frame_ready_cb); |
| 774 } | 764 } |
| 775 | 765 |
| 776 } // namespace media | 766 } // namespace media |
| OLD | NEW |