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/include/process_thread.h" | 20 #include "webrtc/modules/utility/include/process_thread.h" |
21 #include "webrtc/modules/video_capture/video_capture.h" | 21 #include "webrtc/modules/video_capture/video_capture.h" |
22 #include "webrtc/modules/video_capture/video_capture_factory.h" | 22 #include "webrtc/modules/video_capture/video_capture_factory.h" |
23 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | 23 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
24 #include "webrtc/system_wrappers/include/sleep.h" | 24 #include "webrtc/system_wrappers/include/sleep.h" |
25 #include "webrtc/system_wrappers/include/tick_util.h" | 25 #include "webrtc/system_wrappers/include/tick_util.h" |
26 #include "webrtc/test/testsupport/gtest_disable.h" | |
27 #include "webrtc/video_frame.h" | 26 #include "webrtc/video_frame.h" |
28 | 27 |
29 using rtc::scoped_ptr; | 28 using rtc::scoped_ptr; |
30 using webrtc::CriticalSectionWrapper; | 29 using webrtc::CriticalSectionWrapper; |
31 using webrtc::CriticalSectionScoped; | 30 using webrtc::CriticalSectionScoped; |
32 using webrtc::SleepMs; | 31 using webrtc::SleepMs; |
33 using webrtc::TickTime; | 32 using webrtc::TickTime; |
34 using webrtc::VideoCaptureAlarm; | 33 using webrtc::VideoCaptureAlarm; |
35 using webrtc::VideoCaptureCapability; | 34 using webrtc::VideoCaptureCapability; |
36 using webrtc::VideoCaptureDataCallback; | 35 using webrtc::VideoCaptureDataCallback; |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 test_frame_.height()); | 471 test_frame_.height()); |
473 scoped_ptr<uint8_t[]> test_buffer(new uint8_t[length]); | 472 scoped_ptr<uint8_t[]> test_buffer(new uint8_t[length]); |
474 webrtc::ExtractBuffer(test_frame_, length, test_buffer.get()); | 473 webrtc::ExtractBuffer(test_frame_, length, test_buffer.get()); |
475 EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(), | 474 EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(), |
476 length, capture_callback_.capability(), 0)); | 475 length, capture_callback_.capability(), 0)); |
477 EXPECT_TRUE(capture_callback_.CompareLastFrame(test_frame_)); | 476 EXPECT_TRUE(capture_callback_.CompareLastFrame(test_frame_)); |
478 } | 477 } |
479 | 478 |
480 // Test frame rate and no picture alarm. | 479 // Test frame rate and no picture alarm. |
481 // Flaky on Win32, see webrtc:3270. | 480 // Flaky on Win32, see webrtc:3270. |
482 TEST_F(VideoCaptureExternalTest, DISABLED_ON_WIN(FrameRate)) { | 481 #if defined(WEBRTC_WIN) |
| 482 #define MAYBE_FrameRate DISABLED_FrameRate |
| 483 #else |
| 484 #define MAYBE_FrameRate FrameRate |
| 485 #endif |
| 486 TEST_F(VideoCaptureExternalTest, MAYBE_FrameRate) { |
483 int64_t testTime = 3; | 487 int64_t testTime = 3; |
484 TickTime startTime = TickTime::Now(); | 488 TickTime startTime = TickTime::Now(); |
485 | 489 |
486 while ((TickTime::Now() - startTime).Milliseconds() < testTime * 1000) { | 490 while ((TickTime::Now() - startTime).Milliseconds() < testTime * 1000) { |
487 size_t length = webrtc::CalcBufferSize(webrtc::kI420, | 491 size_t length = webrtc::CalcBufferSize(webrtc::kI420, |
488 test_frame_.width(), | 492 test_frame_.width(), |
489 test_frame_.height()); | 493 test_frame_.height()); |
490 scoped_ptr<uint8_t[]> test_buffer(new uint8_t[length]); | 494 scoped_ptr<uint8_t[]> test_buffer(new uint8_t[length]); |
491 webrtc::ExtractBuffer(test_frame_, length, test_buffer.get()); | 495 webrtc::ExtractBuffer(test_frame_, length, test_buffer.get()); |
492 EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(), | 496 EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(), |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 length, capture_callback_.capability(), 0)); | 535 length, capture_callback_.capability(), 0)); |
532 EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_180)); | 536 EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_180)); |
533 capture_callback_.SetExpectedCaptureRotation(webrtc::kVideoRotation_180); | 537 capture_callback_.SetExpectedCaptureRotation(webrtc::kVideoRotation_180); |
534 EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(), | 538 EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(), |
535 length, capture_callback_.capability(), 0)); | 539 length, capture_callback_.capability(), 0)); |
536 EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_270)); | 540 EXPECT_EQ(0, capture_module_->SetCaptureRotation(webrtc::kVideoRotation_270)); |
537 capture_callback_.SetExpectedCaptureRotation(webrtc::kVideoRotation_270); | 541 capture_callback_.SetExpectedCaptureRotation(webrtc::kVideoRotation_270); |
538 EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(), | 542 EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(), |
539 length, capture_callback_.capability(), 0)); | 543 length, capture_callback_.capability(), 0)); |
540 } | 544 } |
OLD | NEW |