| 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 |
| 11 #include <stdio.h> | 11 #include <stdio.h> |
| 12 | 12 |
| 13 #include <map> | 13 #include <map> |
| 14 #include <sstream> | 14 #include <sstream> |
| 15 | 15 |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 #include "webrtc/base/scoped_ptr.h" | 17 #include "webrtc/base/scoped_ptr.h" |
| 18 #include "webrtc/base/scoped_ref_ptr.h" | 18 #include "webrtc/base/scoped_ref_ptr.h" |
| 19 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 19 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
| 20 #include "webrtc/modules/utility/interface/process_thread.h" | 20 #include "webrtc/modules/utility/interface/process_thread.h" |
| 21 #include "webrtc/modules/video_capture/ensure_initialized.h" | |
| 22 #include "webrtc/modules/video_capture/include/video_capture.h" | 21 #include "webrtc/modules/video_capture/include/video_capture.h" |
| 23 #include "webrtc/modules/video_capture/include/video_capture_factory.h" | 22 #include "webrtc/modules/video_capture/include/video_capture_factory.h" |
| 24 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" | 23 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" |
| 25 #include "webrtc/system_wrappers/interface/sleep.h" | 24 #include "webrtc/system_wrappers/interface/sleep.h" |
| 26 #include "webrtc/system_wrappers/interface/tick_util.h" | 25 #include "webrtc/system_wrappers/interface/tick_util.h" |
| 27 #include "webrtc/test/testsupport/gtest_disable.h" | 26 #include "webrtc/test/testsupport/gtest_disable.h" |
| 28 #include "webrtc/video_frame.h" | 27 #include "webrtc/video_frame.h" |
| 29 | 28 |
| 30 using rtc::scoped_ptr; | 29 using rtc::scoped_ptr; |
| 31 using webrtc::CriticalSectionWrapper; | 30 using webrtc::CriticalSectionWrapper; |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 scoped_ptr<CriticalSectionWrapper> capture_cs_; | 227 scoped_ptr<CriticalSectionWrapper> capture_cs_; |
| 229 unsigned int frame_rate_; | 228 unsigned int frame_rate_; |
| 230 VideoCaptureAlarm alarm_; | 229 VideoCaptureAlarm alarm_; |
| 231 }; | 230 }; |
| 232 | 231 |
| 233 class VideoCaptureTest : public testing::Test { | 232 class VideoCaptureTest : public testing::Test { |
| 234 public: | 233 public: |
| 235 VideoCaptureTest() : number_of_devices_(0) {} | 234 VideoCaptureTest() : number_of_devices_(0) {} |
| 236 | 235 |
| 237 void SetUp() { | 236 void SetUp() { |
| 238 webrtc::videocapturemodule::EnsureInitialized(); | |
| 239 device_info_.reset(VideoCaptureFactory::CreateDeviceInfo(0)); | 237 device_info_.reset(VideoCaptureFactory::CreateDeviceInfo(0)); |
| 240 assert(device_info_.get()); | 238 assert(device_info_.get()); |
| 241 number_of_devices_ = device_info_->NumberOfDevices(); | 239 number_of_devices_ = device_info_->NumberOfDevices(); |
| 242 ASSERT_GT(number_of_devices_, 0u); | 240 ASSERT_GT(number_of_devices_, 0u); |
| 243 } | 241 } |
| 244 | 242 |
| 245 rtc::scoped_refptr<VideoCaptureModule> OpenVideoCaptureDevice( | 243 rtc::scoped_refptr<VideoCaptureModule> OpenVideoCaptureDevice( |
| 246 unsigned int device, | 244 unsigned int device, |
| 247 VideoCaptureDataCallback* callback) { | 245 VideoCaptureDataCallback* callback) { |
| 248 char device_name[256]; | 246 char device_name[256]; |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 length, capture_callback_.capability(), 0)); | 531 length, capture_callback_.capability(), 0)); |
| 534 EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_180)); | 532 EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_180)); |
| 535 capture_callback_.SetExpectedCaptureRotation(webrtc::kVideoRotation_180); | 533 capture_callback_.SetExpectedCaptureRotation(webrtc::kVideoRotation_180); |
| 536 EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(), | 534 EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(), |
| 537 length, capture_callback_.capability(), 0)); | 535 length, capture_callback_.capability(), 0)); |
| 538 EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_270)); | 536 EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_270)); |
| 539 capture_callback_.SetExpectedCaptureRotation(webrtc::kVideoRotation_270); | 537 capture_callback_.SetExpectedCaptureRotation(webrtc::kVideoRotation_270); |
| 540 EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(), | 538 EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(), |
| 541 length, capture_callback_.capability(), 0)); | 539 length, capture_callback_.capability(), 0)); |
| 542 } | 540 } |
| OLD | NEW |