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

Unified Diff: media/base/video_frame.cc

Issue 1267003004: Revert to zero-initializing buffers for FFmpegVideoDecoder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed method name. Created 5 years, 4 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
Index: media/base/video_frame.cc
diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc
index f80f9aa31004328acf531bb67c511c833f476bae..d3944b7a8c050e03d1d1e7fb02d47f3c684d2779 100644
--- a/media/base/video_frame.cc
+++ b/media/base/video_frame.cc
@@ -625,6 +625,18 @@ int VideoFrame::stride(size_t plane) const {
return strides_[plane];
}
+size_t VideoFrame::allocated_size() const {
+ DCHECK(IsYuvPlanar(format_));
+ DCHECK_EQ(storage_type_, STORAGE_OWNED_MEMORY);
+
+ // If CreateFrame() method is used, return the size with alignments and
+ // padding.
+ if (allocated_size_)
DaleCurtis 2015/08/04 19:07:44 Just default to zero in all cases except the Alloc
emircan 2015/08/04 19:54:35 Done.
+ return allocated_size_;
+
+ return VideoFrame::AllocationSize(format_, coded_size_);
+}
+
int VideoFrame::row_bytes(size_t plane) const {
return RowBytes(plane, format_, coded_size_.width());
}
@@ -895,11 +907,13 @@ void VideoFrame::AllocateYUV() {
uint8* data = reinterpret_cast<uint8*>(
base::AlignedAlloc(data_size, kFrameAddressAlignment));
-
for (size_t plane = 0; plane < NumPlanes(format_); ++plane)
data_[plane] = data + offset[plane];
AddDestructionObserver(base::Bind(&base::AlignedFree, data));
+
+ // Make sure that allocated_size() returns the same size as allocated here.
+ allocated_size_ = data_size;
}
} // namespace media

Powered by Google App Engine
This is Rietveld 408576698