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

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

Issue 2643733002: Allow to use {FFmpeg/Vpx}VideoDecoder from a UtilityProcess (Closed)
Patch Set: Rebase Created 3 years, 10 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
« no previous file with comments | « media/base/BUILD.gn ('k') | media/base/video_frame_pool.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 class VideoFrameProvider;
17
16 // Simple VideoFrame pool used to avoid unnecessarily allocating and destroying 18 // Simple VideoFrame pool used to avoid unnecessarily allocating and destroying
17 // VideoFrame objects. The pool manages the memory for the VideoFrame 19 // VideoFrame objects. The pool manages the memory for the VideoFrame
18 // returned by CreateFrame(). When one of these VideoFrames is destroyed, 20 // returned by CreateFrame(). When one of these VideoFrames is destroyed,
19 // the memory is returned to the pool for use by a subsequent CreateFrame() 21 // 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 22 // call. The memory in the pool is retained for the life of the
21 // VideoFramePool object. If the parameters passed to CreateFrame() change 23 // 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 24 // during the life of this object, then the memory used by frames with the old
23 // parameter values will be purged from the pool. 25 // parameter values will be purged from the pool.
24 class MEDIA_EXPORT VideoFramePool { 26 class MEDIA_EXPORT VideoFramePool {
25 public: 27 public:
26 VideoFramePool(); 28 VideoFramePool();
29 explicit VideoFramePool(
30 std::unique_ptr<VideoFrameProvider> video_frame_provider);
27 ~VideoFramePool(); 31 ~VideoFramePool();
28 32
29 // Returns a frame from the pool that matches the specified 33 // Returns a frame from the pool that matches the specified
30 // parameters or creates a new frame if no suitable frame exists in 34 // parameters or creates a new frame if no suitable frame exists in
31 // the pool. The pool is drained if no matching frame is found. 35 // the pool. The pool is drained if no matching frame is found.
32 // The buffer for the new frame will be zero initialized. Reused frames will 36 // The buffer for the new frame will be zero initialized. Reused frames will
33 // not be zero initialized. 37 // not be zero initialized.
34 scoped_refptr<VideoFrame> CreateFrame(VideoPixelFormat format, 38 scoped_refptr<VideoFrame> CreateFrame(VideoPixelFormat format,
35 const gfx::Size& coded_size, 39 const gfx::Size& coded_size,
36 const gfx::Rect& visible_rect, 40 const gfx::Rect& visible_rect,
37 const gfx::Size& natural_size, 41 const gfx::Size& natural_size,
38 base::TimeDelta timestamp); 42 base::TimeDelta timestamp);
39 43
40 protected: 44 protected:
41 friend class VideoFramePoolTest; 45 friend class VideoFramePoolTest;
42 46
43 // Returns the number of frames in the pool for testing purposes. 47 // Returns the number of frames in the pool for testing purposes.
44 size_t GetPoolSizeForTesting() const; 48 size_t GetPoolSizeForTesting() const;
45 49
46 private: 50 private:
47 class PoolImpl; 51 class PoolImpl;
52 std::unique_ptr<VideoFrameProvider> video_frame_provider_;
48 scoped_refptr<PoolImpl> pool_; 53 scoped_refptr<PoolImpl> pool_;
49 54
50 DISALLOW_COPY_AND_ASSIGN(VideoFramePool); 55 DISALLOW_COPY_AND_ASSIGN(VideoFramePool);
51 }; 56 };
52 57
53 } // namespace media 58 } // namespace media
54 59
55 #endif // MEDIA_BASE_VIDEO_FRAME_POOL_H_ 60 #endif // MEDIA_BASE_VIDEO_FRAME_POOL_H_
OLDNEW
« no previous file with comments | « media/base/BUILD.gn ('k') | media/base/video_frame_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698