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

Side by Side Diff: media/base/mac/video_frame_mac_unittests.cc

Issue 1154153003: Relanding 1143663007: VideoFrame: Separate Pixel Format from Storage Type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added NV12 support in CrOS Created 5 years, 6 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/mac/video_frame_mac.cc ('k') | media/base/video_decoder_config.cc » ('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/mac/video_frame_mac.h" 5 #include "media/base/mac/video_frame_mac.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 EXPECT_EQ(plane_size.width(), 54 EXPECT_EQ(plane_size.width(),
55 static_cast<int>(CVPixelBufferGetWidthOfPlane(pb, i))); 55 static_cast<int>(CVPixelBufferGetWidthOfPlane(pb, i)));
56 EXPECT_EQ(plane_size.height(), 56 EXPECT_EQ(plane_size.height(),
57 static_cast<int>(CVPixelBufferGetHeightOfPlane(pb, i))); 57 static_cast<int>(CVPixelBufferGetHeightOfPlane(pb, i)));
58 EXPECT_EQ(frame->data(i), CVPixelBufferGetBaseAddressOfPlane(pb, i)); 58 EXPECT_EQ(frame->data(i), CVPixelBufferGetBaseAddressOfPlane(pb, i));
59 } 59 }
60 CVPixelBufferUnlockBaseAddress(pb, 0); 60 CVPixelBufferUnlockBaseAddress(pb, 0);
61 } 61 }
62 62
63 TEST(VideoFrameMac, CheckFormats) { 63 TEST(VideoFrameMac, CheckFormats) {
64 // CreateFrame() does not support non planar YUV, e.g. NV12.
64 const FormatPair format_pairs[] = { 65 const FormatPair format_pairs[] = {
65 {VideoFrame::I420, kCVPixelFormatType_420YpCbCr8Planar}, 66 {VideoFrame::I420, kCVPixelFormatType_420YpCbCr8Planar},
66
67 {VideoFrame::YV12, 0}, 67 {VideoFrame::YV12, 0},
68 {VideoFrame::YV16, 0}, 68 {VideoFrame::YV16, 0},
69 {VideoFrame::YV12A, 0}, 69 {VideoFrame::YV12A, 0},
70 {VideoFrame::YV24, 0}, 70 {VideoFrame::YV24, 0},
71 }; 71 };
72 72
73 gfx::Size size(kWidth, kHeight); 73 gfx::Size size(kWidth, kHeight);
74 for (const auto& format_pair : format_pairs) { 74 for (const auto& format_pair : format_pairs) {
75 auto frame = VideoFrame::CreateFrame(format_pair.chrome, size, 75 auto frame = VideoFrame::CreateFrame(format_pair.chrome, size,
76 gfx::Rect(size), size, kTimestamp); 76 gfx::Rect(size), size, kTimestamp);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 ASSERT_TRUE(frame.get()); 124 ASSERT_TRUE(frame.get());
125 EXPECT_EQ(pb.get(), frame->cv_pixel_buffer()); 125 EXPECT_EQ(pb.get(), frame->cv_pixel_buffer());
126 EXPECT_EQ(format_pair.chrome, frame->format()); 126 EXPECT_EQ(format_pair.chrome, frame->format());
127 127
128 frame = nullptr; 128 frame = nullptr;
129 EXPECT_EQ(1, CFGetRetainCount(pb.get())); 129 EXPECT_EQ(1, CFGetRetainCount(pb.get()));
130 } 130 }
131 } 131 }
132 132
133 } // namespace media 133 } // namespace media
OLDNEW
« no previous file with comments | « media/base/mac/video_frame_mac.cc ('k') | media/base/video_decoder_config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698