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

Side by Side Diff: media/base/video_frame_unittest.cc

Issue 806413004: Plumb allow_overlay flag for video path into cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove set_allow_overlay funcs Created 5 years, 11 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 // Verify the gpu::MailboxHolder::ReleaseCallback is called when VideoFrame is 248 // Verify the gpu::MailboxHolder::ReleaseCallback is called when VideoFrame is
249 // destroyed with the default release sync point. 249 // destroyed with the default release sync point.
250 TEST(VideoFrame, TextureNoLongerNeededCallbackIsCalled) { 250 TEST(VideoFrame, TextureNoLongerNeededCallbackIsCalled) {
251 uint32 called_sync_point = 1; 251 uint32 called_sync_point = 1;
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 VideoFrame::ReadPixelsCB()); // read_pixels_cb 262 VideoFrame::ReadPixelsCB(), // read_pixels_cb
263 false); // allow_overlay
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 16 matching lines...) Expand all
289 mailbox.name[0] = 50; 290 mailbox.name[0] = 50;
290 uint32 sync_point = 7; 291 uint32 sync_point = 7;
291 uint32 target = 9; 292 uint32 target = 9;
292 uint32 release_sync_point = 111; 293 uint32 release_sync_point = 111;
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 VideoFrame::ReadPixelsCB()); // read_pixels_cb 304 VideoFrame::ReadPixelsCB(), // read_pixels_cb
305 false); // allow_overlay
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);
314 } 316 }
315 EXPECT_EQ(release_sync_point, called_sync_point); 317 EXPECT_EQ(release_sync_point, called_sync_point);
316 } 318 }
317 319
318 TEST(VideoFrame, ZeroInitialized) { 320 TEST(VideoFrame, ZeroInitialized) {
319 const int kWidth = 64; 321 const int kWidth = 64;
320 const int kHeight = 48; 322 const int kHeight = 48;
321 const base::TimeDelta kTimestamp = base::TimeDelta::FromMicroseconds(1337); 323 const base::TimeDelta kTimestamp = base::TimeDelta::FromMicroseconds(1337);
322 324
323 gfx::Size size(kWidth, kHeight); 325 gfx::Size size(kWidth, kHeight);
324 scoped_refptr<media::VideoFrame> frame = VideoFrame::CreateFrame( 326 scoped_refptr<media::VideoFrame> frame = VideoFrame::CreateFrame(
325 media::VideoFrame::YV12, size, gfx::Rect(size), size, kTimestamp); 327 media::VideoFrame::YV12, size, gfx::Rect(size), size, kTimestamp);
326 328
327 for (size_t i = 0; i < VideoFrame::NumPlanes(frame->format()); ++i) 329 for (size_t i = 0; i < VideoFrame::NumPlanes(frame->format()); ++i)
328 EXPECT_EQ(0, frame->data(i)[0]); 330 EXPECT_EQ(0, frame->data(i)[0]);
329 } 331 }
330 332
331 } // namespace media 333 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698