OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 Stop(); | 139 Stop(); |
140 | 140 |
141 DestroyStreams(); | 141 DestroyStreams(); |
142 DestroyCalls(); | 142 DestroyCalls(); |
143 if (num_audio_streams_ > 0) | 143 if (num_audio_streams_ > 0) |
144 DestroyVoiceEngines(); | 144 DestroyVoiceEngines(); |
145 | 145 |
146 test->OnTestFinished(); | 146 test->OnTestFinished(); |
147 } | 147 } |
148 | 148 |
149 void CallTest::Start() { | |
150 if (video_send_stream_) | |
151 video_send_stream_->Start(); | |
152 for (VideoReceiveStream* video_recv_stream : video_receive_streams_) | |
153 video_recv_stream->Start(); | |
154 if (audio_send_stream_) { | |
155 audio_send_stream_->Start(); | |
156 } | |
157 for (AudioReceiveStream* audio_recv_stream : audio_receive_streams_) | |
158 audio_recv_stream->Start(); | |
159 for (FlexfecReceiveStream* flexfec_recv_stream : flexfec_receive_streams_) | |
160 flexfec_recv_stream->Start(); | |
161 if (frame_generator_capturer_.get() != NULL) | |
162 frame_generator_capturer_->Start(); | |
163 } | |
164 | |
165 void CallTest::Stop() { | |
166 if (frame_generator_capturer_.get() != NULL) | |
167 frame_generator_capturer_->Stop(); | |
168 for (FlexfecReceiveStream* flexfec_recv_stream : flexfec_receive_streams_) | |
169 flexfec_recv_stream->Stop(); | |
170 for (AudioReceiveStream* audio_recv_stream : audio_receive_streams_) | |
171 audio_recv_stream->Stop(); | |
172 if (audio_send_stream_) { | |
173 audio_send_stream_->Stop(); | |
174 } | |
175 for (VideoReceiveStream* video_recv_stream : video_receive_streams_) | |
176 video_recv_stream->Stop(); | |
177 if (video_send_stream_) | |
178 video_send_stream_->Stop(); | |
179 } | |
180 | |
181 void CallTest::CreateCalls(const Call::Config& sender_config, | 149 void CallTest::CreateCalls(const Call::Config& sender_config, |
182 const Call::Config& receiver_config) { | 150 const Call::Config& receiver_config) { |
183 CreateSenderCall(sender_config); | 151 CreateSenderCall(sender_config); |
184 CreateReceiverCall(receiver_config); | 152 CreateReceiverCall(receiver_config); |
185 } | 153 } |
186 | 154 |
187 void CallTest::CreateSenderCall(const Call::Config& config) { | 155 void CallTest::CreateSenderCall(const Call::Config& config) { |
188 sender_call_.reset(Call::Create(config)); | 156 sender_call_.reset(Call::Create(config)); |
189 } | 157 } |
190 | 158 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 RTC_DCHECK(audio_receive_streams_.empty()); | 299 RTC_DCHECK(audio_receive_streams_.empty()); |
332 | 300 |
333 video_send_stream_ = sender_call_->CreateVideoSendStream( | 301 video_send_stream_ = sender_call_->CreateVideoSendStream( |
334 video_send_config_.Copy(), video_encoder_config_.Copy()); | 302 video_send_config_.Copy(), video_encoder_config_.Copy()); |
335 for (size_t i = 0; i < video_receive_configs_.size(); ++i) { | 303 for (size_t i = 0; i < video_receive_configs_.size(); ++i) { |
336 video_receive_streams_.push_back(receiver_call_->CreateVideoReceiveStream( | 304 video_receive_streams_.push_back(receiver_call_->CreateVideoReceiveStream( |
337 video_receive_configs_[i].Copy())); | 305 video_receive_configs_[i].Copy())); |
338 } | 306 } |
339 } | 307 } |
340 | 308 |
341 void CallTest::SetFakeVideoCaptureRotation(VideoRotation rotation) { | |
342 frame_generator_capturer_->SetFakeRotation(rotation); | |
343 } | |
344 | |
345 void CallTest::CreateAudioStreams() { | 309 void CallTest::CreateAudioStreams() { |
346 audio_send_stream_ = sender_call_->CreateAudioSendStream(audio_send_config_); | 310 audio_send_stream_ = sender_call_->CreateAudioSendStream(audio_send_config_); |
347 for (size_t i = 0; i < audio_receive_configs_.size(); ++i) { | 311 for (size_t i = 0; i < audio_receive_configs_.size(); ++i) { |
348 audio_receive_streams_.push_back( | 312 audio_receive_streams_.push_back( |
349 receiver_call_->CreateAudioReceiveStream(audio_receive_configs_[i])); | 313 receiver_call_->CreateAudioReceiveStream(audio_receive_configs_[i])); |
350 } | 314 } |
351 } | 315 } |
352 | 316 |
353 void CallTest::CreateFlexfecStreams() { | 317 void CallTest::CreateFlexfecStreams() { |
354 for (size_t i = 0; i < flexfec_receive_configs_.size(); ++i) { | 318 for (size_t i = 0; i < flexfec_receive_configs_.size(); ++i) { |
355 flexfec_receive_streams_.push_back( | 319 flexfec_receive_streams_.push_back( |
356 receiver_call_->CreateFlexfecReceiveStream( | 320 receiver_call_->CreateFlexfecReceiveStream( |
357 flexfec_receive_configs_[i])); | 321 flexfec_receive_configs_[i])); |
358 } | 322 } |
359 } | 323 } |
360 | 324 |
| 325 void CallTest::Start() { |
| 326 if (video_send_stream_) |
| 327 video_send_stream_->Start(); |
| 328 for (VideoReceiveStream* video_recv_stream : video_receive_streams_) |
| 329 video_recv_stream->Start(); |
| 330 if (audio_send_stream_) { |
| 331 audio_send_stream_->Start(); |
| 332 } |
| 333 for (AudioReceiveStream* audio_recv_stream : audio_receive_streams_) |
| 334 audio_recv_stream->Start(); |
| 335 for (FlexfecReceiveStream* flexfec_recv_stream : flexfec_receive_streams_) |
| 336 flexfec_recv_stream->Start(); |
| 337 if (frame_generator_capturer_.get() != NULL) |
| 338 frame_generator_capturer_->Start(); |
| 339 } |
| 340 |
| 341 void CallTest::Stop() { |
| 342 if (frame_generator_capturer_.get() != NULL) |
| 343 frame_generator_capturer_->Stop(); |
| 344 for (FlexfecReceiveStream* flexfec_recv_stream : flexfec_receive_streams_) |
| 345 flexfec_recv_stream->Stop(); |
| 346 for (AudioReceiveStream* audio_recv_stream : audio_receive_streams_) |
| 347 audio_recv_stream->Stop(); |
| 348 if (audio_send_stream_) { |
| 349 audio_send_stream_->Stop(); |
| 350 } |
| 351 for (VideoReceiveStream* video_recv_stream : video_receive_streams_) |
| 352 video_recv_stream->Stop(); |
| 353 if (video_send_stream_) |
| 354 video_send_stream_->Stop(); |
| 355 } |
| 356 |
361 void CallTest::DestroyStreams() { | 357 void CallTest::DestroyStreams() { |
362 if (audio_send_stream_) | 358 if (audio_send_stream_) |
363 sender_call_->DestroyAudioSendStream(audio_send_stream_); | 359 sender_call_->DestroyAudioSendStream(audio_send_stream_); |
364 audio_send_stream_ = nullptr; | 360 audio_send_stream_ = nullptr; |
365 for (AudioReceiveStream* audio_recv_stream : audio_receive_streams_) | 361 for (AudioReceiveStream* audio_recv_stream : audio_receive_streams_) |
366 receiver_call_->DestroyAudioReceiveStream(audio_recv_stream); | 362 receiver_call_->DestroyAudioReceiveStream(audio_recv_stream); |
367 | 363 |
368 if (video_send_stream_) | 364 if (video_send_stream_) |
369 sender_call_->DestroyVideoSendStream(video_send_stream_); | 365 sender_call_->DestroyVideoSendStream(video_send_stream_); |
370 video_send_stream_ = nullptr; | 366 video_send_stream_ = nullptr; |
371 | 367 |
372 for (VideoReceiveStream* video_recv_stream : video_receive_streams_) | 368 for (VideoReceiveStream* video_recv_stream : video_receive_streams_) |
373 receiver_call_->DestroyVideoReceiveStream(video_recv_stream); | 369 receiver_call_->DestroyVideoReceiveStream(video_recv_stream); |
374 | 370 |
375 for (FlexfecReceiveStream* flexfec_recv_stream : flexfec_receive_streams_) | 371 for (FlexfecReceiveStream* flexfec_recv_stream : flexfec_receive_streams_) |
376 receiver_call_->DestroyFlexfecReceiveStream(flexfec_recv_stream); | 372 receiver_call_->DestroyFlexfecReceiveStream(flexfec_recv_stream); |
377 | 373 |
378 video_receive_streams_.clear(); | 374 video_receive_streams_.clear(); |
379 allocated_decoders_.clear(); | 375 allocated_decoders_.clear(); |
380 } | 376 } |
381 | 377 |
| 378 void CallTest::SetFakeVideoCaptureRotation(VideoRotation rotation) { |
| 379 frame_generator_capturer_->SetFakeRotation(rotation); |
| 380 } |
| 381 |
382 void CallTest::CreateVoiceEngines() { | 382 void CallTest::CreateVoiceEngines() { |
383 voe_send_.voice_engine = VoiceEngine::Create(); | 383 voe_send_.voice_engine = VoiceEngine::Create(); |
384 voe_send_.base = VoEBase::GetInterface(voe_send_.voice_engine); | 384 voe_send_.base = VoEBase::GetInterface(voe_send_.voice_engine); |
385 EXPECT_EQ(0, voe_send_.base->Init(fake_send_audio_device_.get(), | 385 EXPECT_EQ(0, voe_send_.base->Init(fake_send_audio_device_.get(), |
386 apm_send_.get(), decoder_factory_)); | 386 apm_send_.get(), decoder_factory_)); |
387 VoEBase::ChannelConfig config; | 387 VoEBase::ChannelConfig config; |
388 config.enable_voice_pacing = true; | 388 config.enable_voice_pacing = true; |
389 voe_send_.channel_id = voe_send_.base->CreateChannel(config); | 389 voe_send_.channel_id = voe_send_.base->CreateChannel(config); |
390 EXPECT_GE(voe_send_.channel_id, 0); | 390 EXPECT_GE(voe_send_.channel_id, 0); |
391 | 391 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 | 547 |
548 EndToEndTest::EndToEndTest(unsigned int timeout_ms) : BaseTest(timeout_ms) { | 548 EndToEndTest::EndToEndTest(unsigned int timeout_ms) : BaseTest(timeout_ms) { |
549 } | 549 } |
550 | 550 |
551 bool EndToEndTest::ShouldCreateReceivers() const { | 551 bool EndToEndTest::ShouldCreateReceivers() const { |
552 return true; | 552 return true; |
553 } | 553 } |
554 | 554 |
555 } // namespace test | 555 } // namespace test |
556 } // namespace webrtc | 556 } // namespace webrtc |
OLD | NEW |