OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2008 Google Inc. | 3 * Copyright 2008 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 26 matching lines...) Expand all Loading... |
37 #include "webrtc/base/logging.h" | 37 #include "webrtc/base/logging.h" |
38 #include "webrtc/base/thread.h" | 38 #include "webrtc/base/thread.h" |
39 | 39 |
40 using cricket::FakeVideoCapturer; | 40 using cricket::FakeVideoCapturer; |
41 | 41 |
42 namespace { | 42 namespace { |
43 | 43 |
44 const int kMsCallbackWait = 500; | 44 const int kMsCallbackWait = 500; |
45 // For HD only the height matters. | 45 // For HD only the height matters. |
46 const int kMinHdHeight = 720; | 46 const int kMinHdHeight = 720; |
47 const uint32 kTimeout = 5000U; | 47 const uint32_t kTimeout = 5000U; |
48 | 48 |
49 } // namespace | 49 } // namespace |
50 | 50 |
51 class VideoCapturerTest | 51 class VideoCapturerTest |
52 : public sigslot::has_slots<>, | 52 : public sigslot::has_slots<>, |
53 public testing::Test { | 53 public testing::Test { |
54 public: | 54 public: |
55 VideoCapturerTest() | 55 VideoCapturerTest() |
56 : capture_state_(cricket::CS_STOPPED), | 56 : capture_state_(cricket::CS_STOPPED), |
57 num_state_changes_(0), | 57 num_state_changes_(0), |
(...skipping 23 matching lines...) Expand all Loading... |
81 void OnStateChange(cricket::VideoCapturer*, | 81 void OnStateChange(cricket::VideoCapturer*, |
82 cricket::CaptureState capture_state) { | 82 cricket::CaptureState capture_state) { |
83 capture_state_ = capture_state; | 83 capture_state_ = capture_state; |
84 ++num_state_changes_; | 84 ++num_state_changes_; |
85 } | 85 } |
86 cricket::CaptureState capture_state() { return capture_state_; } | 86 cricket::CaptureState capture_state() { return capture_state_; } |
87 int num_state_changes() { return num_state_changes_; } | 87 int num_state_changes() { return num_state_changes_; } |
88 int video_frames_received() const { | 88 int video_frames_received() const { |
89 return video_frames_received_; | 89 return video_frames_received_; |
90 } | 90 } |
91 int64 last_frame_elapsed_time() const { return last_frame_elapsed_time_; } | 91 int64_t last_frame_elapsed_time() const { return last_frame_elapsed_time_; } |
92 | 92 |
93 cricket::FakeVideoCapturer capturer_; | 93 cricket::FakeVideoCapturer capturer_; |
94 cricket::CaptureState capture_state_; | 94 cricket::CaptureState capture_state_; |
95 int num_state_changes_; | 95 int num_state_changes_; |
96 int video_frames_received_; | 96 int video_frames_received_; |
97 int64 last_frame_elapsed_time_; | 97 int64_t last_frame_elapsed_time_; |
98 cricket::FakeVideoRenderer renderer_; | 98 cricket::FakeVideoRenderer renderer_; |
99 bool expects_rotation_applied_; | 99 bool expects_rotation_applied_; |
100 }; | 100 }; |
101 | 101 |
102 TEST_F(VideoCapturerTest, CaptureState) { | 102 TEST_F(VideoCapturerTest, CaptureState) { |
103 EXPECT_TRUE(capturer_.enable_video_adapter()); | 103 EXPECT_TRUE(capturer_.enable_video_adapter()); |
104 EXPECT_EQ(cricket::CS_RUNNING, capturer_.Start(cricket::VideoFormat( | 104 EXPECT_EQ(cricket::CS_RUNNING, capturer_.Start(cricket::VideoFormat( |
105 640, | 105 640, |
106 480, | 106 480, |
107 cricket::VideoFormat::FpsToInterval(30), | 107 cricket::VideoFormat::FpsToInterval(30), |
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 capturer_.set_enable_camera_list(true); | 844 capturer_.set_enable_camera_list(true); |
845 capturer_.ConstrainSupportedFormats(vga_format); | 845 capturer_.ConstrainSupportedFormats(vga_format); |
846 EXPECT_EQ(2u, capturer_.GetSupportedFormats()->size()); | 846 EXPECT_EQ(2u, capturer_.GetSupportedFormats()->size()); |
847 // To make sure it's not just the camera list being broken, add in VGA and | 847 // To make sure it's not just the camera list being broken, add in VGA and |
848 // try again. This time, only the VGA format should be there. | 848 // try again. This time, only the VGA format should be there. |
849 supported_formats.push_back(vga_format); | 849 supported_formats.push_back(vga_format); |
850 capturer_.ResetSupportedFormats(supported_formats); | 850 capturer_.ResetSupportedFormats(supported_formats); |
851 ASSERT_EQ(1u, capturer_.GetSupportedFormats()->size()); | 851 ASSERT_EQ(1u, capturer_.GetSupportedFormats()->size()); |
852 EXPECT_EQ(vga_format.height, capturer_.GetSupportedFormats()->at(0).height); | 852 EXPECT_EQ(vga_format.height, capturer_.GetSupportedFormats()->at(0).height); |
853 } | 853 } |
OLD | NEW |