From aab328bdd9921ac6fea59b299ed3c79e9e265a49 Mon Sep 17 00:00:00 2001 From: "fbarchard@chromium.org" Date: Fri, 28 May 2010 07:07:34 +0000 Subject: pad yuv additional 15 bytes to allow 16 pixels at a time to be processed without going off end of buffer. BUG=43970 TEST=play http://fbarchard0-w.ad.corp.google.com/mediatests/Etherworks-WebMadeMovies3BuildingABetterInternet799.ogg with scaling down (CTRL -). Should not crash. Review URL: http://codereview.chromium.org/2337001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48471 0039d316-1c4b-4281-b951-d872f2087c98 --- media/base/video_frame.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc index 9d81804..3e2164e 100644 --- a/media/base/video_frame.cc +++ b/media/base/video_frame.cc @@ -130,6 +130,8 @@ bool VideoFrame::AllocateRGB(size_t bytes_per_pixel) { return (NULL != data_[VideoFrame::kRGBPlane]); } +static const int kFramePadBytes = 15; // allows faster SIMD YUV convert + bool VideoFrame::AllocateYUV() { DCHECK(format_ == VideoFrame::YV12 || format_ == VideoFrame::YV16); @@ -150,7 +152,7 @@ bool VideoFrame::AllocateYUV() { if (format_ == VideoFrame::YV12) { uv_bytes /= 2; } - uint8* data = new uint8[y_bytes + (uv_bytes * 2)]; + uint8* data = new uint8[y_bytes + (uv_bytes * 2) + kFramePadBytes]; if (data) { planes_ = VideoFrame::kNumYUVPlanes; COMPILE_ASSERT(0 == VideoFrame::kYPlane, y_plane_data_must_be_index_0); -- cgit v1.1