summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authoremircan <emircan@chromium.org>2015-07-17 12:44:02 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-17 19:44:37 +0000
commit3188c15f1928d96621aab55b575230284709a9c6 (patch)
tree773158f653d35680ce1e4a09507be7f9de33fa73 /media
parent85009262a97def7167b4067f1f7490f49d8ea6a0 (diff)
downloadchromium_src-3188c15f1928d96621aab55b575230284709a9c6.zip
chromium_src-3188c15f1928d96621aab55b575230284709a9c6.tar.gz
chromium_src-3188c15f1928d96621aab55b575230284709a9c6.tar.bz2
Remove memset from VideoFrame and mark buffer as unpoisoned
- I removed the memset from AllocateYUV as it looks unnecessary except for FFmpegVideoDecoder. - FFmpegVideoDecoder marks the incoming buffer from VideoFramePool as unpoisoned. BUG=508220 Review URL: https://codereview.chromium.org/1227383003 Cr-Commit-Position: refs/heads/master@{#339304}
Diffstat (limited to 'media')
-rw-r--r--media/base/video_frame.cc3
-rw-r--r--media/base/video_frame_unittest.cc13
-rw-r--r--media/filters/ffmpeg_video_decoder.cc4
3 files changed, 4 insertions, 16 deletions
diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc
index 2c3fefe..51269a8 100644
--- a/media/base/video_frame.cc
+++ b/media/base/video_frame.cc
@@ -856,11 +856,8 @@ void VideoFrame::AllocateYUV() {
DCHECK(IsValidPlane(kUPlane, format_));
data_size += strides_[kUPlane] + kFrameSizePadding;
- // FFmpeg expects the initialize allocation to be zero-initialized. Failure
- // to do so can lead to unitialized value usage. See http://crbug.com/390941
uint8* data = reinterpret_cast<uint8*>(
base::AlignedAlloc(data_size, kFrameAddressAlignment));
- memset(data, 0, data_size);
for (size_t plane = 0; plane < NumPlanes(format_); ++plane)
data_[plane] = data + offset[plane];
diff --git a/media/base/video_frame_unittest.cc b/media/base/video_frame_unittest.cc
index 5a316ac..1096766 100644
--- a/media/base/video_frame_unittest.cc
+++ b/media/base/video_frame_unittest.cc
@@ -330,19 +330,6 @@ TEST(VideoFrame,
EXPECT_EQ(release_sync_point, called_sync_point);
}
-TEST(VideoFrame, ZeroInitialized) {
- const int kWidth = 64;
- const int kHeight = 48;
- const base::TimeDelta kTimestamp = base::TimeDelta::FromMicroseconds(1337);
-
- gfx::Size size(kWidth, kHeight);
- scoped_refptr<media::VideoFrame> frame = VideoFrame::CreateFrame(
- media::PIXEL_FORMAT_YV12, size, gfx::Rect(size), size, kTimestamp);
-
- for (size_t i = 0; i < VideoFrame::NumPlanes(frame->format()); ++i)
- EXPECT_EQ(0, frame->data(i)[0]);
-}
-
TEST(VideoFrameMetadata, SetAndThenGetAllKeysForAllTypes) {
VideoFrameMetadata metadata;
diff --git a/media/filters/ffmpeg_video_decoder.cc b/media/filters/ffmpeg_video_decoder.cc
index c3f1c68..3a72677 100644
--- a/media/filters/ffmpeg_video_decoder.cc
+++ b/media/filters/ffmpeg_video_decoder.cc
@@ -127,6 +127,10 @@ int FFmpegVideoDecoder::GetVideoBuffer(struct AVCodecContext* codec_context,
scoped_refptr<VideoFrame> video_frame = frame_pool_.CreateFrame(
format, coded_size, gfx::Rect(size), natural_size, kNoTimestamp());
+#if defined(MEMORY_SANITIZER)
+ MSAN_UNPOISON(video_frame->data(0),
+ VideoFrame::AllocationSize(format, coded_size));
+#endif
// Prefer the color space from the codec context. If it's not specified (or is
// set to an unsupported value), fall back on the value from the config.