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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 capturer_ = capturer_cleanup_.get(); | 114 capturer_ = capturer_cleanup_.get(); |
115 } | 115 } |
116 | 116 |
117 void InitScreencast() { InitCapturer(true); } | 117 void InitScreencast() { InitCapturer(true); } |
118 | 118 |
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( |
125 capturer_cleanup_.release(), | 125 rtc::Thread::Current(), |
126 constraints, false); | 126 std::unique_ptr<cricket::VideoCapturer>(capturer_cleanup_.release()), |
| 127 constraints, false); |
127 | 128 |
128 ASSERT_TRUE(source_.get() != NULL); | 129 ASSERT_TRUE(source_.get() != NULL); |
129 | 130 |
130 state_observer_.reset(new StateObserver(source_)); | 131 state_observer_.reset(new StateObserver(source_)); |
131 source_->RegisterObserver(state_observer_.get()); | 132 source_->RegisterObserver(state_observer_.get()); |
132 source_->AddOrUpdateSink(&renderer_, rtc::VideoSinkWants()); | 133 source_->AddOrUpdateSink(&renderer_, rtc::VideoSinkWants()); |
133 } | 134 } |
134 | 135 |
135 std::unique_ptr<TestVideoCapturer> capturer_cleanup_; | 136 std::unique_ptr<TestVideoCapturer> capturer_cleanup_; |
136 TestVideoCapturer* capturer_; | 137 TestVideoCapturer* capturer_; |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 FakeConstraints constraints; | 458 FakeConstraints constraints; |
458 constraints.AddOptional(MediaConstraintsInterface::kMaxFrameRate, 0.5); | 459 constraints.AddOptional(MediaConstraintsInterface::kMaxFrameRate, 0.5); |
459 | 460 |
460 CreateVideoCapturerSource(&constraints); | 461 CreateVideoCapturerSource(&constraints); |
461 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), | 462 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), |
462 kMaxWaitMs); | 463 kMaxWaitMs); |
463 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); | 464 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); |
464 ASSERT_TRUE(format != NULL); | 465 ASSERT_TRUE(format != NULL); |
465 EXPECT_EQ(1, format->framerate()); | 466 EXPECT_EQ(1, format->framerate()); |
466 } | 467 } |
OLD | NEW |