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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 116 |
117 const gfx::Size size(kWidth, kHeight); | 117 const gfx::Size size(kWidth, kHeight); |
118 for (const auto& format_pair : format_pairs) { | 118 for (const auto& format_pair : format_pairs) { |
119 base::ScopedCFTypeRef<CVPixelBufferRef> pb; | 119 base::ScopedCFTypeRef<CVPixelBufferRef> pb; |
120 CVPixelBufferCreate(nullptr, kWidth, kHeight, format_pair.corevideo, | 120 CVPixelBufferCreate(nullptr, kWidth, kHeight, format_pair.corevideo, |
121 nullptr, pb.InitializeInto()); | 121 nullptr, pb.InitializeInto()); |
122 ASSERT_TRUE(pb.get()); | 122 ASSERT_TRUE(pb.get()); |
123 | 123 |
124 auto frame = VideoFrame::WrapCVPixelBuffer(pb.get(), kTimestamp); | 124 auto frame = VideoFrame::WrapCVPixelBuffer(pb.get(), kTimestamp); |
125 ASSERT_TRUE(frame.get()); | 125 ASSERT_TRUE(frame.get()); |
126 EXPECT_EQ(pb.get(), frame->cv_pixel_buffer()); | 126 EXPECT_EQ(pb.get(), frame->CvPixelBuffer()); |
127 EXPECT_EQ(format_pair.chrome, frame->format()); | 127 EXPECT_EQ(format_pair.chrome, frame->format()); |
128 | 128 |
129 frame = nullptr; | 129 frame = nullptr; |
130 EXPECT_EQ(1, CFGetRetainCount(pb.get())); | 130 EXPECT_EQ(1, CFGetRetainCount(pb.get())); |
131 } | 131 } |
132 } | 132 } |
133 | 133 |
134 static void FillFrameWithPredictableValues(const VideoFrame& frame) { | 134 static void FillFrameWithPredictableValues(const VideoFrame& frame) { |
135 for (size_t i = 0; i < VideoFrame::NumPlanes(frame.format()); ++i) { | 135 for (size_t i = 0; i < VideoFrame::NumPlanes(frame.format()); ++i) { |
136 const gfx::Size& size = | 136 const gfx::Size& size = |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 const int index = row_index + w; | 187 const int index = row_index + w; |
188 EXPECT_EQ(static_cast<uint8_t>((w + offset) ^ (h + offset)), | 188 EXPECT_EQ(static_cast<uint8_t>((w + offset) ^ (h + offset)), |
189 plane_ptr[index]); | 189 plane_ptr[index]); |
190 } | 190 } |
191 } | 191 } |
192 } | 192 } |
193 CVPixelBufferUnlockBaseAddress(pb, 0); | 193 CVPixelBufferUnlockBaseAddress(pb, 0); |
194 } | 194 } |
195 | 195 |
196 } // namespace media | 196 } // namespace media |
OLD | NEW |