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

Side by Side Diff: media/base/video_frame_unittest.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: dalecurtis@ comments. 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
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/memory/aligned_memory.h" 10 #include "base/memory/aligned_memory.h"
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 } 324 }
325 325
326 SyncPointClientImpl client(release_sync_point); 326 SyncPointClientImpl client(release_sync_point);
327 frame->UpdateReleaseSyncPoint(&client); 327 frame->UpdateReleaseSyncPoint(&client);
328 EXPECT_EQ(sync_point, 328 EXPECT_EQ(sync_point,
329 frame->mailbox_holder(VideoFrame::kYPlane).sync_point); 329 frame->mailbox_holder(VideoFrame::kYPlane).sync_point);
330 } 330 }
331 EXPECT_EQ(release_sync_point, called_sync_point); 331 EXPECT_EQ(release_sync_point, called_sync_point);
332 } 332 }
333 333
334 TEST(VideoFrame, ZeroInitialized) { 334 TEST(VideoFrame, InitializedAndZeroed) {
DaleCurtis 2015/07/09 23:29:44 Just move to the frame pool unittests?
emircan 2015/07/10 00:22:53 Done.
335 const int kWidth = 64; 335 const int kWidth = 64;
336 const int kHeight = 48; 336 const int kHeight = 48;
337 const base::TimeDelta kTimestamp = base::TimeDelta::FromMicroseconds(1337); 337 const base::TimeDelta kTimestamp = base::TimeDelta::FromMicroseconds(1337);
338 338
339 gfx::Size size(kWidth, kHeight); 339 gfx::Size size(kWidth, kHeight);
340 scoped_refptr<media::VideoFrame> frame = VideoFrame::CreateFrame( 340 scoped_refptr<media::VideoFrame> frame = VideoFrame::CreateFrame(
341 media::VideoFrame::YV12, size, gfx::Rect(size), size, kTimestamp); 341 media::VideoFrame::YV12, size, gfx::Rect(size), size, kTimestamp);
342 memset(frame->data(0), 0, VideoFrame::AlignedAllocationSize(frame));
342 343
343 for (size_t i = 0; i < VideoFrame::NumPlanes(frame->format()); ++i) 344 for (size_t i = 0; i < VideoFrame::NumPlanes(frame->format()); ++i)
344 EXPECT_EQ(0, frame->data(i)[0]); 345 EXPECT_EQ(0, frame->data(i)[0]);
345 } 346 }
346 347
347 TEST(VideoFrameMetadata, SetAndThenGetAllKeysForAllTypes) { 348 TEST(VideoFrameMetadata, SetAndThenGetAllKeysForAllTypes) {
348 VideoFrameMetadata metadata; 349 VideoFrameMetadata metadata;
349 350
350 for (int i = 0; i < VideoFrameMetadata::NUM_KEYS; ++i) { 351 for (int i = 0; i < VideoFrameMetadata::NUM_KEYS; ++i) {
351 const VideoFrameMetadata::Key key = static_cast<VideoFrameMetadata::Key>(i); 352 const VideoFrameMetadata::Key key = static_cast<VideoFrameMetadata::Key>(i);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 425
425 for (int i = 0; i < VideoFrameMetadata::NUM_KEYS; ++i) { 426 for (int i = 0; i < VideoFrameMetadata::NUM_KEYS; ++i) {
426 const VideoFrameMetadata::Key key = static_cast<VideoFrameMetadata::Key>(i); 427 const VideoFrameMetadata::Key key = static_cast<VideoFrameMetadata::Key>(i);
427 int value = -1; 428 int value = -1;
428 EXPECT_TRUE(result.GetInteger(key, &value)); 429 EXPECT_TRUE(result.GetInteger(key, &value));
429 EXPECT_EQ(i, value); 430 EXPECT_EQ(i, value);
430 } 431 }
431 } 432 }
432 433
433 } // namespace media 434 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698