| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 // The usual ReserveOutputBuffer() -> OnIncomingCapturedVideoFrame() cannot | 137 // The usual ReserveOutputBuffer() -> OnIncomingCapturedVideoFrame() cannot |
| 138 // be used since it does not accept all pixel formats. The memory backed | 138 // be used since it does not accept all pixel formats. The memory backed |
| 139 // buffer OnIncomingCapturedData() is used instead, with a dummy scratchpad | 139 // buffer OnIncomingCapturedData() is used instead, with a dummy scratchpad |
| 140 // buffer. | 140 // buffer. |
| 141 const size_t kScratchpadSizeInBytes = 400; | 141 const size_t kScratchpadSizeInBytes = 400; |
| 142 unsigned char data[kScratchpadSizeInBytes] = {}; | 142 unsigned char data[kScratchpadSizeInBytes] = {}; |
| 143 const gfx::Size capture_resolution(10, 10); | 143 const gfx::Size capture_resolution(10, 10); |
| 144 ASSERT_GE(kScratchpadSizeInBytes, capture_resolution.GetArea() * 4u) | 144 ASSERT_GE(kScratchpadSizeInBytes, capture_resolution.GetArea() * 4u) |
| 145 << "Scratchpad is too small to hold the largest pixel format (ARGB)."; | 145 << "Scratchpad is too small to hold the largest pixel format (ARGB)."; |
| 146 | 146 |
| 147 for (int format = 0; format < media::PIXEL_FORMAT_MAX; | 147 for (int format = 0; format < media::PIXEL_FORMAT_MAX; ++format) { |
| 148 ++format) { | |
| 149 // Conversion from some formats are unsupported. | 148 // Conversion from some formats are unsupported. |
| 150 if (format == media::PIXEL_FORMAT_UNKNOWN || | 149 if (format == media::PIXEL_FORMAT_UNKNOWN || |
| 151 format == media::PIXEL_FORMAT_YV16 || | 150 format == media::PIXEL_FORMAT_YV16 || |
| 152 format == media::PIXEL_FORMAT_YV12A || | 151 format == media::PIXEL_FORMAT_YV12A || |
| 153 format == media::PIXEL_FORMAT_YV24 || | 152 format == media::PIXEL_FORMAT_YV24 || |
| 154 format == media::PIXEL_FORMAT_ARGB || | 153 format == media::PIXEL_FORMAT_ARGB || |
| 155 format == media::PIXEL_FORMAT_XRGB || | 154 format == media::PIXEL_FORMAT_XRGB || |
| 156 format == media::PIXEL_FORMAT_MJPEG || | 155 format == media::PIXEL_FORMAT_MJPEG || |
| 157 format == media::PIXEL_FORMAT_MT21) { | 156 format == media::PIXEL_FORMAT_MT21) { |
| 158 continue; | 157 continue; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 216 |
| 218 EXPECT_EQ(coded_size.width(), size_and_rotation.output_resolution.width()); | 217 EXPECT_EQ(coded_size.width(), size_and_rotation.output_resolution.width()); |
| 219 EXPECT_EQ(coded_size.height(), | 218 EXPECT_EQ(coded_size.height(), |
| 220 size_and_rotation.output_resolution.height()); | 219 size_and_rotation.output_resolution.height()); |
| 221 | 220 |
| 222 Mock::VerifyAndClearExpectations(controller_.get()); | 221 Mock::VerifyAndClearExpectations(controller_.get()); |
| 223 } | 222 } |
| 224 } | 223 } |
| 225 | 224 |
| 226 } // namespace content | 225 } // namespace content |
| OLD | NEW |