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

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

Issue 2360373002: Fix a fuzzer crash in VideoFramePool (Closed)
Patch Set: Created 4 years, 2 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 | « no previous file | no next file » | 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 #include "media/base/video_frame_pool.h" 5 #include "media/base/video_frame_pool.h"
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 frame = pool_frame; 75 frame = pool_frame;
76 frame->set_timestamp(timestamp); 76 frame->set_timestamp(timestamp);
77 frame->metadata()->Clear(); 77 frame->metadata()->Clear();
78 break; 78 break;
79 } 79 }
80 } 80 }
81 81
82 if (!frame.get()) { 82 if (!frame.get()) {
83 frame = VideoFrame::CreateZeroInitializedFrame( 83 frame = VideoFrame::CreateZeroInitializedFrame(
84 format, coded_size, visible_rect, natural_size, timestamp); 84 format, coded_size, visible_rect, natural_size, timestamp);
85 LOG_IF(ERROR, !frame.get()) << "Failed to create a video frame"; 85 // This can happen if the arguments are not valid.
86 if (!frame) {
87 LOG(ERROR) << "Failed to create a video frame";
88 return nullptr;
89 }
86 } 90 }
87 91
88 scoped_refptr<VideoFrame> wrapped_frame = VideoFrame::WrapVideoFrame( 92 scoped_refptr<VideoFrame> wrapped_frame = VideoFrame::WrapVideoFrame(
89 frame, frame->format(), frame->visible_rect(), frame->natural_size()); 93 frame, frame->format(), frame->visible_rect(), frame->natural_size());
90 wrapped_frame->AddDestructionObserver( 94 wrapped_frame->AddDestructionObserver(
91 base::Bind(&VideoFramePool::PoolImpl::FrameReleased, this, frame)); 95 base::Bind(&VideoFramePool::PoolImpl::FrameReleased, this, frame));
92 return wrapped_frame; 96 return wrapped_frame;
93 } 97 }
94 98
95 void VideoFramePool::PoolImpl::Shutdown() { 99 void VideoFramePool::PoolImpl::Shutdown() {
(...skipping 26 matching lines...) Expand all
122 base::TimeDelta timestamp) { 126 base::TimeDelta timestamp) {
123 return pool_->CreateFrame(format, coded_size, visible_rect, natural_size, 127 return pool_->CreateFrame(format, coded_size, visible_rect, natural_size,
124 timestamp); 128 timestamp);
125 } 129 }
126 130
127 size_t VideoFramePool::GetPoolSizeForTesting() const { 131 size_t VideoFramePool::GetPoolSizeForTesting() const {
128 return pool_->GetPoolSizeForTesting(); 132 return pool_->GetPoolSizeForTesting();
129 } 133 }
130 134
131 } // namespace media 135 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698