| 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 #include "webrtc/base/checks.h" | 10 #include "webrtc/base/checks.h" |
| 11 #include "webrtc/common.h" | 11 #include "webrtc/common.h" |
| 12 #include "webrtc/config.h" | 12 #include "webrtc/config.h" |
| 13 #include "webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.h" | 13 #include "webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.h" |
| 14 #include "webrtc/test/call_test.h" | 14 #include "webrtc/test/call_test.h" |
| 15 #include "webrtc/test/encoder_settings.h" | 15 #include "webrtc/test/encoder_settings.h" |
| 16 #include "webrtc/test/testsupport/fileutils.h" | 16 #include "webrtc/test/testsupport/fileutils.h" |
| 17 #include "webrtc/voice_engine/include/voe_base.h" | 17 #include "webrtc/voice_engine/include/voe_base.h" |
| 18 #include "webrtc/voice_engine/include/voe_codec.h" | 18 #include "webrtc/voice_engine/include/voe_codec.h" |
| 19 #include "webrtc/voice_engine/voice_engine_impl.h" |
| 20 #include "webrtc/voice_engine/channel_proxy.h" |
| 19 | 21 |
| 20 namespace webrtc { | 22 namespace webrtc { |
| 21 namespace test { | 23 namespace test { |
| 22 | 24 |
| 23 namespace { | 25 namespace { |
| 24 const int kVideoRotationRtpExtensionId = 4; | 26 const int kVideoRotationRtpExtensionId = 4; |
| 25 } | 27 } |
| 26 | 28 |
| 27 CallTest::CallTest() | 29 CallTest::CallTest() |
| 28 : clock_(Clock::GetRealTimeClock()), | 30 : clock_(Clock::GetRealTimeClock()), |
| 29 video_send_config_(nullptr), | 31 video_send_config_(nullptr), |
| 30 video_send_stream_(nullptr), | 32 video_send_stream_(nullptr), |
| 31 audio_send_config_(nullptr), | 33 audio_send_config_(nullptr), |
| 32 audio_send_stream_(nullptr), | 34 audio_send_stream_(nullptr), |
| 35 audio_send_channel_proxy_(nullptr), |
| 33 fake_encoder_(clock_), | 36 fake_encoder_(clock_), |
| 34 num_video_streams_(1), | 37 num_video_streams_(1), |
| 35 num_audio_streams_(0), | 38 num_audio_streams_(0), |
| 36 decoder_factory_(CreateBuiltinAudioDecoderFactory()), | 39 decoder_factory_(CreateBuiltinAudioDecoderFactory()), |
| 37 fake_send_audio_device_(nullptr), | 40 fake_send_audio_device_(nullptr), |
| 38 fake_recv_audio_device_(nullptr) {} | 41 fake_recv_audio_device_(nullptr) {} |
| 39 | 42 |
| 40 CallTest::~CallTest() { | 43 CallTest::~CallTest() { |
| 41 } | 44 } |
| 42 | 45 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 } | 104 } |
| 102 | 105 |
| 103 Start(); | 106 Start(); |
| 104 test->PerformTest(); | 107 test->PerformTest(); |
| 105 send_transport_->StopSending(); | 108 send_transport_->StopSending(); |
| 106 receive_transport_->StopSending(); | 109 receive_transport_->StopSending(); |
| 107 Stop(); | 110 Stop(); |
| 108 | 111 |
| 109 DestroyStreams(); | 112 DestroyStreams(); |
| 110 DestroyCalls(); | 113 DestroyCalls(); |
| 111 if (num_audio_streams_ > 0) | 114 if (num_audio_streams_ > 0) { |
| 115 audio_send_channel_proxy_.reset(); |
| 112 DestroyVoiceEngines(); | 116 DestroyVoiceEngines(); |
| 117 } |
| 113 } | 118 } |
| 114 | 119 |
| 115 void CallTest::Start() { | 120 void CallTest::Start() { |
| 116 if (video_send_stream_) | 121 if (video_send_stream_) |
| 117 video_send_stream_->Start(); | 122 video_send_stream_->Start(); |
| 118 for (VideoReceiveStream* video_recv_stream : video_receive_streams_) | 123 for (VideoReceiveStream* video_recv_stream : video_receive_streams_) |
| 119 video_recv_stream->Start(); | 124 video_recv_stream->Start(); |
| 120 if (audio_send_stream_) { | 125 if (audio_send_stream_) { |
| 121 fake_send_audio_device_->Start(); | 126 fake_send_audio_device_->Start(); |
| 122 audio_send_stream_->Start(); | 127 audio_send_stream_->Start(); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 voe_send_.voice_engine = VoiceEngine::Create(); | 315 voe_send_.voice_engine = VoiceEngine::Create(); |
| 311 voe_send_.base = VoEBase::GetInterface(voe_send_.voice_engine); | 316 voe_send_.base = VoEBase::GetInterface(voe_send_.voice_engine); |
| 312 voe_send_.codec = VoECodec::GetInterface(voe_send_.voice_engine); | 317 voe_send_.codec = VoECodec::GetInterface(voe_send_.voice_engine); |
| 313 EXPECT_EQ(0, voe_send_.base->Init(fake_send_audio_device_.get(), nullptr, | 318 EXPECT_EQ(0, voe_send_.base->Init(fake_send_audio_device_.get(), nullptr, |
| 314 decoder_factory_)); | 319 decoder_factory_)); |
| 315 Config voe_config; | 320 Config voe_config; |
| 316 voe_config.Set<VoicePacing>(new VoicePacing(true)); | 321 voe_config.Set<VoicePacing>(new VoicePacing(true)); |
| 317 voe_send_.channel_id = voe_send_.base->CreateChannel(voe_config); | 322 voe_send_.channel_id = voe_send_.base->CreateChannel(voe_config); |
| 318 EXPECT_GE(voe_send_.channel_id, 0); | 323 EXPECT_GE(voe_send_.channel_id, 0); |
| 319 | 324 |
| 325 audio_send_channel_proxy_ = |
| 326 static_cast<VoiceEngineImpl*>(voe_send_.voice_engine) |
| 327 ->GetChannelProxy(voe_send_.channel_id); |
| 328 |
| 320 voe_recv_.voice_engine = VoiceEngine::Create(); | 329 voe_recv_.voice_engine = VoiceEngine::Create(); |
| 321 voe_recv_.base = VoEBase::GetInterface(voe_recv_.voice_engine); | 330 voe_recv_.base = VoEBase::GetInterface(voe_recv_.voice_engine); |
| 322 voe_recv_.codec = VoECodec::GetInterface(voe_recv_.voice_engine); | 331 voe_recv_.codec = VoECodec::GetInterface(voe_recv_.voice_engine); |
| 323 EXPECT_EQ(0, voe_recv_.base->Init(fake_recv_audio_device_.get(), nullptr, | 332 EXPECT_EQ(0, voe_recv_.base->Init(fake_recv_audio_device_.get(), nullptr, |
| 324 decoder_factory_)); | 333 decoder_factory_)); |
| 325 voe_recv_.channel_id = voe_recv_.base->CreateChannel(); | 334 voe_recv_.channel_id = voe_recv_.base->CreateChannel(); |
| 326 EXPECT_GE(voe_recv_.channel_id, 0); | 335 EXPECT_GE(voe_recv_.channel_id, 0); |
| 327 } | 336 } |
| 328 | 337 |
| 329 void CallTest::DestroyVoiceEngines() { | 338 void CallTest::DestroyVoiceEngines() { |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 | 439 |
| 431 EndToEndTest::EndToEndTest(unsigned int timeout_ms) : BaseTest(timeout_ms) { | 440 EndToEndTest::EndToEndTest(unsigned int timeout_ms) : BaseTest(timeout_ms) { |
| 432 } | 441 } |
| 433 | 442 |
| 434 bool EndToEndTest::ShouldCreateReceivers() const { | 443 bool EndToEndTest::ShouldCreateReceivers() const { |
| 435 return true; | 444 return true; |
| 436 } | 445 } |
| 437 | 446 |
| 438 } // namespace test | 447 } // namespace test |
| 439 } // namespace webrtc | 448 } // namespace webrtc |
| OLD | NEW |