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

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

Issue 1227383003: Remove memset from VideoFrame and mark buffer as unpoisoned (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move unpoisoned inside ffmpeg_video_decoder. Created 5 years, 5 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 | media/base/video_frame_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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.h" 5 #include "media/base/video_frame.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 data_size += height * strides_[plane]; 849 data_size += height * strides_[plane];
850 } 850 }
851 851
852 // The extra line of UV being allocated is because h264 chroma MC 852 // The extra line of UV being allocated is because h264 chroma MC
853 // overreads by one line in some cases, see libavcodec/utils.c: 853 // overreads by one line in some cases, see libavcodec/utils.c:
854 // avcodec_align_dimensions2() and libavcodec/x86/h264_chromamc.asm: 854 // avcodec_align_dimensions2() and libavcodec/x86/h264_chromamc.asm:
855 // put_h264_chroma_mc4_ssse3(). 855 // put_h264_chroma_mc4_ssse3().
856 DCHECK(IsValidPlane(kUPlane, format_)); 856 DCHECK(IsValidPlane(kUPlane, format_));
857 data_size += strides_[kUPlane] + kFrameSizePadding; 857 data_size += strides_[kUPlane] + kFrameSizePadding;
858 858
859 // FFmpeg expects the initialize allocation to be zero-initialized. Failure
860 // to do so can lead to unitialized value usage. See http://crbug.com/390941
861 uint8* data = reinterpret_cast<uint8*>( 859 uint8* data = reinterpret_cast<uint8*>(
862 base::AlignedAlloc(data_size, kFrameAddressAlignment)); 860 base::AlignedAlloc(data_size, kFrameAddressAlignment));
863 memset(data, 0, data_size);
864 861
865 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) 862 for (size_t plane = 0; plane < NumPlanes(format_); ++plane)
866 data_[plane] = data + offset[plane]; 863 data_[plane] = data + offset[plane];
867 864
868 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); 865 AddDestructionObserver(base::Bind(&base::AlignedFree, data));
869 } 866 }
870 867
871 } // namespace media 868 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/base/video_frame_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698