OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MEDIA_VIDEO_GPU_MEMORY_BUFFER_VIDEO_FRAME_POOL_H_ |
| 6 #define MEDIA_VIDEO_GPU_MEMORY_BUFFER_VIDEO_FRAME_POOL_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" |
| 10 #include "media/base/video_frame.h" |
| 11 |
| 12 namespace base { |
| 13 class SingleThreadTaskRunner; |
| 14 } |
| 15 |
| 16 namespace media { |
| 17 class GpuVideoAcceleratorFactories; |
| 18 |
| 19 // Interface to a pool of GpuMemoryBuffers/textues/images that can be used to |
| 20 // transform software VideoFrames to VideoFrames backed by native textures. |
| 21 // The resources used by the VideoFrame created by the pool will be |
| 22 // automatically put back into the pool once the frame is destroyed. |
| 23 // The pool recycles resources to a void unnecessarily allocating and |
| 24 // destroying textures, images and GpuMemoryBuffer that could result |
| 25 // in a round trip to the browser/GPU process. |
| 26 class MEDIA_EXPORT GpuMemoryBufferVideoFramePool { |
| 27 public: |
| 28 GpuMemoryBufferVideoFramePool( |
| 29 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 30 const scoped_refptr<GpuVideoAcceleratorFactories>& gpu_factories); |
| 31 ~GpuMemoryBufferVideoFramePool(); |
| 32 |
| 33 // Returns a new VideoFrame containing only mailboxes to native resources. |
| 34 // The content of the returned object is copied from the software-allocated |
| 35 // |video_frame|. |
| 36 // If it's not possible to create a new hardware VideoFrame, |video_frame| |
| 37 // itself will be returned. |
| 38 scoped_refptr<VideoFrame> MaybeCreateHardwareFrame( |
| 39 const scoped_refptr<VideoFrame>& video_frame); |
| 40 |
| 41 private: |
| 42 class PoolImpl; |
| 43 scoped_refptr<PoolImpl> pool_impl_; |
| 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferVideoFramePool); |
| 46 }; |
| 47 |
| 48 } // namespace media |
| 49 |
| 50 #endif // MEDIA_VIDEO_GPU_MEMORY_BUFFER_VIDEO_FRAME_POOL_H_ |
OLD | NEW |