| 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 | 252 |
| 253 { | 253 { |
| 254 scoped_refptr<VideoFrame> frame = VideoFrame::WrapNativeTexture( | 254 scoped_refptr<VideoFrame> frame = VideoFrame::WrapNativeTexture( |
| 255 make_scoped_ptr( | 255 make_scoped_ptr( |
| 256 new gpu::MailboxHolder(gpu::Mailbox(), 5, 0 /* sync_point */)), | 256 new gpu::MailboxHolder(gpu::Mailbox(), 5, 0 /* sync_point */)), |
| 257 base::Bind(&TextureCallback, &called_sync_point), | 257 base::Bind(&TextureCallback, &called_sync_point), |
| 258 gfx::Size(10, 10), // coded_size | 258 gfx::Size(10, 10), // coded_size |
| 259 gfx::Rect(10, 10), // visible_rect | 259 gfx::Rect(10, 10), // visible_rect |
| 260 gfx::Size(10, 10), // natural_size | 260 gfx::Size(10, 10), // natural_size |
| 261 base::TimeDelta(), // timestamp | 261 base::TimeDelta(), // timestamp |
| 262 false); // allow_overlay | 262 false, // allow_overlay |
| 263 true); // has_alpha |
| 263 } | 264 } |
| 264 // Nobody set a sync point to |frame|, so |frame| set |called_sync_point| to 0 | 265 // Nobody set a sync point to |frame|, so |frame| set |called_sync_point| to 0 |
| 265 // as default value. | 266 // as default value. |
| 266 EXPECT_EQ(0u, called_sync_point); | 267 EXPECT_EQ(0u, called_sync_point); |
| 267 } | 268 } |
| 268 | 269 |
| 269 namespace { | 270 namespace { |
| 270 | 271 |
| 271 class SyncPointClientImpl : public VideoFrame::SyncPointClient { | 272 class SyncPointClientImpl : public VideoFrame::SyncPointClient { |
| 272 public: | 273 public: |
| (...skipping 20 matching lines...) Expand all Loading... |
| 293 uint32 called_sync_point = 0; | 294 uint32 called_sync_point = 0; |
| 294 | 295 |
| 295 { | 296 { |
| 296 scoped_refptr<VideoFrame> frame = VideoFrame::WrapNativeTexture( | 297 scoped_refptr<VideoFrame> frame = VideoFrame::WrapNativeTexture( |
| 297 make_scoped_ptr(new gpu::MailboxHolder(mailbox, target, sync_point)), | 298 make_scoped_ptr(new gpu::MailboxHolder(mailbox, target, sync_point)), |
| 298 base::Bind(&TextureCallback, &called_sync_point), | 299 base::Bind(&TextureCallback, &called_sync_point), |
| 299 gfx::Size(10, 10), // coded_size | 300 gfx::Size(10, 10), // coded_size |
| 300 gfx::Rect(10, 10), // visible_rect | 301 gfx::Rect(10, 10), // visible_rect |
| 301 gfx::Size(10, 10), // natural_size | 302 gfx::Size(10, 10), // natural_size |
| 302 base::TimeDelta(), // timestamp | 303 base::TimeDelta(), // timestamp |
| 303 false); // allow_overlay | 304 false, // allow_overlay |
| 305 true); // has_alpha |
| 304 | 306 |
| 305 const gpu::MailboxHolder* mailbox_holder = frame->mailbox_holder(); | 307 const gpu::MailboxHolder* mailbox_holder = frame->mailbox_holder(); |
| 306 | 308 |
| 307 EXPECT_EQ(mailbox.name[0], mailbox_holder->mailbox.name[0]); | 309 EXPECT_EQ(mailbox.name[0], mailbox_holder->mailbox.name[0]); |
| 308 EXPECT_EQ(target, mailbox_holder->texture_target); | 310 EXPECT_EQ(target, mailbox_holder->texture_target); |
| 309 EXPECT_EQ(sync_point, mailbox_holder->sync_point); | 311 EXPECT_EQ(sync_point, mailbox_holder->sync_point); |
| 310 | 312 |
| 311 SyncPointClientImpl client(release_sync_point); | 313 SyncPointClientImpl client(release_sync_point); |
| 312 frame->UpdateReleaseSyncPoint(&client); | 314 frame->UpdateReleaseSyncPoint(&client); |
| 313 EXPECT_EQ(sync_point, mailbox_holder->sync_point); | 315 EXPECT_EQ(sync_point, mailbox_holder->sync_point); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 | 403 |
| 402 for (int i = 0; i < VideoFrameMetadata::NUM_KEYS; ++i) { | 404 for (int i = 0; i < VideoFrameMetadata::NUM_KEYS; ++i) { |
| 403 const VideoFrameMetadata::Key key = static_cast<VideoFrameMetadata::Key>(i); | 405 const VideoFrameMetadata::Key key = static_cast<VideoFrameMetadata::Key>(i); |
| 404 int value = -1; | 406 int value = -1; |
| 405 EXPECT_TRUE(result.GetInteger(key, &value)); | 407 EXPECT_TRUE(result.GetInteger(key, &value)); |
| 406 EXPECT_EQ(i, value); | 408 EXPECT_EQ(i, value); |
| 407 } | 409 } |
| 408 } | 410 } |
| 409 | 411 |
| 410 } // namespace media | 412 } // namespace media |
| OLD | NEW |