OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 |
OLD | NEW |