| 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 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 source_->Restart(); | 175 source_->Restart(); |
| 176 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), | 176 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), |
| 177 kMaxWaitMs); | 177 kMaxWaitMs); |
| 178 | 178 |
| 179 ASSERT_TRUE(capturer_->CaptureFrame()); | 179 ASSERT_TRUE(capturer_->CaptureFrame()); |
| 180 EXPECT_EQ(2, renderer_.num_rendered_frames()); | 180 EXPECT_EQ(2, renderer_.num_rendered_frames()); |
| 181 | 181 |
| 182 source_->Stop(); | 182 source_->Stop(); |
| 183 } | 183 } |
| 184 | 184 |
| 185 // Test start stop with a remote VideoSource - the video source that has a | |
| 186 // RemoteVideoCapturer and takes video frames from FrameInput. | |
| 187 TEST_F(VideoCapturerTrackSourceTest, StartStopRemote) { | |
| 188 source_ = VideoCapturerTrackSource::Create( | |
| 189 rtc::Thread::Current(), new webrtc::RemoteVideoCapturer(), NULL, true); | |
| 190 | |
| 191 ASSERT_TRUE(source_.get() != NULL); | |
| 192 EXPECT_TRUE(NULL != source_->GetVideoCapturer()); | |
| 193 | |
| 194 state_observer_.reset(new StateObserver(source_)); | |
| 195 source_->RegisterObserver(state_observer_.get()); | |
| 196 source_->AddOrUpdateSink(&renderer_, rtc::VideoSinkWants()); | |
| 197 | |
| 198 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), | |
| 199 kMaxWaitMs); | |
| 200 | |
| 201 source_->GetVideoCapturer()->Stop(); | |
| 202 EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(), | |
| 203 kMaxWaitMs); | |
| 204 } | |
| 205 | |
| 206 // Test that a VideoSource transition to kEnded if the capture device | 185 // Test that a VideoSource transition to kEnded if the capture device |
| 207 // fails. | 186 // fails. |
| 208 TEST_F(VideoCapturerTrackSourceTest, CameraFailed) { | 187 TEST_F(VideoCapturerTrackSourceTest, CameraFailed) { |
| 209 CreateVideoCapturerSource(); | 188 CreateVideoCapturerSource(); |
| 210 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), | 189 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), |
| 211 kMaxWaitMs); | 190 kMaxWaitMs); |
| 212 | 191 |
| 213 capturer_->SignalStateChange(capturer_, cricket::CS_FAILED); | 192 capturer_->SignalStateChange(capturer_, cricket::CS_FAILED); |
| 214 EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(), | 193 EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(), |
| 215 kMaxWaitMs); | 194 kMaxWaitMs); |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 FakeConstraints constraints; | 482 FakeConstraints constraints; |
| 504 constraints.AddOptional(MediaConstraintsInterface::kMaxFrameRate, 0.5); | 483 constraints.AddOptional(MediaConstraintsInterface::kMaxFrameRate, 0.5); |
| 505 | 484 |
| 506 CreateVideoCapturerSource(&constraints); | 485 CreateVideoCapturerSource(&constraints); |
| 507 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), | 486 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), |
| 508 kMaxWaitMs); | 487 kMaxWaitMs); |
| 509 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); | 488 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); |
| 510 ASSERT_TRUE(format != NULL); | 489 ASSERT_TRUE(format != NULL); |
| 511 EXPECT_EQ(30, format->framerate()); | 490 EXPECT_EQ(30, format->framerate()); |
| 512 } | 491 } |
| OLD | NEW |