| 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 |
| 11 #include "webrtc/test/call_test.h" | 11 #include "webrtc/test/call_test.h" |
| 12 | 12 |
| 13 #include <algorithm> | 13 #include <algorithm> |
| 14 | 14 |
| 15 #include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h" | 15 #include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h" |
| 16 #include "webrtc/api/audio_codecs/builtin_audio_encoder_factory.h" | 16 #include "webrtc/api/audio_codecs/builtin_audio_encoder_factory.h" |
| 17 #include "webrtc/call/rtp_transport_controller_send.h" |
| 17 #include "webrtc/config.h" | 18 #include "webrtc/config.h" |
| 18 #include "webrtc/modules/audio_mixer/audio_mixer_impl.h" | 19 #include "webrtc/modules/audio_mixer/audio_mixer_impl.h" |
| 19 #include "webrtc/rtc_base/checks.h" | 20 #include "webrtc/rtc_base/checks.h" |
| 20 #include "webrtc/test/testsupport/fileutils.h" | 21 #include "webrtc/test/testsupport/fileutils.h" |
| 21 #include "webrtc/voice_engine/include/voe_base.h" | 22 #include "webrtc/voice_engine/include/voe_base.h" |
| 22 | |
| 23 namespace webrtc { | 23 namespace webrtc { |
| 24 namespace test { | 24 namespace test { |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| 27 const int kVideoRotationRtpExtensionId = 4; | 27 const int kVideoRotationRtpExtensionId = 4; |
| 28 } | 28 } |
| 29 | 29 |
| 30 CallTest::CallTest() | 30 CallTest::CallTest() |
| 31 : clock_(Clock::GetRealTimeClock()), | 31 : clock_(Clock::GetRealTimeClock()), |
| 32 event_log_(RtcEventLog::CreateNull()), | 32 event_log_(RtcEventLog::CreateNull()), |
| 33 sender_call_transport_controller_(nullptr), |
| 33 video_send_config_(nullptr), | 34 video_send_config_(nullptr), |
| 34 video_send_stream_(nullptr), | 35 video_send_stream_(nullptr), |
| 35 audio_send_config_(nullptr), | 36 audio_send_config_(nullptr), |
| 36 audio_send_stream_(nullptr), | 37 audio_send_stream_(nullptr), |
| 37 fake_encoder_(clock_), | 38 fake_encoder_(clock_), |
| 38 num_video_streams_(1), | 39 num_video_streams_(1), |
| 39 num_audio_streams_(0), | 40 num_audio_streams_(0), |
| 40 num_flexfec_streams_(0), | 41 num_flexfec_streams_(0), |
| 41 decoder_factory_(CreateBuiltinAudioDecoderFactory()), | 42 decoder_factory_(CreateBuiltinAudioDecoderFactory()), |
| 42 encoder_factory_(CreateBuiltinAudioEncoderFactory()), | 43 encoder_factory_(CreateBuiltinAudioEncoderFactory()), |
| (...skipping 16 matching lines...) Expand all Loading... |
| 59 apm_send_ = AudioProcessing::Create(); | 60 apm_send_ = AudioProcessing::Create(); |
| 60 apm_recv_ = AudioProcessing::Create(); | 61 apm_recv_ = AudioProcessing::Create(); |
| 61 CreateVoiceEngines(); | 62 CreateVoiceEngines(); |
| 62 AudioState::Config audio_state_config; | 63 AudioState::Config audio_state_config; |
| 63 audio_state_config.voice_engine = voe_send_.voice_engine; | 64 audio_state_config.voice_engine = voe_send_.voice_engine; |
| 64 audio_state_config.audio_mixer = AudioMixerImpl::Create(); | 65 audio_state_config.audio_mixer = AudioMixerImpl::Create(); |
| 65 audio_state_config.audio_processing = apm_send_; | 66 audio_state_config.audio_processing = apm_send_; |
| 66 send_config.audio_state = AudioState::Create(audio_state_config); | 67 send_config.audio_state = AudioState::Create(audio_state_config); |
| 67 } | 68 } |
| 68 CreateSenderCall(send_config); | 69 CreateSenderCall(send_config); |
| 70 if (sender_call_transport_controller_ != nullptr) { |
| 71 test->OnRtpTransportControllerSendCreated( |
| 72 sender_call_transport_controller_); |
| 73 } |
| 69 if (test->ShouldCreateReceivers()) { | 74 if (test->ShouldCreateReceivers()) { |
| 70 Call::Config recv_config(test->GetReceiverCallConfig()); | 75 Call::Config recv_config(test->GetReceiverCallConfig()); |
| 71 if (num_audio_streams_ > 0) { | 76 if (num_audio_streams_ > 0) { |
| 72 AudioState::Config audio_state_config; | 77 AudioState::Config audio_state_config; |
| 73 audio_state_config.voice_engine = voe_recv_.voice_engine; | 78 audio_state_config.voice_engine = voe_recv_.voice_engine; |
| 74 audio_state_config.audio_mixer = AudioMixerImpl::Create(); | 79 audio_state_config.audio_mixer = AudioMixerImpl::Create(); |
| 75 audio_state_config.audio_processing = apm_recv_; | 80 audio_state_config.audio_processing = apm_recv_; |
| 76 recv_config.audio_state = AudioState::Create(audio_state_config); | 81 recv_config.audio_state = AudioState::Create(audio_state_config); |
| 77 } | 82 } |
| 78 CreateReceiverCall(recv_config); | 83 CreateReceiverCall(recv_config); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 video_send_stream_->Stop(); | 183 video_send_stream_->Stop(); |
| 179 } | 184 } |
| 180 | 185 |
| 181 void CallTest::CreateCalls(const Call::Config& sender_config, | 186 void CallTest::CreateCalls(const Call::Config& sender_config, |
| 182 const Call::Config& receiver_config) { | 187 const Call::Config& receiver_config) { |
| 183 CreateSenderCall(sender_config); | 188 CreateSenderCall(sender_config); |
| 184 CreateReceiverCall(receiver_config); | 189 CreateReceiverCall(receiver_config); |
| 185 } | 190 } |
| 186 | 191 |
| 187 void CallTest::CreateSenderCall(const Call::Config& config) { | 192 void CallTest::CreateSenderCall(const Call::Config& config) { |
| 188 sender_call_.reset(Call::Create(config)); | 193 sender_call_transport_controller_ = new RtpTransportControllerSend( |
| 194 Clock::GetRealTimeClock(), config.event_log); |
| 195 |
| 196 sender_call_.reset( |
| 197 Call::Create(config, std::unique_ptr<RtpTransportControllerSend>( |
| 198 sender_call_transport_controller_))); |
| 189 } | 199 } |
| 190 | 200 |
| 191 void CallTest::CreateReceiverCall(const Call::Config& config) { | 201 void CallTest::CreateReceiverCall(const Call::Config& config) { |
| 192 receiver_call_.reset(Call::Create(config)); | 202 receiver_call_.reset(Call::Create(config)); |
| 193 } | 203 } |
| 194 | 204 |
| 195 void CallTest::DestroyCalls() { | 205 void CallTest::DestroyCalls() { |
| 196 sender_call_.reset(); | 206 sender_call_.reset(); |
| 197 receiver_call_.reset(); | 207 receiver_call_.reset(); |
| 198 } | 208 } |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 } | 508 } |
| 499 | 509 |
| 500 Call::Config BaseTest::GetSenderCallConfig() { | 510 Call::Config BaseTest::GetSenderCallConfig() { |
| 501 return Call::Config(event_log_.get()); | 511 return Call::Config(event_log_.get()); |
| 502 } | 512 } |
| 503 | 513 |
| 504 Call::Config BaseTest::GetReceiverCallConfig() { | 514 Call::Config BaseTest::GetReceiverCallConfig() { |
| 505 return Call::Config(event_log_.get()); | 515 return Call::Config(event_log_.get()); |
| 506 } | 516 } |
| 507 | 517 |
| 518 void BaseTest::OnRtpTransportControllerSendCreated( |
| 519 RtpTransportControllerSend* controller) {} |
| 520 |
| 508 void BaseTest::OnCallsCreated(Call* sender_call, Call* receiver_call) { | 521 void BaseTest::OnCallsCreated(Call* sender_call, Call* receiver_call) { |
| 509 } | 522 } |
| 510 | 523 |
| 511 test::PacketTransport* BaseTest::CreateSendTransport(Call* sender_call) { | 524 test::PacketTransport* BaseTest::CreateSendTransport(Call* sender_call) { |
| 512 return new PacketTransport(sender_call, this, test::PacketTransport::kSender, | 525 return new PacketTransport(sender_call, this, test::PacketTransport::kSender, |
| 513 CallTest::payload_type_map_, | 526 CallTest::payload_type_map_, |
| 514 FakeNetworkPipe::Config()); | 527 FakeNetworkPipe::Config()); |
| 515 } | 528 } |
| 516 | 529 |
| 517 test::PacketTransport* BaseTest::CreateReceiveTransport() { | 530 test::PacketTransport* BaseTest::CreateReceiveTransport() { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 | 590 |
| 578 EndToEndTest::EndToEndTest(unsigned int timeout_ms) : BaseTest(timeout_ms) { | 591 EndToEndTest::EndToEndTest(unsigned int timeout_ms) : BaseTest(timeout_ms) { |
| 579 } | 592 } |
| 580 | 593 |
| 581 bool EndToEndTest::ShouldCreateReceivers() const { | 594 bool EndToEndTest::ShouldCreateReceivers() const { |
| 582 return true; | 595 return true; |
| 583 } | 596 } |
| 584 | 597 |
| 585 } // namespace test | 598 } // namespace test |
| 586 } // namespace webrtc | 599 } // namespace webrtc |
| OLD | NEW |