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

Unified Diff: webrtc/common_video/i420_buffer_pool.cc

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 | « no previous file | webrtc/common_video/include/i420_buffer_pool.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/common_video/i420_buffer_pool.cc
diff --git a/webrtc/common_video/i420_buffer_pool.cc b/webrtc/common_video/i420_buffer_pool.cc
index 76a53c568827c6f323d3e460bf97f35c18c28e27..630955aff9ddce7748077f3b52fd2d0769fff925 100644
--- a/webrtc/common_video/i420_buffer_pool.cc
+++ b/webrtc/common_video/i420_buffer_pool.cc
@@ -14,6 +14,8 @@
namespace webrtc {
+const size_t I420BufferPool::kMaxNumberOfFramesBeforeCrash = 300;
+
I420BufferPool::I420BufferPool(bool zero_initialize)
: zero_initialize_(zero_initialize) {}
@@ -24,6 +26,8 @@ void I420BufferPool::Release() {
rtc::scoped_refptr<I420Buffer> I420BufferPool::CreateBuffer(int width,
int height) {
RTC_DCHECK_RUNS_SERIALIZED(&race_checker_);
+ RTC_CHECK_LT(buffers_.size(), kMaxNumberOfFramesBeforeCrash)
+ << "I420BufferPool too big.";
// Release buffers with wrong resolution.
for (auto it = buffers_.begin(); it != buffers_.end();) {
if ((*it)->width() != width || (*it)->height() != height)
« no previous file with comments | « no previous file | webrtc/common_video/include/i420_buffer_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698