| 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 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/callback_helpers.h" | 12 #include "base/callback_helpers.h" |
| 13 #include "media/base/mac/corevideo_glue.h" | |
| 14 #include "media/base/video_frame.h" | 13 #include "media/base/video_frame.h" |
| 15 | 14 |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 16 |
| 18 namespace media { | 17 namespace media { |
| 19 | 18 |
| 20 namespace { | 19 namespace { |
| 21 | 20 |
| 22 const int kWidth = 64; | 21 const int kWidth = 64; |
| 23 const int kHeight = 48; | 22 const int kHeight = 48; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 104 |
| 106 wrapper_frame = nullptr; | 105 wrapper_frame = nullptr; |
| 107 EXPECT_EQ(0, instances_destroyed); | 106 EXPECT_EQ(0, instances_destroyed); |
| 108 pb.reset(); | 107 pb.reset(); |
| 109 EXPECT_EQ(1, instances_destroyed); | 108 EXPECT_EQ(1, instances_destroyed); |
| 110 } | 109 } |
| 111 | 110 |
| 112 TEST(VideoFrameMac, CheckWrapperFrame) { | 111 TEST(VideoFrameMac, CheckWrapperFrame) { |
| 113 const FormatPair format_pairs[] = { | 112 const FormatPair format_pairs[] = { |
| 114 {PIXEL_FORMAT_I420, kCVPixelFormatType_420YpCbCr8Planar}, | 113 {PIXEL_FORMAT_I420, kCVPixelFormatType_420YpCbCr8Planar}, |
| 115 {PIXEL_FORMAT_NV12, | 114 {PIXEL_FORMAT_NV12, kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange}, |
| 116 CoreVideoGlue::kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange}, | |
| 117 }; | 115 }; |
| 118 | 116 |
| 119 const gfx::Size size(kWidth, kHeight); | 117 const gfx::Size size(kWidth, kHeight); |
| 120 for (const auto& format_pair : format_pairs) { | 118 for (const auto& format_pair : format_pairs) { |
| 121 base::ScopedCFTypeRef<CVPixelBufferRef> pb; | 119 base::ScopedCFTypeRef<CVPixelBufferRef> pb; |
| 122 CVPixelBufferCreate(nullptr, kWidth, kHeight, format_pair.corevideo, | 120 CVPixelBufferCreate(nullptr, kWidth, kHeight, format_pair.corevideo, |
| 123 nullptr, pb.InitializeInto()); | 121 nullptr, pb.InitializeInto()); |
| 124 ASSERT_TRUE(pb.get()); | 122 ASSERT_TRUE(pb.get()); |
| 125 | 123 |
| 126 auto frame = VideoFrame::WrapCVPixelBuffer(pb.get(), kTimestamp); | 124 auto frame = VideoFrame::WrapCVPixelBuffer(pb.get(), kTimestamp); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 const int index = row_index + w; | 187 const int index = row_index + w; |
| 190 EXPECT_EQ(static_cast<uint8_t>((w + offset) ^ (h + offset)), | 188 EXPECT_EQ(static_cast<uint8_t>((w + offset) ^ (h + offset)), |
| 191 plane_ptr[index]); | 189 plane_ptr[index]); |
| 192 } | 190 } |
| 193 } | 191 } |
| 194 } | 192 } |
| 195 CVPixelBufferUnlockBaseAddress(pb, 0); | 193 CVPixelBufferUnlockBaseAddress(pb, 0); |
| 196 } | 194 } |
| 197 | 195 |
| 198 } // namespace media | 196 } // namespace media |
| OLD | NEW |