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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // VideoSource take ownership of |capturer_| | 130 // VideoSource take ownership of |capturer_| |
131 source_ = | 131 source_ = |
132 VideoSource::Create(rtc::Thread::Current(), capturer_cleanup_.release(), | 132 VideoSource::Create(rtc::Thread::Current(), capturer_cleanup_.release(), |
133 constraints, false); | 133 constraints, false); |
134 | 134 |
135 ASSERT_TRUE(source_.get() != NULL); | 135 ASSERT_TRUE(source_.get() != NULL); |
136 EXPECT_EQ(capturer_, source_->GetVideoCapturer()); | 136 EXPECT_EQ(capturer_, source_->GetVideoCapturer()); |
137 | 137 |
138 state_observer_.reset(new StateObserver(source_)); | 138 state_observer_.reset(new StateObserver(source_)); |
139 source_->RegisterObserver(state_observer_.get()); | 139 source_->RegisterObserver(state_observer_.get()); |
140 source_->AddSink(&renderer_); | 140 source_->AddOrUpdateSink(&renderer_, rtc::VideoSinkWants()); |
141 } | 141 } |
142 | 142 |
143 rtc::scoped_ptr<TestVideoCapturer> capturer_cleanup_; | 143 rtc::scoped_ptr<TestVideoCapturer> capturer_cleanup_; |
144 TestVideoCapturer* capturer_; | 144 TestVideoCapturer* capturer_; |
145 cricket::FakeVideoRenderer renderer_; | 145 cricket::FakeVideoRenderer renderer_; |
146 rtc::scoped_ptr<StateObserver> state_observer_; | 146 rtc::scoped_ptr<StateObserver> state_observer_; |
147 rtc::scoped_refptr<VideoSource> source_; | 147 rtc::scoped_refptr<VideoSource> source_; |
148 }; | 148 }; |
149 | 149 |
150 | 150 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 // RemoteVideoCapturer and takes video frames from FrameInput. | 193 // RemoteVideoCapturer and takes video frames from FrameInput. |
194 TEST_F(VideoSourceTest, StartStopRemote) { | 194 TEST_F(VideoSourceTest, StartStopRemote) { |
195 source_ = VideoSource::Create(rtc::Thread::Current(), | 195 source_ = VideoSource::Create(rtc::Thread::Current(), |
196 new webrtc::RemoteVideoCapturer(), NULL, true); | 196 new webrtc::RemoteVideoCapturer(), NULL, true); |
197 | 197 |
198 ASSERT_TRUE(source_.get() != NULL); | 198 ASSERT_TRUE(source_.get() != NULL); |
199 EXPECT_TRUE(NULL != source_->GetVideoCapturer()); | 199 EXPECT_TRUE(NULL != source_->GetVideoCapturer()); |
200 | 200 |
201 state_observer_.reset(new StateObserver(source_)); | 201 state_observer_.reset(new StateObserver(source_)); |
202 source_->RegisterObserver(state_observer_.get()); | 202 source_->RegisterObserver(state_observer_.get()); |
203 source_->AddSink(&renderer_); | 203 source_->AddOrUpdateSink(&renderer_, rtc::VideoSinkWants()); |
204 | 204 |
205 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), | 205 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), |
206 kMaxWaitMs); | 206 kMaxWaitMs); |
207 | 207 |
208 source_->GetVideoCapturer()->Stop(); | 208 source_->GetVideoCapturer()->Stop(); |
209 EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(), | 209 EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(), |
210 kMaxWaitMs); | 210 kMaxWaitMs); |
211 } | 211 } |
212 | 212 |
213 // Test that a VideoSource transition to kEnded if the capture device | 213 // Test that a VideoSource transition to kEnded if the capture device |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 FakeConstraints constraints; | 520 FakeConstraints constraints; |
521 constraints.AddOptional(MediaConstraintsInterface::kMaxFrameRate, 0.5); | 521 constraints.AddOptional(MediaConstraintsInterface::kMaxFrameRate, 0.5); |
522 | 522 |
523 CreateVideoSource(&constraints); | 523 CreateVideoSource(&constraints); |
524 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), | 524 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), |
525 kMaxWaitMs); | 525 kMaxWaitMs); |
526 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); | 526 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); |
527 ASSERT_TRUE(format != NULL); | 527 ASSERT_TRUE(format != NULL); |
528 EXPECT_EQ(30, format->framerate()); | 528 EXPECT_EQ(30, format->framerate()); |
529 } | 529 } |
OLD | NEW |