OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2008 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2008 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 <memory> | 13 #include <memory> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "webrtc/base/gunit.h" | 16 #include "webrtc/base/gunit.h" |
17 #include "webrtc/base/logging.h" | 17 #include "webrtc/base/logging.h" |
| 18 #include "webrtc/base/random.h" |
18 #include "webrtc/base/thread.h" | 19 #include "webrtc/base/thread.h" |
19 #include "webrtc/media/base/fakevideocapturer.h" | 20 #include "webrtc/media/base/fakevideocapturer.h" |
20 #include "webrtc/media/base/fakevideorenderer.h" | 21 #include "webrtc/media/base/fakevideorenderer.h" |
21 #include "webrtc/media/base/testutils.h" | 22 #include "webrtc/media/base/testutils.h" |
22 #include "webrtc/media/base/videocapturer.h" | 23 #include "webrtc/media/base/videocapturer.h" |
23 | 24 |
24 using cricket::FakeVideoCapturer; | 25 using cricket::FakeVideoCapturer; |
25 | 26 |
26 namespace { | 27 namespace { |
27 | 28 |
(...skipping 20 matching lines...) Expand all Loading... |
48 &VideoCapturerTest::OnStateChange); | 49 &VideoCapturerTest::OnStateChange); |
49 capturer_->AddOrUpdateSink(&renderer_, rtc::VideoSinkWants()); | 50 capturer_->AddOrUpdateSink(&renderer_, rtc::VideoSinkWants()); |
50 } | 51 } |
51 void InitScreencast() { InitCapturer(true); } | 52 void InitScreencast() { InitCapturer(true); } |
52 | 53 |
53 void OnStateChange(cricket::VideoCapturer*, | 54 void OnStateChange(cricket::VideoCapturer*, |
54 cricket::CaptureState capture_state) { | 55 cricket::CaptureState capture_state) { |
55 capture_state_ = capture_state; | 56 capture_state_ = capture_state; |
56 ++num_state_changes_; | 57 ++num_state_changes_; |
57 } | 58 } |
| 59 |
58 cricket::CaptureState capture_state() { return capture_state_; } | 60 cricket::CaptureState capture_state() { return capture_state_; } |
59 int num_state_changes() { return num_state_changes_; } | 61 int num_state_changes() { return num_state_changes_; } |
60 | 62 |
61 std::unique_ptr<cricket::FakeVideoCapturer> capturer_; | 63 std::unique_ptr<cricket::FakeVideoCapturer> capturer_; |
62 cricket::CaptureState capture_state_; | 64 cricket::CaptureState capture_state_; |
63 int num_state_changes_; | 65 int num_state_changes_; |
64 cricket::FakeVideoRenderer renderer_; | 66 cricket::FakeVideoRenderer renderer_; |
65 bool expects_rotation_applied_; | 67 bool expects_rotation_applied_; |
66 }; | 68 }; |
67 | 69 |
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 capturer_->set_enable_camera_list(true); | 776 capturer_->set_enable_camera_list(true); |
775 capturer_->ConstrainSupportedFormats(vga_format); | 777 capturer_->ConstrainSupportedFormats(vga_format); |
776 EXPECT_EQ(2u, capturer_->GetSupportedFormats()->size()); | 778 EXPECT_EQ(2u, capturer_->GetSupportedFormats()->size()); |
777 // To make sure it's not just the camera list being broken, add in VGA and | 779 // To make sure it's not just the camera list being broken, add in VGA and |
778 // try again. This time, only the VGA format should be there. | 780 // try again. This time, only the VGA format should be there. |
779 supported_formats.push_back(vga_format); | 781 supported_formats.push_back(vga_format); |
780 capturer_->ResetSupportedFormats(supported_formats); | 782 capturer_->ResetSupportedFormats(supported_formats); |
781 ASSERT_EQ(1u, capturer_->GetSupportedFormats()->size()); | 783 ASSERT_EQ(1u, capturer_->GetSupportedFormats()->size()); |
782 EXPECT_EQ(vga_format.height, capturer_->GetSupportedFormats()->at(0).height); | 784 EXPECT_EQ(vga_format.height, capturer_->GetSupportedFormats()->at(0).height); |
783 } | 785 } |
OLD | NEW |