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

Unified Diff: media/base/video_frame_pool.h

Issue 101623006: Created VideoFramePool to avoid unnecessary VideoFrame alloc/free. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add PoolImpl destructor to make clang on the bots happy. Created 7 years 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/base/video_frame_pool.h
diff --git a/media/base/video_frame_pool.h b/media/base/video_frame_pool.h
new file mode 100644
index 0000000000000000000000000000000000000000..6aac12a34d801aeebf3a63ef7250fdc7dc623678
--- /dev/null
+++ b/media/base/video_frame_pool.h
@@ -0,0 +1,38 @@
+// Copyright 2013 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_BASE_VIDEO_FRAME_POOL_H_
+#define MEDIA_BASE_VIDEO_FRAME_POOL_H_
+
+#include "media/base/media_export.h"
+#include "media/base/video_frame.h"
+
+namespace media {
+
+// Simple VideoFrame pool used to avoid unnecessarily allocating and destroying
+// VideoFrame objects.
DaleCurtis 2013/12/09 20:48:25 Needs some comments about the lifetime of frames i
acolwell GONE FROM CHROMIUM 2013/12/09 21:42:11 Done.
+class MEDIA_EXPORT VideoFramePool {
+ public:
+ VideoFramePool();
+ ~VideoFramePool();
+
+ // Returns a frame from the pool that matches the specified
+ // parameters or creates a new frame if no suitable frame exists in
+ // the pool.
+ scoped_refptr<VideoFrame> CreateFrame(VideoFrame::Format format,
+ const gfx::Size& coded_size,
+ const gfx::Rect& visible_rect,
+ const gfx::Size& natural_size,
+ base::TimeDelta timestamp);
+
+ private:
+ class PoolImpl;
+ scoped_refptr<PoolImpl> pool_;
+
+ DISALLOW_COPY_AND_ASSIGN(VideoFramePool);
+};
+
+} // namespace media
+
+#endif // MEDIA_BASE_VIDEO_FRAME_POOL_H_

Powered by Google App Engine
This is Rietveld 408576698