OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 unsigned int device, | 162 unsigned int device, |
163 rtc::VideoSinkInterface<webrtc::VideoFrame>* callback) { | 163 rtc::VideoSinkInterface<webrtc::VideoFrame>* callback) { |
164 char device_name[256]; | 164 char device_name[256]; |
165 char unique_name[256]; | 165 char unique_name[256]; |
166 | 166 |
167 EXPECT_EQ(0, device_info_->GetDeviceName( | 167 EXPECT_EQ(0, device_info_->GetDeviceName( |
168 device, device_name, 256, unique_name, 256)); | 168 device, device_name, 256, unique_name, 256)); |
169 | 169 |
170 rtc::scoped_refptr<VideoCaptureModule> module( | 170 rtc::scoped_refptr<VideoCaptureModule> module( |
171 VideoCaptureFactory::Create(unique_name)); | 171 VideoCaptureFactory::Create(unique_name)); |
172 if (module.get() == NULL) | 172 if (module.get() == nullptr) |
173 return NULL; | 173 return nullptr; |
174 | 174 |
175 EXPECT_FALSE(module->CaptureStarted()); | 175 EXPECT_FALSE(module->CaptureStarted()); |
176 | 176 |
177 module->RegisterCaptureDataCallback(callback); | 177 module->RegisterCaptureDataCallback(callback); |
178 return module; | 178 return module; |
179 } | 179 } |
180 | 180 |
181 void StartCapture(VideoCaptureModule* capture_module, | 181 void StartCapture(VideoCaptureModule* capture_module, |
182 VideoCaptureCapability capability) { | 182 VideoCaptureCapability capability) { |
183 ASSERT_EQ(0, capture_module->StartCapture(capability)); | 183 ASSERT_EQ(0, capture_module->StartCapture(capability)); |
(...skipping 15 matching lines...) Expand all Loading... |
199 #define MAYBE_CreateDelete DISABLED_CreateDelete | 199 #define MAYBE_CreateDelete DISABLED_CreateDelete |
200 #else | 200 #else |
201 #define MAYBE_CreateDelete CreateDelete | 201 #define MAYBE_CreateDelete CreateDelete |
202 #endif | 202 #endif |
203 TEST_F(VideoCaptureTest, MAYBE_CreateDelete) { | 203 TEST_F(VideoCaptureTest, MAYBE_CreateDelete) { |
204 for (int i = 0; i < 5; ++i) { | 204 for (int i = 0; i < 5; ++i) { |
205 int64_t start_time = rtc::TimeMillis(); | 205 int64_t start_time = rtc::TimeMillis(); |
206 TestVideoCaptureCallback capture_observer; | 206 TestVideoCaptureCallback capture_observer; |
207 rtc::scoped_refptr<VideoCaptureModule> module( | 207 rtc::scoped_refptr<VideoCaptureModule> module( |
208 OpenVideoCaptureDevice(0, &capture_observer)); | 208 OpenVideoCaptureDevice(0, &capture_observer)); |
209 ASSERT_TRUE(module.get() != NULL); | 209 ASSERT_TRUE(module.get() != nullptr); |
210 | 210 |
211 VideoCaptureCapability capability; | 211 VideoCaptureCapability capability; |
212 #ifndef WEBRTC_MAC | 212 #ifndef WEBRTC_MAC |
213 device_info_->GetCapability(module->CurrentDeviceName(), 0, capability); | 213 device_info_->GetCapability(module->CurrentDeviceName(), 0, capability); |
214 #else | 214 #else |
215 capability.width = kTestWidth; | 215 capability.width = kTestWidth; |
216 capability.height = kTestHeight; | 216 capability.height = kTestHeight; |
217 capability.maxFPS = kTestFramerate; | 217 capability.maxFPS = kTestFramerate; |
218 capability.rawType = webrtc::kVideoUnknown; | 218 capability.rawType = webrtc::kVideoUnknown; |
219 #endif | 219 #endif |
(...skipping 25 matching lines...) Expand all Loading... |
245 TEST_F(VideoCaptureTest, MAYBE_Capabilities) { | 245 TEST_F(VideoCaptureTest, MAYBE_Capabilities) { |
246 #ifdef WEBRTC_MAC | 246 #ifdef WEBRTC_MAC |
247 printf("Video capture capabilities are not supported on Mac.\n"); | 247 printf("Video capture capabilities are not supported on Mac.\n"); |
248 return; | 248 return; |
249 #endif | 249 #endif |
250 | 250 |
251 TestVideoCaptureCallback capture_observer; | 251 TestVideoCaptureCallback capture_observer; |
252 | 252 |
253 rtc::scoped_refptr<VideoCaptureModule> module( | 253 rtc::scoped_refptr<VideoCaptureModule> module( |
254 OpenVideoCaptureDevice(0, &capture_observer)); | 254 OpenVideoCaptureDevice(0, &capture_observer)); |
255 ASSERT_TRUE(module.get() != NULL); | 255 ASSERT_TRUE(module.get() != nullptr); |
256 | 256 |
257 int number_of_capabilities = device_info_->NumberOfCapabilities( | 257 int number_of_capabilities = device_info_->NumberOfCapabilities( |
258 module->CurrentDeviceName()); | 258 module->CurrentDeviceName()); |
259 EXPECT_GT(number_of_capabilities, 0); | 259 EXPECT_GT(number_of_capabilities, 0); |
260 // Key is <width>x<height>, value is vector of maxFPS values at that | 260 // Key is <width>x<height>, value is vector of maxFPS values at that |
261 // resolution. | 261 // resolution. |
262 typedef std::map<std::string, std::vector<int> > FrameRatesByResolution; | 262 typedef std::map<std::string, std::vector<int> > FrameRatesByResolution; |
263 FrameRatesByResolution frame_rates_by_resolution; | 263 FrameRatesByResolution frame_rates_by_resolution; |
264 for (int i = 0; i < number_of_capabilities; ++i) { | 264 for (int i = 0; i < number_of_capabilities; ++i) { |
265 VideoCaptureCapability capability; | 265 VideoCaptureCapability capability; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 // http://code.google.com/p/webrtc/issues/detail?id=777 | 307 // http://code.google.com/p/webrtc/issues/detail?id=777 |
308 TEST_F(VideoCaptureTest, DISABLED_TestTwoCameras) { | 308 TEST_F(VideoCaptureTest, DISABLED_TestTwoCameras) { |
309 if (number_of_devices_ < 2) { | 309 if (number_of_devices_ < 2) { |
310 printf("There are not two cameras available. Aborting test. \n"); | 310 printf("There are not two cameras available. Aborting test. \n"); |
311 return; | 311 return; |
312 } | 312 } |
313 | 313 |
314 TestVideoCaptureCallback capture_observer1; | 314 TestVideoCaptureCallback capture_observer1; |
315 rtc::scoped_refptr<VideoCaptureModule> module1( | 315 rtc::scoped_refptr<VideoCaptureModule> module1( |
316 OpenVideoCaptureDevice(0, &capture_observer1)); | 316 OpenVideoCaptureDevice(0, &capture_observer1)); |
317 ASSERT_TRUE(module1.get() != NULL); | 317 ASSERT_TRUE(module1.get() != nullptr); |
318 VideoCaptureCapability capability1; | 318 VideoCaptureCapability capability1; |
319 #ifndef WEBRTC_MAC | 319 #ifndef WEBRTC_MAC |
320 device_info_->GetCapability(module1->CurrentDeviceName(), 0, capability1); | 320 device_info_->GetCapability(module1->CurrentDeviceName(), 0, capability1); |
321 #else | 321 #else |
322 capability1.width = kTestWidth; | 322 capability1.width = kTestWidth; |
323 capability1.height = kTestHeight; | 323 capability1.height = kTestHeight; |
324 capability1.maxFPS = kTestFramerate; | 324 capability1.maxFPS = kTestFramerate; |
325 capability1.rawType = webrtc::kVideoUnknown; | 325 capability1.rawType = webrtc::kVideoUnknown; |
326 #endif | 326 #endif |
327 capture_observer1.SetExpectedCapability(capability1); | 327 capture_observer1.SetExpectedCapability(capability1); |
328 | 328 |
329 TestVideoCaptureCallback capture_observer2; | 329 TestVideoCaptureCallback capture_observer2; |
330 rtc::scoped_refptr<VideoCaptureModule> module2( | 330 rtc::scoped_refptr<VideoCaptureModule> module2( |
331 OpenVideoCaptureDevice(1, &capture_observer2)); | 331 OpenVideoCaptureDevice(1, &capture_observer2)); |
332 ASSERT_TRUE(module1.get() != NULL); | 332 ASSERT_TRUE(module1.get() != nullptr); |
333 | |
334 | 333 |
335 VideoCaptureCapability capability2; | 334 VideoCaptureCapability capability2; |
336 #ifndef WEBRTC_MAC | 335 #ifndef WEBRTC_MAC |
337 device_info_->GetCapability(module2->CurrentDeviceName(), 0, capability2); | 336 device_info_->GetCapability(module2->CurrentDeviceName(), 0, capability2); |
338 #else | 337 #else |
339 capability2.width = kTestWidth; | 338 capability2.width = kTestWidth; |
340 capability2.height = kTestHeight; | 339 capability2.height = kTestHeight; |
341 capability2.maxFPS = kTestFramerate; | 340 capability2.maxFPS = kTestFramerate; |
342 capability2.rawType = webrtc::kVideoUnknown; | 341 capability2.rawType = webrtc::kVideoUnknown; |
343 #endif | 342 #endif |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 length, capture_callback_.capability(), 0)); | 417 length, capture_callback_.capability(), 0)); |
419 EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_180)); | 418 EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_180)); |
420 capture_callback_.SetExpectedCaptureRotation(webrtc::kVideoRotation_180); | 419 capture_callback_.SetExpectedCaptureRotation(webrtc::kVideoRotation_180); |
421 EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(), | 420 EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(), |
422 length, capture_callback_.capability(), 0)); | 421 length, capture_callback_.capability(), 0)); |
423 EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_270)); | 422 EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_270)); |
424 capture_callback_.SetExpectedCaptureRotation(webrtc::kVideoRotation_270); | 423 capture_callback_.SetExpectedCaptureRotation(webrtc::kVideoRotation_270); |
425 EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(), | 424 EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(), |
426 length, capture_callback_.capability(), 0)); | 425 length, capture_callback_.capability(), 0)); |
427 } | 426 } |
OLD | NEW |