Chromium Code Reviews| 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 are ref-counted and will be kept alive for as long | |
|
Daniele Castagna
2017/03/31 00:58:13
nit: Actually VideoFrames are ref-counted. The res
servolk
2017/03/31 01:04:19
Thanks for correcting me. How about this?
// NOTE:
Daniele Castagna
2017/03/31 01:20:54
Thanks to you for adding this note.
The comment s
servolk
2017/03/31 01:23:21
Done.
| |
| 29 // as the corresponding video frame is alive. | |
| 27 class MEDIA_EXPORT GpuMemoryBufferVideoFramePool { | 30 class MEDIA_EXPORT GpuMemoryBufferVideoFramePool { |
| 28 public: | 31 public: |
| 29 GpuMemoryBufferVideoFramePool(); | 32 GpuMemoryBufferVideoFramePool(); |
| 30 GpuMemoryBufferVideoFramePool( | 33 GpuMemoryBufferVideoFramePool( |
| 31 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner, | 34 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner, |
| 32 const scoped_refptr<base::TaskRunner>& worker_task_runner, | 35 const scoped_refptr<base::TaskRunner>& worker_task_runner, |
| 33 GpuVideoAcceleratorFactories* gpu_factories); | 36 GpuVideoAcceleratorFactories* gpu_factories); |
| 34 virtual ~GpuMemoryBufferVideoFramePool(); | 37 virtual ~GpuMemoryBufferVideoFramePool(); |
| 35 | 38 |
| 36 // Callback used by MaybeCreateHardwareFrame to deliver a new VideoFrame | 39 // Callback used by MaybeCreateHardwareFrame to deliver a new VideoFrame |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 51 private: | 54 private: |
| 52 class PoolImpl; | 55 class PoolImpl; |
| 53 scoped_refptr<PoolImpl> pool_impl_; | 56 scoped_refptr<PoolImpl> pool_impl_; |
| 54 | 57 |
| 55 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferVideoFramePool); | 58 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferVideoFramePool); |
| 56 }; | 59 }; |
| 57 | 60 |
| 58 } // namespace media | 61 } // namespace media |
| 59 | 62 |
| 60 #endif // MEDIA_VIDEO_GPU_MEMORY_BUFFER_VIDEO_FRAME_POOL_H_ | 63 #endif // MEDIA_VIDEO_GPU_MEMORY_BUFFER_VIDEO_FRAME_POOL_H_ |
| OLD | NEW |