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/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 Loading... |
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 Loading... |
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 |
OLD | NEW |