OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 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 <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "webrtc/api/remotevideocapturer.h" | 14 #include "webrtc/api/remotevideocapturer.h" |
15 #include "webrtc/api/test/fakeconstraints.h" | 15 #include "webrtc/api/test/fakeconstraints.h" |
16 #include "webrtc/api/videosource.h" | 16 #include "webrtc/api/videocapturertracksource.h" |
17 #include "webrtc/base/gunit.h" | 17 #include "webrtc/base/gunit.h" |
18 #include "webrtc/media/base/fakemediaengine.h" | 18 #include "webrtc/media/base/fakemediaengine.h" |
19 #include "webrtc/media/base/fakevideocapturer.h" | 19 #include "webrtc/media/base/fakevideocapturer.h" |
20 #include "webrtc/media/base/fakevideorenderer.h" | 20 #include "webrtc/media/base/fakevideorenderer.h" |
21 #include "webrtc/media/engine/webrtcvideoframe.h" | 21 #include "webrtc/media/engine/webrtcvideoframe.h" |
22 | 22 |
23 using webrtc::FakeConstraints; | 23 using webrtc::FakeConstraints; |
24 using webrtc::VideoSource; | 24 using webrtc::VideoCapturerTrackSource; |
25 using webrtc::MediaConstraintsInterface; | 25 using webrtc::MediaConstraintsInterface; |
26 using webrtc::MediaSourceInterface; | 26 using webrtc::MediaSourceInterface; |
27 using webrtc::ObserverInterface; | 27 using webrtc::ObserverInterface; |
28 using webrtc::VideoSourceInterface; | 28 using webrtc::VideoTrackSourceInterface; |
29 | 29 |
30 namespace { | 30 namespace { |
31 | 31 |
32 // Max wait time for a test. | 32 // Max wait time for a test. |
33 const int kMaxWaitMs = 100; | 33 const int kMaxWaitMs = 100; |
34 | 34 |
35 } // anonymous namespace | 35 } // anonymous namespace |
36 | 36 |
37 | |
38 // TestVideoCapturer extends cricket::FakeVideoCapturer so it can be used for | 37 // TestVideoCapturer extends cricket::FakeVideoCapturer so it can be used for |
39 // testing without known camera formats. | 38 // testing without known camera formats. |
40 // It keeps its own lists of cricket::VideoFormats for the unit tests in this | 39 // It keeps its own lists of cricket::VideoFormats for the unit tests in this |
41 // file. | 40 // file. |
42 class TestVideoCapturer : public cricket::FakeVideoCapturer { | 41 class TestVideoCapturer : public cricket::FakeVideoCapturer { |
43 public: | 42 public: |
44 TestVideoCapturer(bool is_screencast) | 43 explicit TestVideoCapturer(bool is_screencast) |
45 : FakeVideoCapturer(is_screencast), | 44 : FakeVideoCapturer(is_screencast), test_without_formats_(false) { |
46 test_without_formats_(false) { | |
47 std::vector<cricket::VideoFormat> formats; | 45 std::vector<cricket::VideoFormat> formats; |
48 formats.push_back(cricket::VideoFormat(1280, 720, | 46 formats.push_back( |
49 cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420)); | 47 cricket::VideoFormat(1280, 720, cricket::VideoFormat::FpsToInterval(30), |
50 formats.push_back(cricket::VideoFormat(640, 480, | 48 cricket::FOURCC_I420)); |
51 cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420)); | 49 formats.push_back( |
52 formats.push_back(cricket::VideoFormat(640, 400, | 50 cricket::VideoFormat(640, 480, cricket::VideoFormat::FpsToInterval(30), |
53 cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420)); | 51 cricket::FOURCC_I420)); |
54 formats.push_back(cricket::VideoFormat(320, 240, | 52 formats.push_back( |
55 cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420)); | 53 cricket::VideoFormat(640, 400, cricket::VideoFormat::FpsToInterval(30), |
56 formats.push_back(cricket::VideoFormat(352, 288, | 54 cricket::FOURCC_I420)); |
57 cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420)); | 55 formats.push_back( |
| 56 cricket::VideoFormat(320, 240, cricket::VideoFormat::FpsToInterval(30), |
| 57 cricket::FOURCC_I420)); |
| 58 formats.push_back( |
| 59 cricket::VideoFormat(352, 288, cricket::VideoFormat::FpsToInterval(30), |
| 60 cricket::FOURCC_I420)); |
58 ResetSupportedFormats(formats); | 61 ResetSupportedFormats(formats); |
59 } | 62 } |
60 | 63 |
61 // This function is used for resetting the supported capture formats and | 64 // This function is used for resetting the supported capture formats and |
62 // simulating a cricket::VideoCapturer implementation that don't support | 65 // simulating a cricket::VideoCapturer implementation that don't support |
63 // capture format enumeration. This is used to simulate the current | 66 // capture format enumeration. This is used to simulate the current |
64 // Chrome implementation. | 67 // Chrome implementation. |
65 void TestWithoutCameraFormats() { | 68 void TestWithoutCameraFormats() { |
66 test_without_formats_ = true; | 69 test_without_formats_ = true; |
67 std::vector<cricket::VideoFormat> formats; | 70 std::vector<cricket::VideoFormat> formats; |
68 ResetSupportedFormats(formats); | 71 ResetSupportedFormats(formats); |
69 } | 72 } |
70 | 73 |
71 virtual cricket::CaptureState Start( | 74 virtual cricket::CaptureState Start( |
72 const cricket::VideoFormat& capture_format) { | 75 const cricket::VideoFormat& capture_format) { |
73 if (test_without_formats_) { | 76 if (test_without_formats_) { |
74 std::vector<cricket::VideoFormat> formats; | 77 std::vector<cricket::VideoFormat> formats; |
75 formats.push_back(capture_format); | 78 formats.push_back(capture_format); |
76 ResetSupportedFormats(formats); | 79 ResetSupportedFormats(formats); |
77 } | 80 } |
78 return FakeVideoCapturer::Start(capture_format); | 81 return FakeVideoCapturer::Start(capture_format); |
79 } | 82 } |
80 | 83 |
81 virtual bool GetBestCaptureFormat(const cricket::VideoFormat& desired, | 84 virtual bool GetBestCaptureFormat(const cricket::VideoFormat& desired, |
82 cricket::VideoFormat* best_format) { | 85 cricket::VideoFormat* best_format) { |
83 if (test_without_formats_) { | 86 if (test_without_formats_) { |
84 *best_format = desired; | 87 *best_format = desired; |
85 return true; | 88 return true; |
86 } | 89 } |
87 return FakeVideoCapturer::GetBestCaptureFormat(desired, | 90 return FakeVideoCapturer::GetBestCaptureFormat(desired, best_format); |
88 best_format); | |
89 } | 91 } |
90 | 92 |
91 private: | 93 private: |
92 bool test_without_formats_; | 94 bool test_without_formats_; |
93 }; | 95 }; |
94 | 96 |
95 class StateObserver : public ObserverInterface { | 97 class StateObserver : public ObserverInterface { |
96 public: | 98 public: |
97 explicit StateObserver(VideoSourceInterface* source) | 99 explicit StateObserver(VideoTrackSourceInterface* source) |
98 : state_(source->state()), | 100 : state_(source->state()), source_(source) {} |
99 source_(source) { | 101 virtual void OnChanged() { state_ = source_->state(); } |
100 } | |
101 virtual void OnChanged() { | |
102 state_ = source_->state(); | |
103 } | |
104 MediaSourceInterface::SourceState state() const { return state_; } | 102 MediaSourceInterface::SourceState state() const { return state_; } |
105 | 103 |
106 private: | 104 private: |
107 MediaSourceInterface::SourceState state_; | 105 MediaSourceInterface::SourceState state_; |
108 rtc::scoped_refptr<VideoSourceInterface> source_; | 106 rtc::scoped_refptr<VideoTrackSourceInterface> source_; |
109 }; | 107 }; |
110 | 108 |
111 class VideoSourceTest : public testing::Test { | 109 class VideoCapturerTrackSourceTest : public testing::Test { |
112 protected: | 110 protected: |
113 VideoSourceTest() { | 111 VideoCapturerTrackSourceTest() { InitCapturer(false); } |
114 InitCapturer(false); | |
115 } | |
116 void InitCapturer(bool is_screencast) { | 112 void InitCapturer(bool is_screencast) { |
117 capturer_cleanup_ = rtc::scoped_ptr<TestVideoCapturer>( | 113 capturer_cleanup_ = rtc::scoped_ptr<TestVideoCapturer>( |
118 new TestVideoCapturer(is_screencast)); | 114 new TestVideoCapturer(is_screencast)); |
119 capturer_ = capturer_cleanup_.get(); | 115 capturer_ = capturer_cleanup_.get(); |
120 } | 116 } |
121 | 117 |
122 void InitScreencast() { InitCapturer(true); } | 118 void InitScreencast() { InitCapturer(true); } |
123 | 119 |
124 void CreateVideoSource() { | 120 void CreateVideoCapturerSource() { CreateVideoCapturerSource(NULL); } |
125 CreateVideoSource(NULL); | |
126 } | |
127 | 121 |
128 void CreateVideoSource( | 122 void CreateVideoCapturerSource( |
129 const webrtc::MediaConstraintsInterface* constraints) { | 123 const webrtc::MediaConstraintsInterface* constraints) { |
130 // VideoSource take ownership of |capturer_| | 124 // VideoSource take ownership of |capturer_| |
131 source_ = | 125 source_ = VideoCapturerTrackSource::Create(rtc::Thread::Current(), |
132 VideoSource::Create(rtc::Thread::Current(), capturer_cleanup_.release(), | 126 capturer_cleanup_.release(), |
133 constraints, false); | 127 constraints, false); |
134 | 128 |
135 ASSERT_TRUE(source_.get() != NULL); | 129 ASSERT_TRUE(source_.get() != NULL); |
136 EXPECT_EQ(capturer_, source_->GetVideoCapturer()); | 130 EXPECT_EQ(capturer_, source_->GetVideoCapturer()); |
137 | 131 |
138 state_observer_.reset(new StateObserver(source_)); | 132 state_observer_.reset(new StateObserver(source_)); |
139 source_->RegisterObserver(state_observer_.get()); | 133 source_->RegisterObserver(state_observer_.get()); |
140 source_->AddOrUpdateSink(&renderer_, rtc::VideoSinkWants()); | 134 source_->AddOrUpdateSink(&renderer_, rtc::VideoSinkWants()); |
141 } | 135 } |
142 | 136 |
143 rtc::scoped_ptr<TestVideoCapturer> capturer_cleanup_; | 137 rtc::scoped_ptr<TestVideoCapturer> capturer_cleanup_; |
144 TestVideoCapturer* capturer_; | 138 TestVideoCapturer* capturer_; |
145 cricket::FakeVideoRenderer renderer_; | 139 cricket::FakeVideoRenderer renderer_; |
146 rtc::scoped_ptr<StateObserver> state_observer_; | 140 rtc::scoped_ptr<StateObserver> state_observer_; |
147 rtc::scoped_refptr<VideoSource> source_; | 141 rtc::scoped_refptr<VideoTrackSourceInterface> source_; |
148 }; | 142 }; |
149 | 143 |
150 | |
151 // Test that a VideoSource transition to kLive state when the capture | 144 // Test that a VideoSource transition to kLive state when the capture |
152 // device have started and kEnded if it is stopped. | 145 // device have started and kEnded if it is stopped. |
153 // It also test that an output can receive video frames. | 146 // It also test that an output can receive video frames. |
154 TEST_F(VideoSourceTest, CapturerStartStop) { | 147 TEST_F(VideoCapturerTrackSourceTest, CapturerStartStop) { |
155 // Initialize without constraints. | 148 // Initialize without constraints. |
156 CreateVideoSource(); | 149 CreateVideoCapturerSource(); |
157 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), | 150 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), |
158 kMaxWaitMs); | 151 kMaxWaitMs); |
159 | 152 |
160 ASSERT_TRUE(capturer_->CaptureFrame()); | 153 ASSERT_TRUE(capturer_->CaptureFrame()); |
161 EXPECT_EQ(1, renderer_.num_rendered_frames()); | 154 EXPECT_EQ(1, renderer_.num_rendered_frames()); |
162 | 155 |
163 capturer_->Stop(); | 156 capturer_->Stop(); |
164 EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(), | 157 EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(), |
165 kMaxWaitMs); | 158 kMaxWaitMs); |
166 } | 159 } |
167 | 160 |
168 // Test that a VideoSource can be stopped and restarted. | 161 // Test that a VideoSource can be stopped and restarted. |
169 TEST_F(VideoSourceTest, StopRestart) { | 162 TEST_F(VideoCapturerTrackSourceTest, StopRestart) { |
170 // Initialize without constraints. | 163 // Initialize without constraints. |
171 CreateVideoSource(); | 164 CreateVideoCapturerSource(); |
172 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), | 165 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), |
173 kMaxWaitMs); | 166 kMaxWaitMs); |
174 | 167 |
175 ASSERT_TRUE(capturer_->CaptureFrame()); | 168 ASSERT_TRUE(capturer_->CaptureFrame()); |
176 EXPECT_EQ(1, renderer_.num_rendered_frames()); | 169 EXPECT_EQ(1, renderer_.num_rendered_frames()); |
177 | 170 |
178 source_->Stop(); | 171 source_->Stop(); |
179 EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(), | 172 EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(), |
180 kMaxWaitMs); | 173 kMaxWaitMs); |
181 | 174 |
182 source_->Restart(); | 175 source_->Restart(); |
183 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), | 176 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), |
184 kMaxWaitMs); | 177 kMaxWaitMs); |
185 | 178 |
186 ASSERT_TRUE(capturer_->CaptureFrame()); | 179 ASSERT_TRUE(capturer_->CaptureFrame()); |
187 EXPECT_EQ(2, renderer_.num_rendered_frames()); | 180 EXPECT_EQ(2, renderer_.num_rendered_frames()); |
188 | 181 |
189 source_->Stop(); | 182 source_->Stop(); |
190 } | 183 } |
191 | 184 |
192 // Test start stop with a remote VideoSource - the video source that has a | 185 // Test start stop with a remote VideoSource - the video source that has a |
193 // RemoteVideoCapturer and takes video frames from FrameInput. | 186 // RemoteVideoCapturer and takes video frames from FrameInput. |
194 TEST_F(VideoSourceTest, StartStopRemote) { | 187 TEST_F(VideoCapturerTrackSourceTest, StartStopRemote) { |
195 source_ = VideoSource::Create(rtc::Thread::Current(), | 188 source_ = VideoCapturerTrackSource::Create( |
196 new webrtc::RemoteVideoCapturer(), NULL, true); | 189 rtc::Thread::Current(), new webrtc::RemoteVideoCapturer(), NULL, true); |
197 | 190 |
198 ASSERT_TRUE(source_.get() != NULL); | 191 ASSERT_TRUE(source_.get() != NULL); |
199 EXPECT_TRUE(NULL != source_->GetVideoCapturer()); | 192 EXPECT_TRUE(NULL != source_->GetVideoCapturer()); |
200 | 193 |
201 state_observer_.reset(new StateObserver(source_)); | 194 state_observer_.reset(new StateObserver(source_)); |
202 source_->RegisterObserver(state_observer_.get()); | 195 source_->RegisterObserver(state_observer_.get()); |
203 source_->AddOrUpdateSink(&renderer_, rtc::VideoSinkWants()); | 196 source_->AddOrUpdateSink(&renderer_, rtc::VideoSinkWants()); |
204 | 197 |
205 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), | 198 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), |
206 kMaxWaitMs); | 199 kMaxWaitMs); |
207 | 200 |
208 source_->GetVideoCapturer()->Stop(); | 201 source_->GetVideoCapturer()->Stop(); |
209 EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(), | 202 EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(), |
210 kMaxWaitMs); | 203 kMaxWaitMs); |
211 } | 204 } |
212 | 205 |
213 // Test that a VideoSource transition to kEnded if the capture device | 206 // Test that a VideoSource transition to kEnded if the capture device |
214 // fails. | 207 // fails. |
215 TEST_F(VideoSourceTest, CameraFailed) { | 208 TEST_F(VideoCapturerTrackSourceTest, CameraFailed) { |
216 CreateVideoSource(); | 209 CreateVideoCapturerSource(); |
217 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), | 210 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), |
218 kMaxWaitMs); | 211 kMaxWaitMs); |
219 | 212 |
220 capturer_->SignalStateChange(capturer_, cricket::CS_FAILED); | 213 capturer_->SignalStateChange(capturer_, cricket::CS_FAILED); |
221 EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(), | 214 EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(), |
222 kMaxWaitMs); | 215 kMaxWaitMs); |
223 } | 216 } |
224 | 217 |
225 // Test that the capture output is CIF if we set max constraints to CIF. | 218 // Test that the capture output is CIF if we set max constraints to CIF. |
226 // and the capture device support CIF. | 219 // and the capture device support CIF. |
227 TEST_F(VideoSourceTest, MandatoryConstraintCif5Fps) { | 220 TEST_F(VideoCapturerTrackSourceTest, MandatoryConstraintCif5Fps) { |
228 FakeConstraints constraints; | 221 FakeConstraints constraints; |
229 constraints.AddMandatory(MediaConstraintsInterface::kMaxWidth, 352); | 222 constraints.AddMandatory(MediaConstraintsInterface::kMaxWidth, 352); |
230 constraints.AddMandatory(MediaConstraintsInterface::kMaxHeight, 288); | 223 constraints.AddMandatory(MediaConstraintsInterface::kMaxHeight, 288); |
231 constraints.AddMandatory(MediaConstraintsInterface::kMaxFrameRate, 5); | 224 constraints.AddMandatory(MediaConstraintsInterface::kMaxFrameRate, 5); |
232 | 225 |
233 CreateVideoSource(&constraints); | 226 CreateVideoCapturerSource(&constraints); |
234 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), | 227 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), |
235 kMaxWaitMs); | 228 kMaxWaitMs); |
236 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); | 229 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); |
237 ASSERT_TRUE(format != NULL); | 230 ASSERT_TRUE(format != NULL); |
238 EXPECT_EQ(352, format->width); | 231 EXPECT_EQ(352, format->width); |
239 EXPECT_EQ(288, format->height); | 232 EXPECT_EQ(288, format->height); |
240 EXPECT_EQ(30, format->framerate()); | 233 EXPECT_EQ(30, format->framerate()); |
241 } | 234 } |
242 | 235 |
243 // Test that the capture output is 720P if the camera support it and the | 236 // Test that the capture output is 720P if the camera support it and the |
244 // optional constraint is set to 720P. | 237 // optional constraint is set to 720P. |
245 TEST_F(VideoSourceTest, MandatoryMinVgaOptional720P) { | 238 TEST_F(VideoCapturerTrackSourceTest, MandatoryMinVgaOptional720P) { |
246 FakeConstraints constraints; | 239 FakeConstraints constraints; |
247 constraints.AddMandatory(MediaConstraintsInterface::kMinWidth, 640); | 240 constraints.AddMandatory(MediaConstraintsInterface::kMinWidth, 640); |
248 constraints.AddMandatory(MediaConstraintsInterface::kMinHeight, 480); | 241 constraints.AddMandatory(MediaConstraintsInterface::kMinHeight, 480); |
249 constraints.AddOptional(MediaConstraintsInterface::kMinWidth, 1280); | 242 constraints.AddOptional(MediaConstraintsInterface::kMinWidth, 1280); |
250 constraints.AddOptional(MediaConstraintsInterface::kMinAspectRatio, | 243 constraints.AddOptional(MediaConstraintsInterface::kMinAspectRatio, |
251 1280.0 / 720); | 244 1280.0 / 720); |
252 | 245 |
253 CreateVideoSource(&constraints); | 246 CreateVideoCapturerSource(&constraints); |
254 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), | 247 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), |
255 kMaxWaitMs); | 248 kMaxWaitMs); |
256 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); | 249 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); |
257 ASSERT_TRUE(format != NULL); | 250 ASSERT_TRUE(format != NULL); |
258 EXPECT_EQ(1280, format->width); | 251 EXPECT_EQ(1280, format->width); |
259 EXPECT_EQ(720, format->height); | 252 EXPECT_EQ(720, format->height); |
260 EXPECT_EQ(30, format->framerate()); | 253 EXPECT_EQ(30, format->framerate()); |
261 } | 254 } |
262 | 255 |
263 // Test that the capture output have aspect ratio 4:3 if a mandatory constraint | 256 // Test that the capture output have aspect ratio 4:3 if a mandatory constraint |
264 // require it even if an optional constraint request a higher resolution | 257 // require it even if an optional constraint request a higher resolution |
265 // that don't have this aspect ratio. | 258 // that don't have this aspect ratio. |
266 TEST_F(VideoSourceTest, MandatoryAspectRatio4To3) { | 259 TEST_F(VideoCapturerTrackSourceTest, MandatoryAspectRatio4To3) { |
267 FakeConstraints constraints; | 260 FakeConstraints constraints; |
268 constraints.AddMandatory(MediaConstraintsInterface::kMinWidth, 640); | 261 constraints.AddMandatory(MediaConstraintsInterface::kMinWidth, 640); |
269 constraints.AddMandatory(MediaConstraintsInterface::kMinHeight, 480); | 262 constraints.AddMandatory(MediaConstraintsInterface::kMinHeight, 480); |
270 constraints.AddMandatory(MediaConstraintsInterface::kMaxAspectRatio, | 263 constraints.AddMandatory(MediaConstraintsInterface::kMaxAspectRatio, |
271 640.0 / 480); | 264 640.0 / 480); |
272 constraints.AddOptional(MediaConstraintsInterface::kMinWidth, 1280); | 265 constraints.AddOptional(MediaConstraintsInterface::kMinWidth, 1280); |
273 | 266 |
274 CreateVideoSource(&constraints); | 267 CreateVideoCapturerSource(&constraints); |
275 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), | 268 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), |
276 kMaxWaitMs); | 269 kMaxWaitMs); |
277 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); | 270 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); |
278 ASSERT_TRUE(format != NULL); | 271 ASSERT_TRUE(format != NULL); |
279 EXPECT_EQ(640, format->width); | 272 EXPECT_EQ(640, format->width); |
280 EXPECT_EQ(480, format->height); | 273 EXPECT_EQ(480, format->height); |
281 EXPECT_EQ(30, format->framerate()); | 274 EXPECT_EQ(30, format->framerate()); |
282 } | 275 } |
283 | 276 |
284 | |
285 // Test that the source state transition to kEnded if the mandatory aspect ratio | 277 // Test that the source state transition to kEnded if the mandatory aspect ratio |
286 // is set higher than supported. | 278 // is set higher than supported. |
287 TEST_F(VideoSourceTest, MandatoryAspectRatioTooHigh) { | 279 TEST_F(VideoCapturerTrackSourceTest, MandatoryAspectRatioTooHigh) { |
288 FakeConstraints constraints; | 280 FakeConstraints constraints; |
289 constraints.AddMandatory(MediaConstraintsInterface::kMinAspectRatio, 2); | 281 constraints.AddMandatory(MediaConstraintsInterface::kMinAspectRatio, 2); |
290 CreateVideoSource(&constraints); | 282 CreateVideoCapturerSource(&constraints); |
291 EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(), | 283 EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(), |
292 kMaxWaitMs); | 284 kMaxWaitMs); |
293 } | 285 } |
294 | 286 |
295 // Test that the source ignores an optional aspect ratio that is higher than | 287 // Test that the source ignores an optional aspect ratio that is higher than |
296 // supported. | 288 // supported. |
297 TEST_F(VideoSourceTest, OptionalAspectRatioTooHigh) { | 289 TEST_F(VideoCapturerTrackSourceTest, OptionalAspectRatioTooHigh) { |
298 FakeConstraints constraints; | 290 FakeConstraints constraints; |
299 constraints.AddOptional(MediaConstraintsInterface::kMinAspectRatio, 2); | 291 constraints.AddOptional(MediaConstraintsInterface::kMinAspectRatio, 2); |
300 CreateVideoSource(&constraints); | 292 CreateVideoCapturerSource(&constraints); |
301 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), | 293 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), |
302 kMaxWaitMs); | 294 kMaxWaitMs); |
303 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); | 295 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); |
304 ASSERT_TRUE(format != NULL); | 296 ASSERT_TRUE(format != NULL); |
305 double aspect_ratio = static_cast<double>(format->width) / format->height; | 297 double aspect_ratio = static_cast<double>(format->width) / format->height; |
306 EXPECT_LT(aspect_ratio, 2); | 298 EXPECT_LT(aspect_ratio, 2); |
307 } | 299 } |
308 | 300 |
309 // Test that the source starts video with the default resolution if the | 301 // Test that the source starts video with the default resolution if the |
310 // camera doesn't support capability enumeration and there are no constraints. | 302 // camera doesn't support capability enumeration and there are no constraints. |
311 TEST_F(VideoSourceTest, NoCameraCapability) { | 303 TEST_F(VideoCapturerTrackSourceTest, NoCameraCapability) { |
312 capturer_->TestWithoutCameraFormats(); | 304 capturer_->TestWithoutCameraFormats(); |
313 | 305 |
314 CreateVideoSource(); | 306 CreateVideoCapturerSource(); |
315 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), | 307 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), |
316 kMaxWaitMs); | 308 kMaxWaitMs); |
317 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); | 309 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); |
318 ASSERT_TRUE(format != NULL); | 310 ASSERT_TRUE(format != NULL); |
319 EXPECT_EQ(640, format->width); | 311 EXPECT_EQ(640, format->width); |
320 EXPECT_EQ(480, format->height); | 312 EXPECT_EQ(480, format->height); |
321 EXPECT_EQ(30, format->framerate()); | 313 EXPECT_EQ(30, format->framerate()); |
322 } | 314 } |
323 | 315 |
324 // Test that the source can start the video and get the requested aspect ratio | 316 // Test that the source can start the video and get the requested aspect ratio |
325 // if the camera doesn't support capability enumeration and the aspect ratio is | 317 // if the camera doesn't support capability enumeration and the aspect ratio is |
326 // set. | 318 // set. |
327 TEST_F(VideoSourceTest, NoCameraCapability16To9Ratio) { | 319 TEST_F(VideoCapturerTrackSourceTest, NoCameraCapability16To9Ratio) { |
328 capturer_->TestWithoutCameraFormats(); | 320 capturer_->TestWithoutCameraFormats(); |
329 | 321 |
330 FakeConstraints constraints; | 322 FakeConstraints constraints; |
331 double requested_aspect_ratio = 640.0 / 360; | 323 double requested_aspect_ratio = 640.0 / 360; |
332 constraints.AddMandatory(MediaConstraintsInterface::kMinWidth, 640); | 324 constraints.AddMandatory(MediaConstraintsInterface::kMinWidth, 640); |
333 constraints.AddMandatory(MediaConstraintsInterface::kMinAspectRatio, | 325 constraints.AddMandatory(MediaConstraintsInterface::kMinAspectRatio, |
334 requested_aspect_ratio); | 326 requested_aspect_ratio); |
335 | 327 |
336 CreateVideoSource(&constraints); | 328 CreateVideoCapturerSource(&constraints); |
337 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), | 329 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), |
338 kMaxWaitMs); | 330 kMaxWaitMs); |
339 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); | 331 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); |
340 double aspect_ratio = static_cast<double>(format->width) / format->height; | 332 double aspect_ratio = static_cast<double>(format->width) / format->height; |
341 EXPECT_LE(requested_aspect_ratio, aspect_ratio); | 333 EXPECT_LE(requested_aspect_ratio, aspect_ratio); |
342 } | 334 } |
343 | 335 |
344 // Test that the source state transitions to kEnded if an unknown mandatory | 336 // Test that the source state transitions to kEnded if an unknown mandatory |
345 // constraint is found. | 337 // constraint is found. |
346 TEST_F(VideoSourceTest, InvalidMandatoryConstraint) { | 338 TEST_F(VideoCapturerTrackSourceTest, InvalidMandatoryConstraint) { |
347 FakeConstraints constraints; | 339 FakeConstraints constraints; |
348 constraints.AddMandatory("weird key", 640); | 340 constraints.AddMandatory("weird key", 640); |
349 | 341 |
350 CreateVideoSource(&constraints); | 342 CreateVideoCapturerSource(&constraints); |
351 EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(), | 343 EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(), |
352 kMaxWaitMs); | 344 kMaxWaitMs); |
353 } | 345 } |
354 | 346 |
355 // Test that the source ignores an unknown optional constraint. | 347 // Test that the source ignores an unknown optional constraint. |
356 TEST_F(VideoSourceTest, InvalidOptionalConstraint) { | 348 TEST_F(VideoCapturerTrackSourceTest, InvalidOptionalConstraint) { |
357 FakeConstraints constraints; | 349 FakeConstraints constraints; |
358 constraints.AddOptional("weird key", 640); | 350 constraints.AddOptional("weird key", 640); |
359 | 351 |
360 CreateVideoSource(&constraints); | 352 CreateVideoCapturerSource(&constraints); |
361 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), | 353 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), |
362 kMaxWaitMs); | 354 kMaxWaitMs); |
363 } | 355 } |
364 | 356 |
365 TEST_F(VideoSourceTest, SetValidOptionValues) { | 357 TEST_F(VideoCapturerTrackSourceTest, SetValidOptionValues) { |
366 FakeConstraints constraints; | 358 FakeConstraints constraints; |
367 constraints.AddMandatory(MediaConstraintsInterface::kNoiseReduction, "false"); | 359 constraints.AddMandatory(MediaConstraintsInterface::kNoiseReduction, "false"); |
368 | 360 |
369 CreateVideoSource(&constraints); | 361 CreateVideoCapturerSource(&constraints); |
370 | 362 |
371 EXPECT_EQ(rtc::Optional<bool>(false), | 363 EXPECT_EQ(rtc::Optional<bool>(false), |
372 source_->options()->video_noise_reduction); | 364 source_->options()->video_noise_reduction); |
373 } | 365 } |
374 | 366 |
375 TEST_F(VideoSourceTest, OptionNotSet) { | 367 TEST_F(VideoCapturerTrackSourceTest, OptionNotSet) { |
376 FakeConstraints constraints; | 368 FakeConstraints constraints; |
377 CreateVideoSource(&constraints); | 369 CreateVideoCapturerSource(&constraints); |
378 EXPECT_EQ(rtc::Optional<bool>(), source_->options()->video_noise_reduction); | 370 EXPECT_EQ(rtc::Optional<bool>(), source_->options()->video_noise_reduction); |
379 } | 371 } |
380 | 372 |
381 TEST_F(VideoSourceTest, MandatoryOptionOverridesOptional) { | 373 TEST_F(VideoCapturerTrackSourceTest, MandatoryOptionOverridesOptional) { |
382 FakeConstraints constraints; | 374 FakeConstraints constraints; |
383 constraints.AddMandatory( | 375 constraints.AddMandatory(MediaConstraintsInterface::kNoiseReduction, true); |
384 MediaConstraintsInterface::kNoiseReduction, true); | 376 constraints.AddOptional(MediaConstraintsInterface::kNoiseReduction, false); |
385 constraints.AddOptional( | |
386 MediaConstraintsInterface::kNoiseReduction, false); | |
387 | 377 |
388 CreateVideoSource(&constraints); | 378 CreateVideoCapturerSource(&constraints); |
389 | 379 |
390 EXPECT_EQ(rtc::Optional<bool>(true), | 380 EXPECT_EQ(rtc::Optional<bool>(true), |
391 source_->options()->video_noise_reduction); | 381 source_->options()->video_noise_reduction); |
392 } | 382 } |
393 | 383 |
394 TEST_F(VideoSourceTest, InvalidOptionKeyOptional) { | 384 TEST_F(VideoCapturerTrackSourceTest, InvalidOptionKeyOptional) { |
395 FakeConstraints constraints; | 385 FakeConstraints constraints; |
396 constraints.AddOptional( | 386 constraints.AddOptional(MediaConstraintsInterface::kNoiseReduction, false); |
397 MediaConstraintsInterface::kNoiseReduction, false); | |
398 constraints.AddOptional("invalidKey", false); | 387 constraints.AddOptional("invalidKey", false); |
399 | 388 |
400 CreateVideoSource(&constraints); | 389 CreateVideoCapturerSource(&constraints); |
401 | 390 |
402 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), | 391 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), |
403 kMaxWaitMs); | 392 kMaxWaitMs); |
404 EXPECT_EQ(rtc::Optional<bool>(false), | 393 EXPECT_EQ(rtc::Optional<bool>(false), |
405 source_->options()->video_noise_reduction); | 394 source_->options()->video_noise_reduction); |
406 } | 395 } |
407 | 396 |
408 TEST_F(VideoSourceTest, InvalidOptionKeyMandatory) { | 397 TEST_F(VideoCapturerTrackSourceTest, InvalidOptionKeyMandatory) { |
409 FakeConstraints constraints; | 398 FakeConstraints constraints; |
410 constraints.AddMandatory( | 399 constraints.AddMandatory(MediaConstraintsInterface::kNoiseReduction, false); |
411 MediaConstraintsInterface::kNoiseReduction, false); | |
412 constraints.AddMandatory("invalidKey", false); | 400 constraints.AddMandatory("invalidKey", false); |
413 | 401 |
414 CreateVideoSource(&constraints); | 402 CreateVideoCapturerSource(&constraints); |
415 | 403 |
416 EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(), | 404 EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(), |
417 kMaxWaitMs); | 405 kMaxWaitMs); |
418 EXPECT_EQ(rtc::Optional<bool>(), source_->options()->video_noise_reduction); | 406 EXPECT_EQ(rtc::Optional<bool>(), source_->options()->video_noise_reduction); |
419 } | 407 } |
420 | 408 |
421 TEST_F(VideoSourceTest, InvalidOptionValueOptional) { | 409 TEST_F(VideoCapturerTrackSourceTest, InvalidOptionValueOptional) { |
422 FakeConstraints constraints; | 410 FakeConstraints constraints; |
423 constraints.AddOptional( | 411 constraints.AddOptional(MediaConstraintsInterface::kNoiseReduction, |
424 MediaConstraintsInterface::kNoiseReduction, "not a boolean"); | 412 "not a boolean"); |
425 | 413 |
426 CreateVideoSource(&constraints); | 414 CreateVideoCapturerSource(&constraints); |
427 | 415 |
428 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), | 416 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), |
429 kMaxWaitMs); | 417 kMaxWaitMs); |
430 EXPECT_EQ(rtc::Optional<bool>(), source_->options()->video_noise_reduction); | 418 EXPECT_EQ(rtc::Optional<bool>(), source_->options()->video_noise_reduction); |
431 } | 419 } |
432 | 420 |
433 TEST_F(VideoSourceTest, InvalidOptionValueMandatory) { | 421 TEST_F(VideoCapturerTrackSourceTest, InvalidOptionValueMandatory) { |
434 FakeConstraints constraints; | 422 FakeConstraints constraints; |
435 // Optional constraints should be ignored if the mandatory constraints fail. | 423 // Optional constraints should be ignored if the mandatory constraints fail. |
436 constraints.AddOptional( | 424 constraints.AddOptional(MediaConstraintsInterface::kNoiseReduction, "false"); |
437 MediaConstraintsInterface::kNoiseReduction, "false"); | |
438 // Values are case-sensitive and must be all lower-case. | 425 // Values are case-sensitive and must be all lower-case. |
439 constraints.AddMandatory( | 426 constraints.AddMandatory(MediaConstraintsInterface::kNoiseReduction, "True"); |
440 MediaConstraintsInterface::kNoiseReduction, "True"); | |
441 | 427 |
442 CreateVideoSource(&constraints); | 428 CreateVideoCapturerSource(&constraints); |
443 | 429 |
444 EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(), | 430 EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(), |
445 kMaxWaitMs); | 431 kMaxWaitMs); |
446 EXPECT_EQ(rtc::Optional<bool>(), source_->options()->video_noise_reduction); | 432 EXPECT_EQ(rtc::Optional<bool>(), source_->options()->video_noise_reduction); |
447 } | 433 } |
448 | 434 |
449 TEST_F(VideoSourceTest, MixedOptionsAndConstraints) { | 435 TEST_F(VideoCapturerTrackSourceTest, MixedOptionsAndConstraints) { |
450 FakeConstraints constraints; | 436 FakeConstraints constraints; |
451 constraints.AddMandatory(MediaConstraintsInterface::kMaxWidth, 352); | 437 constraints.AddMandatory(MediaConstraintsInterface::kMaxWidth, 352); |
452 constraints.AddMandatory(MediaConstraintsInterface::kMaxHeight, 288); | 438 constraints.AddMandatory(MediaConstraintsInterface::kMaxHeight, 288); |
453 constraints.AddOptional(MediaConstraintsInterface::kMaxFrameRate, 5); | 439 constraints.AddOptional(MediaConstraintsInterface::kMaxFrameRate, 5); |
454 | 440 |
455 constraints.AddMandatory( | 441 constraints.AddMandatory(MediaConstraintsInterface::kNoiseReduction, false); |
456 MediaConstraintsInterface::kNoiseReduction, false); | 442 constraints.AddOptional(MediaConstraintsInterface::kNoiseReduction, true); |
457 constraints.AddOptional( | |
458 MediaConstraintsInterface::kNoiseReduction, true); | |
459 | 443 |
460 CreateVideoSource(&constraints); | 444 CreateVideoCapturerSource(&constraints); |
461 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), | 445 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), |
462 kMaxWaitMs); | 446 kMaxWaitMs); |
463 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); | 447 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); |
464 ASSERT_TRUE(format != NULL); | 448 ASSERT_TRUE(format != NULL); |
465 EXPECT_EQ(352, format->width); | 449 EXPECT_EQ(352, format->width); |
466 EXPECT_EQ(288, format->height); | 450 EXPECT_EQ(288, format->height); |
467 EXPECT_EQ(30, format->framerate()); | 451 EXPECT_EQ(30, format->framerate()); |
468 | 452 |
469 EXPECT_EQ(rtc::Optional<bool>(false), | 453 EXPECT_EQ(rtc::Optional<bool>(false), |
470 source_->options()->video_noise_reduction); | 454 source_->options()->video_noise_reduction); |
471 } | 455 } |
472 | 456 |
473 // Tests that the source starts video with the default resolution for | 457 // Tests that the source starts video with the default resolution for |
474 // screencast if no constraint is set. | 458 // screencast if no constraint is set. |
475 TEST_F(VideoSourceTest, ScreencastResolutionNoConstraint) { | 459 TEST_F(VideoCapturerTrackSourceTest, ScreencastResolutionNoConstraint) { |
476 InitScreencast(); | 460 InitScreencast(); |
477 capturer_->TestWithoutCameraFormats(); | 461 capturer_->TestWithoutCameraFormats(); |
478 | 462 |
479 CreateVideoSource(); | 463 CreateVideoCapturerSource(); |
480 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), | 464 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), |
481 kMaxWaitMs); | 465 kMaxWaitMs); |
482 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); | 466 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); |
483 ASSERT_TRUE(format != NULL); | 467 ASSERT_TRUE(format != NULL); |
484 EXPECT_EQ(640, format->width); | 468 EXPECT_EQ(640, format->width); |
485 EXPECT_EQ(480, format->height); | 469 EXPECT_EQ(480, format->height); |
486 EXPECT_EQ(30, format->framerate()); | 470 EXPECT_EQ(30, format->framerate()); |
487 } | 471 } |
488 | 472 |
489 // Tests that the source starts video with the max width and height set by | 473 // Tests that the source starts video with the max width and height set by |
490 // constraints for screencast. | 474 // constraints for screencast. |
491 TEST_F(VideoSourceTest, ScreencastResolutionWithConstraint) { | 475 TEST_F(VideoCapturerTrackSourceTest, ScreencastResolutionWithConstraint) { |
492 FakeConstraints constraints; | 476 FakeConstraints constraints; |
493 constraints.AddMandatory(MediaConstraintsInterface::kMaxWidth, 480); | 477 constraints.AddMandatory(MediaConstraintsInterface::kMaxWidth, 480); |
494 constraints.AddMandatory(MediaConstraintsInterface::kMaxHeight, 270); | 478 constraints.AddMandatory(MediaConstraintsInterface::kMaxHeight, 270); |
495 | 479 |
496 InitScreencast(); | 480 InitScreencast(); |
497 capturer_->TestWithoutCameraFormats(); | 481 capturer_->TestWithoutCameraFormats(); |
498 | 482 |
499 CreateVideoSource(&constraints); | 483 CreateVideoCapturerSource(&constraints); |
500 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), | 484 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), |
501 kMaxWaitMs); | 485 kMaxWaitMs); |
502 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); | 486 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); |
503 ASSERT_TRUE(format != NULL); | 487 ASSERT_TRUE(format != NULL); |
504 EXPECT_EQ(480, format->width); | 488 EXPECT_EQ(480, format->width); |
505 EXPECT_EQ(270, format->height); | 489 EXPECT_EQ(270, format->height); |
506 EXPECT_EQ(30, format->framerate()); | 490 EXPECT_EQ(30, format->framerate()); |
507 } | 491 } |
508 | 492 |
509 TEST_F(VideoSourceTest, MandatorySubOneFpsConstraints) { | 493 TEST_F(VideoCapturerTrackSourceTest, MandatorySubOneFpsConstraints) { |
510 FakeConstraints constraints; | 494 FakeConstraints constraints; |
511 constraints.AddMandatory(MediaConstraintsInterface::kMaxFrameRate, 0.5); | 495 constraints.AddMandatory(MediaConstraintsInterface::kMaxFrameRate, 0.5); |
512 | 496 |
513 CreateVideoSource(&constraints); | 497 CreateVideoCapturerSource(&constraints); |
514 EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(), | 498 EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(), |
515 kMaxWaitMs); | 499 kMaxWaitMs); |
516 ASSERT_TRUE(capturer_->GetCaptureFormat() == NULL); | 500 ASSERT_TRUE(capturer_->GetCaptureFormat() == NULL); |
517 } | 501 } |
518 | 502 |
519 TEST_F(VideoSourceTest, OptionalSubOneFpsConstraints) { | 503 TEST_F(VideoCapturerTrackSourceTest, OptionalSubOneFpsConstraints) { |
520 FakeConstraints constraints; | 504 FakeConstraints constraints; |
521 constraints.AddOptional(MediaConstraintsInterface::kMaxFrameRate, 0.5); | 505 constraints.AddOptional(MediaConstraintsInterface::kMaxFrameRate, 0.5); |
522 | 506 |
523 CreateVideoSource(&constraints); | 507 CreateVideoCapturerSource(&constraints); |
524 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), | 508 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), |
525 kMaxWaitMs); | 509 kMaxWaitMs); |
526 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); | 510 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); |
527 ASSERT_TRUE(format != NULL); | 511 ASSERT_TRUE(format != NULL); |
528 EXPECT_EQ(30, format->framerate()); | 512 EXPECT_EQ(30, format->framerate()); |
529 } | 513 } |
OLD | NEW |