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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 void CreateVideoCapturerSource() { CreateVideoCapturerSource(NULL); } | 119 void CreateVideoCapturerSource() { CreateVideoCapturerSource(NULL); } |
120 | 120 |
121 void CreateVideoCapturerSource( | 121 void CreateVideoCapturerSource( |
122 const webrtc::MediaConstraintsInterface* constraints) { | 122 const webrtc::MediaConstraintsInterface* constraints) { |
123 // VideoSource take ownership of |capturer_| | 123 // VideoSource take ownership of |capturer_| |
124 source_ = VideoCapturerTrackSource::Create(rtc::Thread::Current(), | 124 source_ = VideoCapturerTrackSource::Create(rtc::Thread::Current(), |
125 capturer_cleanup_.release(), | 125 capturer_cleanup_.release(), |
126 constraints, false); | 126 constraints, false); |
127 | 127 |
128 ASSERT_TRUE(source_.get() != NULL); | 128 ASSERT_TRUE(source_.get() != NULL); |
129 EXPECT_EQ(capturer_, source_->GetVideoCapturer()); | |
130 | 129 |
131 state_observer_.reset(new StateObserver(source_)); | 130 state_observer_.reset(new StateObserver(source_)); |
132 source_->RegisterObserver(state_observer_.get()); | 131 source_->RegisterObserver(state_observer_.get()); |
133 source_->AddOrUpdateSink(&renderer_, rtc::VideoSinkWants()); | 132 source_->AddOrUpdateSink(&renderer_, rtc::VideoSinkWants()); |
134 } | 133 } |
135 | 134 |
136 rtc::scoped_ptr<TestVideoCapturer> capturer_cleanup_; | 135 rtc::scoped_ptr<TestVideoCapturer> capturer_cleanup_; |
137 TestVideoCapturer* capturer_; | 136 TestVideoCapturer* capturer_; |
138 cricket::FakeVideoRenderer renderer_; | 137 cricket::FakeVideoRenderer renderer_; |
139 rtc::scoped_ptr<StateObserver> state_observer_; | 138 rtc::scoped_ptr<StateObserver> state_observer_; |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 FakeConstraints constraints; | 480 FakeConstraints constraints; |
482 constraints.AddOptional(MediaConstraintsInterface::kMaxFrameRate, 0.5); | 481 constraints.AddOptional(MediaConstraintsInterface::kMaxFrameRate, 0.5); |
483 | 482 |
484 CreateVideoCapturerSource(&constraints); | 483 CreateVideoCapturerSource(&constraints); |
485 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), | 484 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), |
486 kMaxWaitMs); | 485 kMaxWaitMs); |
487 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); | 486 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); |
488 ASSERT_TRUE(format != NULL); | 487 ASSERT_TRUE(format != NULL); |
489 EXPECT_EQ(30, format->framerate()); | 488 EXPECT_EQ(30, format->framerate()); |
490 } | 489 } |
OLD | NEW |