blob: 4f0d72e66750f7368372401150f6bda6f68e9296 [file] [log] [blame]
wu@webrtc.org364f2042013-11-20 21:49:41 +00001/*
kjellanderb24317b2016-02-10 07:54:43 -08002 * Copyright 2013 The WebRTC project authors. All Rights Reserved.
wu@webrtc.org364f2042013-11-20 21:49:41 +00003 *
kjellanderb24317b2016-02-10 07:54:43 -08004 * 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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
wu@webrtc.org364f2042013-11-20 21:49:41 +00009 */
10
Jonas Olssona4d87372019-07-05 19:08:33 +020011#include "pc/test/peer_connection_test_wrapper.h"
12
Yves Gerey3e707812018-11-28 16:47:49 +010013#include <stddef.h>
Jonas Olssona4d87372019-07-05 19:08:33 +020014
Mirko Bonadei317a1f02019-09-17 17:06:18 +020015#include <memory>
Steve Anton36b29d12017-10-30 09:57:42 -070016#include <string>
kwiberg0eb15ed2015-12-17 03:04:15 -080017#include <utility>
Steve Anton191c39f2018-01-24 19:35:55 -080018#include <vector>
kwiberg0eb15ed2015-12-17 03:04:15 -080019
Yves Gerey3e707812018-11-28 16:47:49 +010020#include "absl/types/optional.h"
21#include "api/audio/audio_mixer.h"
Mirko Bonadei2ff3f492018-11-22 09:00:13 +010022#include "api/create_peerconnection_factory.h"
Anders Carlsson67537952018-05-03 11:28:29 +020023#include "api/video_codecs/builtin_video_decoder_factory.h"
24#include "api/video_codecs/builtin_video_encoder_factory.h"
Yves Gerey3e707812018-11-28 16:47:49 +010025#include "api/video_codecs/video_decoder_factory.h"
26#include "api/video_codecs/video_encoder_factory.h"
27#include "modules/audio_device/include/audio_device.h"
Anders Carlsson67537952018-05-03 11:28:29 +020028#include "modules/audio_processing/include/audio_processing.h"
Steve Anton10542f22019-01-11 09:11:00 -080029#include "p2p/base/fake_port_allocator.h"
30#include "p2p/base/port_allocator.h"
31#include "pc/test/fake_periodic_video_source.h"
32#include "pc/test/fake_periodic_video_track_source.h"
33#include "pc/test/fake_rtc_certificate_generator.h"
34#include "pc/test/mock_peer_connection_observers.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020035#include "rtc_base/gunit.h"
Yves Gerey3e707812018-11-28 16:47:49 +010036#include "rtc_base/logging.h"
Steve Anton10542f22019-01-11 09:11:00 -080037#include "rtc_base/ref_counted_object.h"
38#include "rtc_base/rtc_certificate_generator.h"
39#include "rtc_base/string_encode.h"
Yves Gerey59cfd352018-11-26 16:22:20 +010040#include "rtc_base/thread_checker.h"
Steve Anton10542f22019-01-11 09:11:00 -080041#include "rtc_base/time_utils.h"
Yves Gerey3e707812018-11-28 16:47:49 +010042#include "test/gtest.h"
wu@webrtc.org364f2042013-11-20 21:49:41 +000043
wu@webrtc.org364f2042013-11-20 21:49:41 +000044using webrtc::FakeVideoTrackRenderer;
45using webrtc::IceCandidateInterface;
wu@webrtc.org364f2042013-11-20 21:49:41 +000046using webrtc::MediaStreamInterface;
Steve Anton191c39f2018-01-24 19:35:55 -080047using webrtc::MediaStreamTrackInterface;
wu@webrtc.org364f2042013-11-20 21:49:41 +000048using webrtc::MockSetSessionDescriptionObserver;
49using webrtc::PeerConnectionInterface;
Steve Anton191c39f2018-01-24 19:35:55 -080050using webrtc::RtpReceiverInterface;
Steve Antona3a92c22017-12-07 10:27:41 -080051using webrtc::SdpType;
wu@webrtc.org364f2042013-11-20 21:49:41 +000052using webrtc::SessionDescriptionInterface;
53using webrtc::VideoTrackInterface;
54
Steve Antona3a92c22017-12-07 10:27:41 -080055namespace {
Seth Hampson845e8782018-03-02 11:34:10 -080056const char kStreamIdBase[] = "stream_id";
Steve Antona3a92c22017-12-07 10:27:41 -080057const char kVideoTrackLabelBase[] = "video_track";
58const char kAudioTrackLabelBase[] = "audio_track";
59constexpr int kMaxWait = 10000;
60constexpr int kTestAudioFrameCount = 3;
61constexpr int kTestVideoFrameCount = 3;
62} // namespace
63
wu@webrtc.org364f2042013-11-20 21:49:41 +000064void PeerConnectionTestWrapper::Connect(PeerConnectionTestWrapper* caller,
65 PeerConnectionTestWrapper* callee) {
66 caller->SignalOnIceCandidateReady.connect(
67 callee, &PeerConnectionTestWrapper::AddIceCandidate);
68 callee->SignalOnIceCandidateReady.connect(
69 caller, &PeerConnectionTestWrapper::AddIceCandidate);
70
Yves Gerey665174f2018-06-19 15:03:05 +020071 caller->SignalOnSdpReady.connect(callee,
72 &PeerConnectionTestWrapper::ReceiveOfferSdp);
wu@webrtc.org364f2042013-11-20 21:49:41 +000073 callee->SignalOnSdpReady.connect(
74 caller, &PeerConnectionTestWrapper::ReceiveAnswerSdp);
75}
76
danilchape9021a32016-05-17 01:52:02 -070077PeerConnectionTestWrapper::PeerConnectionTestWrapper(
78 const std::string& name,
79 rtc::Thread* network_thread,
80 rtc::Thread* worker_thread)
81 : name_(name),
82 network_thread_(network_thread),
Yves Gerey59cfd352018-11-26 16:22:20 +010083 worker_thread_(worker_thread) {
Sebastian Janssonc01367d2019-04-08 15:20:44 +020084 pc_thread_checker_.Detach();
Yves Gerey59cfd352018-11-26 16:22:20 +010085}
wu@webrtc.org364f2042013-11-20 21:49:41 +000086
Yves Gerey59cfd352018-11-26 16:22:20 +010087PeerConnectionTestWrapper::~PeerConnectionTestWrapper() {
88 RTC_DCHECK_RUN_ON(&pc_thread_checker_);
89 // Either network_thread or worker_thread might be active at this point.
90 // Relying on ~PeerConnection to properly wait for them doesn't work,
91 // as a vptr race might occur (before we enter the destruction body).
92 // See: bugs.webrtc.org/9847
93 if (pc()) {
94 pc()->Close();
95 }
96}
wu@webrtc.org364f2042013-11-20 21:49:41 +000097
98bool PeerConnectionTestWrapper::CreatePc(
kwiberg9e5b11e2017-04-19 03:47:57 -070099 const webrtc::PeerConnectionInterface::RTCConfiguration& config,
100 rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory,
101 rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory) {
kwibergd1fe2812016-04-27 06:47:29 -0700102 std::unique_ptr<cricket::PortAllocator> port_allocator(
danilchape9021a32016-05-17 01:52:02 -0700103 new cricket::FakePortAllocator(network_thread_, nullptr));
wu@webrtc.org364f2042013-11-20 21:49:41 +0000104
Yves Gerey59cfd352018-11-26 16:22:20 +0100105 RTC_DCHECK_RUN_ON(&pc_thread_checker_);
106
deadbeefee8c6d32015-08-13 14:27:18 -0700107 fake_audio_capture_module_ = FakeAudioCaptureModule::Create();
wu@webrtc.org364f2042013-11-20 21:49:41 +0000108 if (fake_audio_capture_module_ == NULL) {
109 return false;
110 }
111
112 peer_connection_factory_ = webrtc::CreatePeerConnectionFactory(
danilchape9021a32016-05-17 01:52:02 -0700113 network_thread_, worker_thread_, rtc::Thread::Current(),
Anders Carlsson67537952018-05-03 11:28:29 +0200114 rtc::scoped_refptr<webrtc::AudioDeviceModule>(fake_audio_capture_module_),
115 audio_encoder_factory, audio_decoder_factory,
116 webrtc::CreateBuiltinVideoEncoderFactory(),
117 webrtc::CreateBuiltinVideoDecoderFactory(), nullptr /* audio_mixer */,
118 nullptr /* audio_processing */);
wu@webrtc.org364f2042013-11-20 21:49:41 +0000119 if (!peer_connection_factory_) {
120 return false;
121 }
122
Henrik Boströmd79599d2016-06-01 13:58:50 +0200123 std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator(
deadbeef1b54a5f2017-01-23 19:39:57 -0800124 new FakeRTCCertificateGenerator());
Henrik Boströmd79599d2016-06-01 13:58:50 +0200125 peer_connection_ = peer_connection_factory_->CreatePeerConnection(
Niels Möllerf06f9232018-08-07 12:32:18 +0200126 config, std::move(port_allocator), std::move(cert_generator), this);
wu@webrtc.org364f2042013-11-20 21:49:41 +0000127
128 return peer_connection_.get() != NULL;
129}
130
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000131rtc::scoped_refptr<webrtc::DataChannelInterface>
jiayl@webrtc.org1a6c6282014-06-12 21:59:29 +0000132PeerConnectionTestWrapper::CreateDataChannel(
133 const std::string& label,
134 const webrtc::DataChannelInit& init) {
135 return peer_connection_->CreateDataChannel(label, &init);
136}
137
Steve Anton191c39f2018-01-24 19:35:55 -0800138void PeerConnectionTestWrapper::OnAddTrack(
139 rtc::scoped_refptr<RtpReceiverInterface> receiver,
140 const std::vector<rtc::scoped_refptr<MediaStreamInterface>>& streams) {
141 RTC_LOG(LS_INFO) << "PeerConnectionTestWrapper " << name_ << ": OnAddTrack";
142 if (receiver->track()->kind() == MediaStreamTrackInterface::kVideoKind) {
143 auto* video_track =
144 static_cast<VideoTrackInterface*>(receiver->track().get());
Mirko Bonadei317a1f02019-09-17 17:06:18 +0200145 renderer_ = std::make_unique<FakeVideoTrackRenderer>(video_track);
wu@webrtc.org364f2042013-11-20 21:49:41 +0000146 }
147}
148
149void PeerConnectionTestWrapper::OnIceCandidate(
150 const IceCandidateInterface* candidate) {
151 std::string sdp;
152 EXPECT_TRUE(candidate->ToString(&sdp));
153 // Give the user a chance to modify sdp for testing.
154 SignalOnIceCandidateCreated(&sdp);
155 SignalOnIceCandidateReady(candidate->sdp_mid(), candidate->sdp_mline_index(),
156 sdp);
157}
158
jiayl@webrtc.org1a6c6282014-06-12 21:59:29 +0000159void PeerConnectionTestWrapper::OnDataChannel(
Taylor Brandstetter98cde262016-05-31 13:02:21 -0700160 rtc::scoped_refptr<webrtc::DataChannelInterface> data_channel) {
jiayl@webrtc.org1a6c6282014-06-12 21:59:29 +0000161 SignalOnDataChannel(data_channel);
162}
163
wu@webrtc.org364f2042013-11-20 21:49:41 +0000164void PeerConnectionTestWrapper::OnSuccess(SessionDescriptionInterface* desc) {
sergeyu@chromium.org5bc25c42013-12-05 00:24:06 +0000165 // This callback should take the ownership of |desc|.
kwibergd1fe2812016-04-27 06:47:29 -0700166 std::unique_ptr<SessionDescriptionInterface> owned_desc(desc);
wu@webrtc.org364f2042013-11-20 21:49:41 +0000167 std::string sdp;
168 EXPECT_TRUE(desc->ToString(&sdp));
169
Mirko Bonadei675513b2017-11-09 11:09:25 +0100170 RTC_LOG(LS_INFO) << "PeerConnectionTestWrapper " << name_ << ": "
Steve Antona3a92c22017-12-07 10:27:41 -0800171 << webrtc::SdpTypeToString(desc->GetType())
172 << " sdp created: " << sdp;
wu@webrtc.org364f2042013-11-20 21:49:41 +0000173
174 // Give the user a chance to modify sdp for testing.
175 SignalOnSdpCreated(&sdp);
176
Steve Antona3a92c22017-12-07 10:27:41 -0800177 SetLocalDescription(desc->GetType(), sdp);
wu@webrtc.org364f2042013-11-20 21:49:41 +0000178
179 SignalOnSdpReady(sdp);
180}
181
182void PeerConnectionTestWrapper::CreateOffer(
Niels Möllerf06f9232018-08-07 12:32:18 +0200183 const webrtc::PeerConnectionInterface::RTCOfferAnswerOptions& options) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100184 RTC_LOG(LS_INFO) << "PeerConnectionTestWrapper " << name_ << ": CreateOffer.";
Niels Möllerf06f9232018-08-07 12:32:18 +0200185 peer_connection_->CreateOffer(this, options);
wu@webrtc.org364f2042013-11-20 21:49:41 +0000186}
187
188void PeerConnectionTestWrapper::CreateAnswer(
Niels Möllerf06f9232018-08-07 12:32:18 +0200189 const webrtc::PeerConnectionInterface::RTCOfferAnswerOptions& options) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100190 RTC_LOG(LS_INFO) << "PeerConnectionTestWrapper " << name_
191 << ": CreateAnswer.";
Niels Möllerf06f9232018-08-07 12:32:18 +0200192 peer_connection_->CreateAnswer(this, options);
wu@webrtc.org364f2042013-11-20 21:49:41 +0000193}
194
195void PeerConnectionTestWrapper::ReceiveOfferSdp(const std::string& sdp) {
Steve Antona3a92c22017-12-07 10:27:41 -0800196 SetRemoteDescription(SdpType::kOffer, sdp);
Niels Möllerf06f9232018-08-07 12:32:18 +0200197 CreateAnswer(webrtc::PeerConnectionInterface::RTCOfferAnswerOptions());
wu@webrtc.org364f2042013-11-20 21:49:41 +0000198}
199
200void PeerConnectionTestWrapper::ReceiveAnswerSdp(const std::string& sdp) {
Steve Antona3a92c22017-12-07 10:27:41 -0800201 SetRemoteDescription(SdpType::kAnswer, sdp);
wu@webrtc.org364f2042013-11-20 21:49:41 +0000202}
203
Steve Antona3a92c22017-12-07 10:27:41 -0800204void PeerConnectionTestWrapper::SetLocalDescription(SdpType type,
wu@webrtc.org364f2042013-11-20 21:49:41 +0000205 const std::string& sdp) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100206 RTC_LOG(LS_INFO) << "PeerConnectionTestWrapper " << name_
Steve Antona3a92c22017-12-07 10:27:41 -0800207 << ": SetLocalDescription " << webrtc::SdpTypeToString(type)
208 << " " << sdp;
wu@webrtc.org364f2042013-11-20 21:49:41 +0000209
Yves Gerey665174f2018-06-19 15:03:05 +0200210 rtc::scoped_refptr<MockSetSessionDescriptionObserver> observer(
211 new rtc::RefCountedObject<MockSetSessionDescriptionObserver>());
wu@webrtc.org364f2042013-11-20 21:49:41 +0000212 peer_connection_->SetLocalDescription(
Steve Antona3a92c22017-12-07 10:27:41 -0800213 observer, webrtc::CreateSessionDescription(type, sdp).release());
wu@webrtc.org364f2042013-11-20 21:49:41 +0000214}
215
Steve Antona3a92c22017-12-07 10:27:41 -0800216void PeerConnectionTestWrapper::SetRemoteDescription(SdpType type,
wu@webrtc.org364f2042013-11-20 21:49:41 +0000217 const std::string& sdp) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100218 RTC_LOG(LS_INFO) << "PeerConnectionTestWrapper " << name_
Steve Antona3a92c22017-12-07 10:27:41 -0800219 << ": SetRemoteDescription " << webrtc::SdpTypeToString(type)
220 << " " << sdp;
wu@webrtc.org364f2042013-11-20 21:49:41 +0000221
Yves Gerey665174f2018-06-19 15:03:05 +0200222 rtc::scoped_refptr<MockSetSessionDescriptionObserver> observer(
223 new rtc::RefCountedObject<MockSetSessionDescriptionObserver>());
wu@webrtc.org364f2042013-11-20 21:49:41 +0000224 peer_connection_->SetRemoteDescription(
Steve Antona3a92c22017-12-07 10:27:41 -0800225 observer, webrtc::CreateSessionDescription(type, sdp).release());
wu@webrtc.org364f2042013-11-20 21:49:41 +0000226}
227
228void PeerConnectionTestWrapper::AddIceCandidate(const std::string& sdp_mid,
229 int sdp_mline_index,
230 const std::string& candidate) {
kwibergd1fe2812016-04-27 06:47:29 -0700231 std::unique_ptr<webrtc::IceCandidateInterface> owned_candidate(
sergeyu@chromium.org5bc25c42013-12-05 00:24:06 +0000232 webrtc::CreateIceCandidate(sdp_mid, sdp_mline_index, candidate, NULL));
233 EXPECT_TRUE(peer_connection_->AddIceCandidate(owned_candidate.get()));
wu@webrtc.org364f2042013-11-20 21:49:41 +0000234}
235
236void PeerConnectionTestWrapper::WaitForCallEstablished() {
237 WaitForConnection();
238 WaitForAudio();
239 WaitForVideo();
240}
241
242void PeerConnectionTestWrapper::WaitForConnection() {
243 EXPECT_TRUE_WAIT(CheckForConnection(), kMaxWait);
Mirko Bonadei675513b2017-11-09 11:09:25 +0100244 RTC_LOG(LS_INFO) << "PeerConnectionTestWrapper " << name_ << ": Connected.";
wu@webrtc.org364f2042013-11-20 21:49:41 +0000245}
246
247bool PeerConnectionTestWrapper::CheckForConnection() {
248 return (peer_connection_->ice_connection_state() ==
mallinath@webrtc.org385857d2014-02-14 00:56:12 +0000249 PeerConnectionInterface::kIceConnectionConnected) ||
250 (peer_connection_->ice_connection_state() ==
251 PeerConnectionInterface::kIceConnectionCompleted);
wu@webrtc.org364f2042013-11-20 21:49:41 +0000252}
253
254void PeerConnectionTestWrapper::WaitForAudio() {
255 EXPECT_TRUE_WAIT(CheckForAudio(), kMaxWait);
Mirko Bonadei675513b2017-11-09 11:09:25 +0100256 RTC_LOG(LS_INFO) << "PeerConnectionTestWrapper " << name_
257 << ": Got enough audio frames.";
wu@webrtc.org364f2042013-11-20 21:49:41 +0000258}
259
260bool PeerConnectionTestWrapper::CheckForAudio() {
261 return (fake_audio_capture_module_->frames_received() >=
262 kTestAudioFrameCount);
263}
264
265void PeerConnectionTestWrapper::WaitForVideo() {
266 EXPECT_TRUE_WAIT(CheckForVideo(), kMaxWait);
Mirko Bonadei675513b2017-11-09 11:09:25 +0100267 RTC_LOG(LS_INFO) << "PeerConnectionTestWrapper " << name_
268 << ": Got enough video frames.";
wu@webrtc.org364f2042013-11-20 21:49:41 +0000269}
270
271bool PeerConnectionTestWrapper::CheckForVideo() {
272 if (!renderer_) {
273 return false;
274 }
275 return (renderer_->num_rendered_frames() >= kTestVideoFrameCount);
276}
277
278void PeerConnectionTestWrapper::GetAndAddUserMedia(
Yves Gerey665174f2018-06-19 15:03:05 +0200279 bool audio,
280 const cricket::AudioOptions& audio_options,
Niels Möller5c4ddad2019-02-12 12:30:58 +0100281 bool video) {
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000282 rtc::scoped_refptr<webrtc::MediaStreamInterface> stream =
Niels Möller5c4ddad2019-02-12 12:30:58 +0100283 GetUserMedia(audio, audio_options, video);
Mirko Bonadei739baf02019-01-27 17:29:42 +0100284 for (const auto& audio_track : stream->GetAudioTracks()) {
Seth Hampson13b8bad2018-03-13 16:05:28 -0700285 EXPECT_TRUE(peer_connection_->AddTrack(audio_track, {stream->id()}).ok());
Steve Anton191c39f2018-01-24 19:35:55 -0800286 }
Mirko Bonadei739baf02019-01-27 17:29:42 +0100287 for (const auto& video_track : stream->GetVideoTracks()) {
Seth Hampson13b8bad2018-03-13 16:05:28 -0700288 EXPECT_TRUE(peer_connection_->AddTrack(video_track, {stream->id()}).ok());
Steve Anton191c39f2018-01-24 19:35:55 -0800289 }
wu@webrtc.org364f2042013-11-20 21:49:41 +0000290}
291
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000292rtc::scoped_refptr<webrtc::MediaStreamInterface>
Niels Möller2d02e082018-05-21 11:23:35 +0200293PeerConnectionTestWrapper::GetUserMedia(
Yves Gerey665174f2018-06-19 15:03:05 +0200294 bool audio,
295 const cricket::AudioOptions& audio_options,
Niels Möller5c4ddad2019-02-12 12:30:58 +0100296 bool video) {
Seth Hampson845e8782018-03-02 11:34:10 -0800297 std::string stream_id =
298 kStreamIdBase + rtc::ToString(num_get_user_media_calls_++);
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000299 rtc::scoped_refptr<webrtc::MediaStreamInterface> stream =
Seth Hampson845e8782018-03-02 11:34:10 -0800300 peer_connection_factory_->CreateLocalMediaStream(stream_id);
wu@webrtc.org364f2042013-11-20 21:49:41 +0000301
302 if (audio) {
Niels Möller2d02e082018-05-21 11:23:35 +0200303 cricket::AudioOptions options = audio_options;
wu@webrtc.org364f2042013-11-20 21:49:41 +0000304 // Disable highpass filter so that we can get all the test audio frames.
Niels Möller2d02e082018-05-21 11:23:35 +0200305 options.highpass_filter = false;
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000306 rtc::scoped_refptr<webrtc::AudioSourceInterface> source =
Niels Möller2d02e082018-05-21 11:23:35 +0200307 peer_connection_factory_->CreateAudioSource(options);
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000308 rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track(
wu@webrtc.org364f2042013-11-20 21:49:41 +0000309 peer_connection_factory_->CreateAudioTrack(kAudioTrackLabelBase,
310 source));
311 stream->AddTrack(audio_track);
312 }
313
314 if (video) {
315 // Set max frame rate to 10fps to reduce the risk of the tests to be flaky.
Niels Möllera1cc73f2018-05-28 16:20:42 +0200316 webrtc::FakePeriodicVideoSource::Config config;
317 config.frame_interval_ms = 100;
Johannes Kron965e7942018-09-13 15:36:20 +0200318 config.timestamp_offset_ms = rtc::TimeMillis();
wu@webrtc.org364f2042013-11-20 21:49:41 +0000319
perkja3ede6c2016-03-08 01:27:48 +0100320 rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> source =
Niels Möllera1cc73f2018-05-28 16:20:42 +0200321 new rtc::RefCountedObject<webrtc::FakePeriodicVideoTrackSource>(
322 config, /* remote */ false);
323
Seth Hampson845e8782018-03-02 11:34:10 -0800324 std::string videotrack_label = stream_id + kVideoTrackLabelBase;
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000325 rtc::scoped_refptr<webrtc::VideoTrackInterface> video_track(
wu@webrtc.org364f2042013-11-20 21:49:41 +0000326 peer_connection_factory_->CreateVideoTrack(videotrack_label, source));
327
328 stream->AddTrack(video_track);
329 }
330 return stream;
331}