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 #ifndef MEDIA_VIDEO_GPU_MEMORY_BUFFER_VIDEO_FRAME_POOL_H_ | 5 #ifndef MEDIA_VIDEO_GPU_MEMORY_BUFFER_VIDEO_FRAME_POOL_H_ |
6 #define MEDIA_VIDEO_GPU_MEMORY_BUFFER_VIDEO_FRAME_POOL_H_ | 6 #define MEDIA_VIDEO_GPU_MEMORY_BUFFER_VIDEO_FRAME_POOL_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/task_runner.h" | 10 #include "base/task_runner.h" |
11 #include "media/base/video_frame.h" | 11 #include "media/base/video_frame.h" |
12 | 12 |
13 namespace base { | 13 namespace base { |
14 class SingleThreadTaskRunner; | 14 class SingleThreadTaskRunner; |
15 } | 15 } |
16 | 16 |
17 namespace media { | 17 namespace media { |
18 class GpuVideoAcceleratorFactories; | 18 class GpuVideoAcceleratorFactories; |
19 | 19 |
20 // Interface to a pool of GpuMemoryBuffers/textures/images that can be used to | 20 // Interface to a pool of GpuMemoryBuffers/textures/images that can be used to |
21 // transform software VideoFrames to VideoFrames backed by native textures. | 21 // transform software VideoFrames to VideoFrames backed by native textures. |
22 // The resources used by the VideoFrame created by the pool will be | 22 // The resources used by the VideoFrame created by the pool will be |
23 // automatically put back into the pool once the frame is destroyed. | 23 // automatically put back into the pool once the frame is destroyed. |
24 // The pool recycles resources to a void unnecessarily allocating and | 24 // The pool recycles resources to a void unnecessarily allocating and |
25 // destroying textures, images and GpuMemoryBuffer that could result | 25 // destroying textures, images and GpuMemoryBuffer that could result |
26 // in a round trip to the browser/GPU process. | 26 // in a round trip to the browser/GPU process. |
| 27 // NOTE: Destroying the pool will not immediately invalidate outstanding video |
| 28 // frames. GPU memory buffers will be kept alive by video frames indirectly |
| 29 // referencing them. Video frames themselves are ref-counted and will be |
| 30 // released when they are no longer needed, potentially after the pool is |
| 31 // destroyed. |
27 class MEDIA_EXPORT GpuMemoryBufferVideoFramePool { | 32 class MEDIA_EXPORT GpuMemoryBufferVideoFramePool { |
28 public: | 33 public: |
29 GpuMemoryBufferVideoFramePool(); | 34 GpuMemoryBufferVideoFramePool(); |
30 GpuMemoryBufferVideoFramePool( | 35 GpuMemoryBufferVideoFramePool( |
31 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner, | 36 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner, |
32 const scoped_refptr<base::TaskRunner>& worker_task_runner, | 37 const scoped_refptr<base::TaskRunner>& worker_task_runner, |
33 GpuVideoAcceleratorFactories* gpu_factories); | 38 GpuVideoAcceleratorFactories* gpu_factories); |
34 virtual ~GpuMemoryBufferVideoFramePool(); | 39 virtual ~GpuMemoryBufferVideoFramePool(); |
35 | 40 |
36 // Callback used by MaybeCreateHardwareFrame to deliver a new VideoFrame | 41 // Callback used by MaybeCreateHardwareFrame to deliver a new VideoFrame |
(...skipping 14 matching lines...) Expand all Loading... |
51 private: | 56 private: |
52 class PoolImpl; | 57 class PoolImpl; |
53 scoped_refptr<PoolImpl> pool_impl_; | 58 scoped_refptr<PoolImpl> pool_impl_; |
54 | 59 |
55 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferVideoFramePool); | 60 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferVideoFramePool); |
56 }; | 61 }; |
57 | 62 |
58 } // namespace media | 63 } // namespace media |
59 | 64 |
60 #endif // MEDIA_VIDEO_GPU_MEMORY_BUFFER_VIDEO_FRAME_POOL_H_ | 65 #endif // MEDIA_VIDEO_GPU_MEMORY_BUFFER_VIDEO_FRAME_POOL_H_ |
OLD | NEW |