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

Side by Side Diff: webrtc/common_video/include/i420_buffer_pool.h

Issue 2009193002: Delete IsMutable and IsExclusive methods. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Address tommi's comments. Created 4 years, 6 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 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 12 matching lines...) Expand all
23 // When the I420Buffer is destructed, the memory is returned to the pool for use 23 // When the I420Buffer is destructed, the memory is returned to the pool for use
24 // by subsequent calls to CreateBuffer. If the resolution passed to CreateBuffer 24 // by subsequent calls to CreateBuffer. If the resolution passed to CreateBuffer
25 // changes, old buffers will be purged from the pool. 25 // changes, old buffers will be purged from the pool.
26 class I420BufferPool { 26 class I420BufferPool {
27 public: 27 public:
28 I420BufferPool() : I420BufferPool(false) {} 28 I420BufferPool() : I420BufferPool(false) {}
29 explicit I420BufferPool(bool zero_initialize); 29 explicit I420BufferPool(bool zero_initialize);
30 30
31 // Returns a buffer from the pool, or creates a new buffer if no suitable 31 // Returns a buffer from the pool, or creates a new buffer if no suitable
32 // buffer exists in the pool. 32 // buffer exists in the pool.
33 rtc::scoped_refptr<VideoFrameBuffer> CreateBuffer(int width, int height); 33 rtc::scoped_refptr<I420Buffer> CreateBuffer(int width, int height);
34 // Clears buffers_ and detaches the thread checker so that it can be reused 34 // Clears buffers_ and detaches the thread checker so that it can be reused
35 // later from another thread. 35 // later from another thread.
36 void Release(); 36 void Release();
37 37
38 private: 38 private:
39 class PooledI420Buffer : public webrtc::I420Buffer {
magjed_webrtc 2016/05/25 13:17:01 I don't see the need for this class, why not just
nisse-webrtc 2016/05/25 13:39:47 To use I420Buffer directly, I have to include HasO
magjed_webrtc 2016/05/25 14:56:07 HasOneRef is already part of the VideoFrameBuffer
pbos-webrtc 2016/05/25 15:26:07 Can you use a rtc::RefCountedObject<I420Buffer> ?
nisse-webrtc 2016/05/26 07:44:42 This cl deletes it from the interface. I don't thi
40 public:
41 PooledI420Buffer(int width, int height) : I420Buffer(width, height) {}
42
43 // Underlying refcount access, used by the pool to check exclusive access.
44 virtual bool HasOneRef() const = 0;
45 };
46
39 rtc::ThreadChecker thread_checker_; 47 rtc::ThreadChecker thread_checker_;
40 std::list<rtc::scoped_refptr<I420Buffer>> buffers_; 48 std::list<rtc::scoped_refptr<PooledI420Buffer>> buffers_;
41 // If true, newly allocated buffers are zero-initialized. Note that recycled 49 // If true, newly allocated buffers are zero-initialized. Note that recycled
42 // buffers are not zero'd before reuse. This is required of buffers used by 50 // buffers are not zero'd before reuse. This is required of buffers used by
43 // FFmpeg according to http://crbug.com/390941, which only requires it for the 51 // FFmpeg according to http://crbug.com/390941, which only requires it for the
44 // initial allocation (as shown by FFmpeg's own buffer allocation code). It 52 // initial allocation (as shown by FFmpeg's own buffer allocation code). It
45 // has to do with "Use-of-uninitialized-value" on "Linux_msan_chrome". 53 // has to do with "Use-of-uninitialized-value" on "Linux_msan_chrome".
46 bool zero_initialize_; 54 bool zero_initialize_;
47 }; 55 };
48 56
49 } // namespace webrtc 57 } // namespace webrtc
50 58
51 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_I420_BUFFER_POOL_H_ 59 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_I420_BUFFER_POOL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698