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

Side by Side Diff: media/base/video_frame_pool.h

Issue 1637793004: [WIP] Mojo Video Capture thingy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_BASE_VIDEO_FRAME_POOL_H_ 5 #ifndef MEDIA_BASE_VIDEO_FRAME_POOL_H_
6 #define MEDIA_BASE_VIDEO_FRAME_POOL_H_ 6 #define MEDIA_BASE_VIDEO_FRAME_POOL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "media/base/media_export.h" 11 #include "media/base/media_export.h"
12 #include "media/base/video_frame.h" 12 #include "media/base/video_frame.h"
13 13
14 namespace media { 14 namespace media {
15 15
16 // Simple VideoFrame pool used to avoid unnecessarily allocating and destroying 16 // Simple VideoFrame pool used to avoid unnecessarily allocating and destroying
17 // VideoFrame objects. The pool manages the memory for the VideoFrame 17 // VideoFrame objects. The pool manages the memory for the VideoFrame
18 // returned by CreateFrame(). When one of these VideoFrames is destroyed, 18 // returned by CreateFrame(). When one of these VideoFrames is destroyed,
19 // the memory is returned to the pool for use by a subsequent CreateFrame() 19 // the memory is returned to the pool for use by a subsequent CreateFrame()
20 // call. The memory in the pool is retained for the life of the 20 // call. The memory in the pool is retained for the life of the
21 // VideoFramePool object. If the parameters passed to CreateFrame() change 21 // VideoFramePool object. If the parameters passed to CreateFrame() change
22 // during the life of this object, then the memory used by frames with the old 22 // during the life of this object, then the memory used by frames with the old
23 // parameter values will be purged from the pool. 23 // parameter values will be purged from the pool.
24 class MEDIA_EXPORT VideoFramePool { 24 class MEDIA_EXPORT VideoFramePool {
25 public: 25 public:
26 VideoFramePool(); 26 VideoFramePool();
27 ~VideoFramePool(); 27 ~VideoFramePool();
28 28
29 // Returns a frame from the pool that matches the specified 29 // Returns a frame from the pool that matches the specified parameters or
30 // parameters or creates a new frame if no suitable frame exists in 30 // creates a new frame if no suitable frame exists in the pool. The pool is
31 // the pool. The pool is drained if no matching frame is found. 31 // drained if no matching frame is found. The buffer for the new frame will be
32 // The buffer for the new frame will be zero initialized. Reused frames will 32 // zero initialized. Reused frames will not be zero initialized.
33 // not be zero initialized.
34 scoped_refptr<VideoFrame> CreateFrame(VideoPixelFormat format, 33 scoped_refptr<VideoFrame> CreateFrame(VideoPixelFormat format,
35 const gfx::Size& coded_size, 34 const gfx::Size& coded_size,
36 const gfx::Rect& visible_rect, 35 const gfx::Rect& visible_rect,
37 const gfx::Size& natural_size, 36 const gfx::Size& natural_size,
38 base::TimeDelta timestamp); 37 base::TimeDelta timestamp);
39 38
40 protected: 39 protected:
41 friend class VideoFramePoolTest; 40 friend class VideoFramePoolTest;
42 41
43 // Returns the number of frames in the pool for testing purposes. 42 // Returns the number of frames in the pool for testing purposes.
44 size_t GetPoolSizeForTesting() const; 43 size_t GetPoolSizeForTesting() const;
45 44
46 private: 45 private:
47 class PoolImpl; 46 class PoolImpl;
48 scoped_refptr<PoolImpl> pool_; 47 scoped_refptr<PoolImpl> pool_;
49 48
50 DISALLOW_COPY_AND_ASSIGN(VideoFramePool); 49 DISALLOW_COPY_AND_ASSIGN(VideoFramePool);
51 }; 50 };
52 51
53 } // namespace media 52 } // namespace media
54 53
55 #endif // MEDIA_BASE_VIDEO_FRAME_POOL_H_ 54 #endif // MEDIA_BASE_VIDEO_FRAME_POOL_H_
OLDNEW
« components/video_capture/stream_impl_unittest.cc ('K') | « media/base/video_frame.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698