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

Unified Diff: media/video/gpu_memory_buffer_video_frame_pool.h

Issue 1133563010: Add a GpuMemoryBuffer pool that creates hardware backed VideoFrames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address dalecurtis' comments. Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: media/video/gpu_memory_buffer_video_frame_pool.h
diff --git a/media/video/gpu_memory_buffer_video_frame_pool.h b/media/video/gpu_memory_buffer_video_frame_pool.h
new file mode 100644
index 0000000000000000000000000000000000000000..53f4b68212f43a2a28de0919ced0086edf95f34b
--- /dev/null
+++ b/media/video/gpu_memory_buffer_video_frame_pool.h
@@ -0,0 +1,50 @@
+// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_VIDEO_GPU_MEMORY_BUFFER_VIDEO_FRAME_POOL_H_
+#define MEDIA_VIDEO_GPU_MEMORY_BUFFER_VIDEO_FRAME_POOL_H_
+
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "media/base/video_frame.h"
+
+namespace base {
+class SingleThreadTaskRunner;
+}
+
+namespace media {
+class GpuVideoAcceleratorFactories;
+
+// Interface to a pool of GpuMemoryBuffers/textues/images that can be used to
+// transform software VideoFrames to VideoFrames backed by native textures.
+// The resources used by the VideoFrame created by the pool will be
+// automatically put back into the pool once the frame is destroyed.
+// The pool recycles resources to a void unnecessarily allocating and
+// destroying textures, images and GpuMemoryBuffer that could result
+// in a rountrip to the browser/GPU process.
DaleCurtis 2015/05/14 18:52:13 round trip.
Daniele Castagna 2015/05/14 19:24:17 Done.
+class MEDIA_EXPORT GpuMemoryBufferVideoFramePool {
+ public:
+ GpuMemoryBufferVideoFramePool(
+ const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
+ const scoped_refptr<GpuVideoAcceleratorFactories>& gpu_factories);
+ ~GpuMemoryBufferVideoFramePool();
+
+ // Returns a new VideoFrame containing only mailboxes to native resources.
+ // The content of the returned object is copied from the software-allocated
+ // |video_frame|.
+ // If it's not possible to create a new hardware VideoFrame, |video_frame|
+ // itself will be returned.
+ scoped_refptr<VideoFrame> MaybeCreateHardwareFrame(
+ const scoped_refptr<VideoFrame>& video_frame);
+
+ private:
+ class PoolImpl;
+ scoped_refptr<PoolImpl> pool_impl_;
+
+ DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferVideoFramePool);
+};
+
+} // namespace media
+
+#endif // MEDIA_VIDEO_GPU_MEMORY_BUFFER_VIDEO_FRAME_POOL_H_

Powered by Google App Engine
This is Rietveld 408576698