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

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

Issue 1737253002: Handle Alpha channel in Canvas capture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: bbudge@ nit. Created 4 years, 9 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
« no previous file with comments | « media/base/video_frame_pool.cc ('k') | media/base/video_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <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
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
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
OLDNEW
« no previous file with comments | « media/base/video_frame_pool.cc ('k') | media/base/video_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698