OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 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, |
11 * this list of conditions and the following disclaimer in the documentation | 11 * this list of conditions and the following disclaimer in the documentation |
12 * and/or other materials provided with the distribution. | 12 * and/or other materials provided with the distribution. |
13 * 3. The name of the author may not be used to endorse or promote products | 13 * 3. The name of the author may not be used to endorse or promote products |
14 * derived from this software without specific prior written permission. | 14 * derived from this software without specific prior written permission. |
15 * | 15 * |
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED | 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO |
19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | 21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 */ | 26 */ |
27 | 27 |
28 #include "talk/media/base/capturemanager.h" | 28 #include "talk/media/base/capturemanager.h" |
29 | 29 |
30 #include "talk/media/base/fakemediaprocessor.h" | |
31 #include "talk/media/base/fakevideocapturer.h" | 30 #include "talk/media/base/fakevideocapturer.h" |
32 #include "talk/media/base/fakevideorenderer.h" | 31 #include "talk/media/base/fakevideorenderer.h" |
33 #include "webrtc/base/gunit.h" | 32 #include "webrtc/base/gunit.h" |
34 #include "webrtc/base/sigslot.h" | 33 #include "webrtc/base/sigslot.h" |
35 | 34 |
36 const int kMsCallbackWait = 50; | 35 const int kMsCallbackWait = 50; |
37 | 36 |
38 const int kFps = 30; | 37 const int kFps = 30; |
39 const cricket::VideoFormatPod kCameraFormats[] = { | 38 const cricket::VideoFormatPod kCameraFormats[] = { |
40 {640, 480, cricket::VideoFormat::FpsToInterval(kFps), cricket::FOURCC_I420}, | 39 {640, 480, cricket::VideoFormat::FpsToInterval(kFps), cricket::FOURCC_I420}, |
(...skipping 29 matching lines...) Expand all Loading... |
70 } | 69 } |
71 cricket::CaptureState capture_state() { return capture_state_; } | 70 cricket::CaptureState capture_state() { return capture_state_; } |
72 int callback_count() { return callback_count_; } | 71 int callback_count() { return callback_count_; } |
73 void OnCapturerStateChange(cricket::VideoCapturer* capturer, | 72 void OnCapturerStateChange(cricket::VideoCapturer* capturer, |
74 cricket::CaptureState capture_state) { | 73 cricket::CaptureState capture_state) { |
75 capture_state_ = capture_state; | 74 capture_state_ = capture_state; |
76 ++callback_count_; | 75 ++callback_count_; |
77 } | 76 } |
78 | 77 |
79 protected: | 78 protected: |
80 cricket::FakeMediaProcessor media_processor_; | |
81 cricket::FakeVideoCapturer video_capturer_; | 79 cricket::FakeVideoCapturer video_capturer_; |
82 cricket::FakeVideoRenderer video_renderer_; | 80 cricket::FakeVideoRenderer video_renderer_; |
83 | 81 |
84 cricket::CaptureManager capture_manager_; | 82 cricket::CaptureManager capture_manager_; |
85 | 83 |
86 cricket::CaptureState capture_state_; | 84 cricket::CaptureState capture_state_; |
87 int callback_count_; | 85 int callback_count_; |
88 cricket::VideoFormat format_vga_; | 86 cricket::VideoFormat format_vga_; |
89 cricket::VideoFormat format_qvga_; | 87 cricket::VideoFormat format_qvga_; |
90 }; | 88 }; |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 // Now request restart with qvga. | 219 // Now request restart with qvga. |
222 EXPECT_TRUE(capture_manager_.RestartVideoCapture( | 220 EXPECT_TRUE(capture_manager_.RestartVideoCapture( |
223 &video_capturer_, format_vga_, format_qvga_, | 221 &video_capturer_, format_vga_, format_qvga_, |
224 cricket::CaptureManager::kRequestRestart)); | 222 cricket::CaptureManager::kRequestRestart)); |
225 EXPECT_TRUE(video_capturer_.CaptureFrame()); | 223 EXPECT_TRUE(video_capturer_.CaptureFrame()); |
226 EXPECT_EQ(2, NumFramesRendered()); | 224 EXPECT_EQ(2, NumFramesRendered()); |
227 EXPECT_TRUE(WasRenderedResolution(format_vga_)); | 225 EXPECT_TRUE(WasRenderedResolution(format_vga_)); |
228 EXPECT_TRUE(capture_manager_.StopVideoCapture(&video_capturer_, | 226 EXPECT_TRUE(capture_manager_.StopVideoCapture(&video_capturer_, |
229 format_qvga_)); | 227 format_qvga_)); |
230 } | 228 } |
OLD | NEW |