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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 } | 323 } |
324 | 324 |
325 SyncPointClientImpl client(release_sync_point); | 325 SyncPointClientImpl client(release_sync_point); |
326 frame->UpdateReleaseSyncPoint(&client); | 326 frame->UpdateReleaseSyncPoint(&client); |
327 EXPECT_EQ(sync_point, | 327 EXPECT_EQ(sync_point, |
328 frame->mailbox_holder(VideoFrame::kYPlane).sync_point); | 328 frame->mailbox_holder(VideoFrame::kYPlane).sync_point); |
329 } | 329 } |
330 EXPECT_EQ(release_sync_point, called_sync_point); | 330 EXPECT_EQ(release_sync_point, called_sync_point); |
331 } | 331 } |
332 | 332 |
333 TEST(VideoFrame, ZeroInitialized) { | |
334 const int kWidth = 64; | |
335 const int kHeight = 48; | |
336 const base::TimeDelta kTimestamp = base::TimeDelta::FromMicroseconds(1337); | |
337 | |
338 gfx::Size size(kWidth, kHeight); | |
339 scoped_refptr<media::VideoFrame> frame = VideoFrame::CreateFrame( | |
340 media::PIXEL_FORMAT_YV12, size, gfx::Rect(size), size, kTimestamp); | |
341 | |
342 for (size_t i = 0; i < VideoFrame::NumPlanes(frame->format()); ++i) | |
343 EXPECT_EQ(0, frame->data(i)[0]); | |
344 } | |
345 | |
346 TEST(VideoFrameMetadata, SetAndThenGetAllKeysForAllTypes) { | 333 TEST(VideoFrameMetadata, SetAndThenGetAllKeysForAllTypes) { |
347 VideoFrameMetadata metadata; | 334 VideoFrameMetadata metadata; |
348 | 335 |
349 for (int i = 0; i < VideoFrameMetadata::NUM_KEYS; ++i) { | 336 for (int i = 0; i < VideoFrameMetadata::NUM_KEYS; ++i) { |
350 const VideoFrameMetadata::Key key = static_cast<VideoFrameMetadata::Key>(i); | 337 const VideoFrameMetadata::Key key = static_cast<VideoFrameMetadata::Key>(i); |
351 | 338 |
352 EXPECT_FALSE(metadata.HasKey(key)); | 339 EXPECT_FALSE(metadata.HasKey(key)); |
353 metadata.SetBoolean(key, true); | 340 metadata.SetBoolean(key, true); |
354 EXPECT_TRUE(metadata.HasKey(key)); | 341 EXPECT_TRUE(metadata.HasKey(key)); |
355 bool bool_value = false; | 342 bool bool_value = false; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 | 410 |
424 for (int i = 0; i < VideoFrameMetadata::NUM_KEYS; ++i) { | 411 for (int i = 0; i < VideoFrameMetadata::NUM_KEYS; ++i) { |
425 const VideoFrameMetadata::Key key = static_cast<VideoFrameMetadata::Key>(i); | 412 const VideoFrameMetadata::Key key = static_cast<VideoFrameMetadata::Key>(i); |
426 int value = -1; | 413 int value = -1; |
427 EXPECT_TRUE(result.GetInteger(key, &value)); | 414 EXPECT_TRUE(result.GetInteger(key, &value)); |
428 EXPECT_EQ(i, value); | 415 EXPECT_EQ(i, value); |
429 } | 416 } |
430 } | 417 } |
431 | 418 |
432 } // namespace media | 419 } // namespace media |
OLD | NEW |