1 /* 2 * Copyright (c) 2019 The WebRTC project authors. All Rights Reserved. 3 * 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 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. 9 */ 10 #ifndef TEST_PC_E2E_PEER_CONNECTION_QUALITY_TEST_PARAMS_H_ 11 #define TEST_PC_E2E_PEER_CONNECTION_QUALITY_TEST_PARAMS_H_ 12 13 #include <memory> 14 #include <string> 15 #include <vector> 16 17 #include "api/async_resolver_factory.h" 18 #include "api/call/call_factory_interface.h" 19 #include "api/fec_controller.h" 20 #include "api/rtc_event_log/rtc_event_log_factory_interface.h" 21 #include "api/task_queue/task_queue_factory.h" 22 #include "api/test/peerconnection_quality_test_fixture.h" 23 #include "api/transport/network_control.h" 24 #include "api/video_codecs/video_decoder_factory.h" 25 #include "api/video_codecs/video_encoder_factory.h" 26 #include "rtc_base/network.h" 27 #include "rtc_base/rtc_certificate_generator.h" 28 #include "rtc_base/ssl_certificate.h" 29 #include "rtc_base/thread.h" 30 31 namespace webrtc { 32 namespace webrtc_pc_e2e { 33 34 // Contains most part from PeerConnectionFactoryDependencies. Also all fields 35 // are optional and defaults will be provided by fixture implementation if 36 // any will be omitted. 37 // 38 // Separate class was introduced to clarify which components can be 39 // overridden. For example worker and signaling threads will be provided by 40 // fixture implementation. The same is applicable to the media engine. So user 41 // can override only some parts of media engine like video encoder/decoder 42 // factories. 43 struct PeerConnectionFactoryComponents { 44 std::unique_ptr<TaskQueueFactory> task_queue_factory; 45 std::unique_ptr<CallFactoryInterface> call_factory; 46 std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory; 47 std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory; 48 std::unique_ptr<NetworkControllerFactoryInterface> network_controller_factory; 49 std::unique_ptr<NetEqFactory> neteq_factory; 50 51 // Will be passed to MediaEngineInterface, that will be used in 52 // PeerConnectionFactory. 53 std::unique_ptr<VideoEncoderFactory> video_encoder_factory; 54 std::unique_ptr<VideoDecoderFactory> video_decoder_factory; 55 }; 56 57 // Contains most parts from PeerConnectionDependencies. Also all fields are 58 // optional and defaults will be provided by fixture implementation if any 59 // will be omitted. 60 // 61 // Separate class was introduced to clarify which components can be 62 // overridden. For example observer, which is required to 63 // PeerConnectionDependencies, will be provided by fixture implementation, 64 // so client can't inject its own. Also only network manager can be overridden 65 // inside port allocator. 66 struct PeerConnectionComponents { PeerConnectionComponentsPeerConnectionComponents67 explicit PeerConnectionComponents(rtc::NetworkManager* network_manager) 68 : network_manager(network_manager) { 69 RTC_CHECK(network_manager); 70 } 71 72 rtc::NetworkManager* const network_manager; 73 std::unique_ptr<webrtc::AsyncResolverFactory> async_resolver_factory; 74 std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator; 75 std::unique_ptr<rtc::SSLCertificateVerifier> tls_cert_verifier; 76 std::unique_ptr<IceTransportFactory> ice_transport_factory; 77 }; 78 79 // Contains all components, that can be overridden in peer connection. Also 80 // has a network thread, that will be used to communicate with another peers. 81 struct InjectableComponents { InjectableComponentsInjectableComponents82 explicit InjectableComponents(rtc::Thread* network_thread, 83 rtc::NetworkManager* network_manager) 84 : network_thread(network_thread), 85 pcf_dependencies(std::make_unique<PeerConnectionFactoryComponents>()), 86 pc_dependencies( 87 std::make_unique<PeerConnectionComponents>(network_manager)) { 88 RTC_CHECK(network_thread); 89 } 90 91 rtc::Thread* const network_thread; 92 93 std::unique_ptr<PeerConnectionFactoryComponents> pcf_dependencies; 94 std::unique_ptr<PeerConnectionComponents> pc_dependencies; 95 }; 96 97 // Contains information about call media streams (up to 1 audio stream and 98 // unlimited amount of video streams) and rtc configuration, that will be used 99 // to set up peer connection. 100 struct Params { 101 // Peer name. If empty - default one will be set by the fixture. 102 absl::optional<std::string> name; 103 // If |video_configs| is empty - no video should be added to the test call. 104 std::vector<PeerConnectionE2EQualityTestFixture::VideoConfig> video_configs; 105 // If |audio_config| is set audio stream will be configured 106 absl::optional<PeerConnectionE2EQualityTestFixture::AudioConfig> audio_config; 107 // If |rtc_event_log_path| is set, an RTCEventLog will be saved in that 108 // location and it will be available for further analysis. 109 absl::optional<std::string> rtc_event_log_path; 110 // If |aec_dump_path| is set, an AEC dump will be saved in that location and 111 // it will be available for further analysis. 112 absl::optional<std::string> aec_dump_path; 113 114 PeerConnectionInterface::RTCConfiguration rtc_configuration; 115 BitrateSettings bitrate_settings; 116 }; 117 118 } // namespace webrtc_pc_e2e 119 } // namespace webrtc 120 121 #endif // TEST_PC_E2E_PEER_CONNECTION_QUALITY_TEST_PARAMS_H_ 122