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

Unified Diff: webrtc/common_video/include/i420_buffer_pool.h

Issue 2370653003: Add limitations of number of frames that can be created in I420BufferPool::CreateBuffer. (Closed)
Patch Set: Fix definition/declaration. Created 4 years, 3 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
« no previous file with comments | « webrtc/common_video/i420_buffer_pool.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/common_video/include/i420_buffer_pool.h
diff --git a/webrtc/common_video/include/i420_buffer_pool.h b/webrtc/common_video/include/i420_buffer_pool.h
index 5aabd756b7f83ac62fb5ab1c26d52b43d68db011..6359c21c8fc0a6f8ce8445d29c29977c0f59204f 100644
--- a/webrtc/common_video/include/i420_buffer_pool.h
+++ b/webrtc/common_video/include/i420_buffer_pool.h
@@ -23,6 +23,8 @@ namespace webrtc {
// When the I420Buffer is destructed, the memory is returned to the pool for use
// by subsequent calls to CreateBuffer. If the resolution passed to CreateBuffer
// changes, old buffers will be purged from the pool.
+// Note that CreateBuffer will crash if more than kMaxNumberOfFramesBeforeCrash
+// are created. This is to prevent memory leaks where frames are not returned.
class I420BufferPool {
public:
I420BufferPool() : I420BufferPool(false) {}
@@ -36,6 +38,7 @@ class I420BufferPool {
void Release();
private:
+ static const size_t kMaxNumberOfFramesBeforeCrash;
// Explicitly use a RefCountedObject to get access to HasOneRef,
// needed by the pool to check exclusive access.
using PooledI420Buffer = rtc::RefCountedObject<I420Buffer>;
« no previous file with comments | « webrtc/common_video/i420_buffer_pool.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698