OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 // If we don't have a WebRtcVideoFrame, just skip all of these tests. | 11 // If we don't have a WebRtcVideoFrame, just skip all of these tests. |
12 #if defined(HAVE_WEBRTC_VIDEO) | 12 #if defined(HAVE_WEBRTC_VIDEO) |
13 #include <limits.h> // For INT_MAX | 13 #include <limits.h> // For INT_MAX |
| 14 |
| 15 #include <memory> |
14 #include <string> | 16 #include <string> |
15 #include <vector> | 17 #include <vector> |
16 | 18 |
17 #include "webrtc/base/gunit.h" | 19 #include "webrtc/base/gunit.h" |
18 #include "webrtc/base/logging.h" | 20 #include "webrtc/base/logging.h" |
19 #include "webrtc/base/sigslot.h" | 21 #include "webrtc/base/sigslot.h" |
20 #include "webrtc/media/base/fakevideocapturer.h" | 22 #include "webrtc/media/base/fakevideocapturer.h" |
21 #include "webrtc/media/base/mediachannel.h" | 23 #include "webrtc/media/base/mediachannel.h" |
22 #include "webrtc/media/base/testutils.h" | 24 #include "webrtc/media/base/testutils.h" |
23 #include "webrtc/media/base/videoadapter.h" | 25 #include "webrtc/media/base/videoadapter.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 bool received_cpu_signal_; | 127 bool received_cpu_signal_; |
126 }; | 128 }; |
127 | 129 |
128 void VerifyAdaptedResolution(const VideoCapturerListener::Stats& stats, | 130 void VerifyAdaptedResolution(const VideoCapturerListener::Stats& stats, |
129 int width, | 131 int width, |
130 int height) { | 132 int height) { |
131 EXPECT_EQ(width, stats.adapted_width); | 133 EXPECT_EQ(width, stats.adapted_width); |
132 EXPECT_EQ(height, stats.adapted_height); | 134 EXPECT_EQ(height, stats.adapted_height); |
133 } | 135 } |
134 | 136 |
135 rtc::scoped_ptr<FakeVideoCapturer> capturer_; | 137 std::unique_ptr<FakeVideoCapturer> capturer_; |
136 rtc::scoped_ptr<VideoAdapter> adapter_; | 138 std::unique_ptr<VideoAdapter> adapter_; |
137 rtc::scoped_ptr<VideoCapturerListener> listener_; | 139 std::unique_ptr<VideoCapturerListener> listener_; |
138 VideoFormat capture_format_; | 140 VideoFormat capture_format_; |
139 }; | 141 }; |
140 | 142 |
141 | 143 |
142 // Test adapter remembers exact pixel count | 144 // Test adapter remembers exact pixel count |
143 TEST_F(VideoAdapterTest, AdaptNumPixels) { | 145 TEST_F(VideoAdapterTest, AdaptNumPixels) { |
144 adapter_->SetOutputNumPixels(123456); | 146 adapter_->SetOutputNumPixels(123456); |
145 EXPECT_EQ(123456, adapter_->GetOutputNumPixels()); | 147 EXPECT_EQ(123456, adapter_->GetOutputNumPixels()); |
146 } | 148 } |
147 | 149 |
(...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1281 // it gets all the way there. | 1283 // it gets all the way there. |
1282 for (size_t i = 0; i < 10; ++i) { | 1284 for (size_t i = 0; i < 10; ++i) { |
1283 UpdateCpuLoad(&adapter, 1, 1, 0.5f, 0.5f); | 1285 UpdateCpuLoad(&adapter, 1, 1, 0.5f, 0.5f); |
1284 } | 1286 } |
1285 EXPECT_EQ(640, adapter.output_format().width); | 1287 EXPECT_EQ(640, adapter.output_format().width); |
1286 EXPECT_EQ(360, adapter.output_format().height); | 1288 EXPECT_EQ(360, adapter.output_format().height); |
1287 } | 1289 } |
1288 | 1290 |
1289 } // namespace cricket | 1291 } // namespace cricket |
1290 #endif // HAVE_WEBRTC_VIDEO | 1292 #endif // HAVE_WEBRTC_VIDEO |
OLD | NEW |