| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 bool done_callback_was_run = false; | 235 bool done_callback_was_run = false; |
| 236 { | 236 { |
| 237 scoped_refptr<media::VideoFrame> wrapped_frame = | 237 scoped_refptr<media::VideoFrame> wrapped_frame = |
| 238 VideoFrame::CreateBlackFrame(gfx::Size(kWidth, kHeight)); | 238 VideoFrame::CreateBlackFrame(gfx::Size(kWidth, kHeight)); |
| 239 ASSERT_TRUE(wrapped_frame.get()); | 239 ASSERT_TRUE(wrapped_frame.get()); |
| 240 | 240 |
| 241 gfx::Rect visible_rect(1, 1, 1, 1); | 241 gfx::Rect visible_rect(1, 1, 1, 1); |
| 242 gfx::Size natural_size = visible_rect.size(); | 242 gfx::Size natural_size = visible_rect.size(); |
| 243 wrapped_frame->metadata()->SetTimeDelta( | 243 wrapped_frame->metadata()->SetTimeDelta( |
| 244 media::VideoFrameMetadata::FRAME_DURATION, kFrameDuration); | 244 media::VideoFrameMetadata::FRAME_DURATION, kFrameDuration); |
| 245 frame = media::VideoFrame::WrapVideoFrame(wrapped_frame, visible_rect, | 245 frame = media::VideoFrame::WrapVideoFrame( |
| 246 natural_size); | 246 wrapped_frame, wrapped_frame->format(), visible_rect, natural_size); |
| 247 frame->AddDestructionObserver(base::Bind( | 247 frame->AddDestructionObserver(base::Bind( |
| 248 &FrameNoLongerNeededCallback, wrapped_frame, &done_callback_was_run)); | 248 &FrameNoLongerNeededCallback, wrapped_frame, &done_callback_was_run)); |
| 249 | |
| 250 EXPECT_EQ(wrapped_frame->coded_size(), frame->coded_size()); | 249 EXPECT_EQ(wrapped_frame->coded_size(), frame->coded_size()); |
| 251 EXPECT_EQ(wrapped_frame->data(media::VideoFrame::kYPlane), | 250 EXPECT_EQ(wrapped_frame->data(media::VideoFrame::kYPlane), |
| 252 frame->data(media::VideoFrame::kYPlane)); | 251 frame->data(media::VideoFrame::kYPlane)); |
| 253 EXPECT_NE(wrapped_frame->visible_rect(), frame->visible_rect()); | 252 EXPECT_NE(wrapped_frame->visible_rect(), frame->visible_rect()); |
| 254 EXPECT_EQ(visible_rect, frame->visible_rect()); | 253 EXPECT_EQ(visible_rect, frame->visible_rect()); |
| 255 EXPECT_NE(wrapped_frame->natural_size(), frame->natural_size()); | 254 EXPECT_NE(wrapped_frame->natural_size(), frame->natural_size()); |
| 256 EXPECT_EQ(natural_size, frame->natural_size()); | 255 EXPECT_EQ(natural_size, frame->natural_size()); |
| 257 | 256 |
| 258 // Verify metadata was copied to the wrapped frame. | 257 // Verify metadata was copied to the wrapped frame. |
| 259 base::TimeDelta frame_duration; | 258 base::TimeDelta frame_duration; |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 | 506 |
| 508 for (int i = 0; i < VideoFrameMetadata::NUM_KEYS; ++i) { | 507 for (int i = 0; i < VideoFrameMetadata::NUM_KEYS; ++i) { |
| 509 const VideoFrameMetadata::Key key = static_cast<VideoFrameMetadata::Key>(i); | 508 const VideoFrameMetadata::Key key = static_cast<VideoFrameMetadata::Key>(i); |
| 510 int value = -1; | 509 int value = -1; |
| 511 EXPECT_TRUE(result.GetInteger(key, &value)); | 510 EXPECT_TRUE(result.GetInteger(key, &value)); |
| 512 EXPECT_EQ(i, value); | 511 EXPECT_EQ(i, value); |
| 513 } | 512 } |
| 514 } | 513 } |
| 515 | 514 |
| 516 } // namespace media | 515 } // namespace media |
| OLD | NEW |