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/media/media_transport_interface.h" 24 #include "api/transport/network_control.h" 25 #include "api/video_codecs/video_decoder_factory.h" 26 #include "api/video_codecs/video_encoder_factory.h" 27 #include "rtc_base/network.h" 28 #include "rtc_base/rtc_certificate_generator.h" 29 #include "rtc_base/ssl_certificate.h" 30 #include "rtc_base/thread.h" 31 32 namespace webrtc { 33 namespace webrtc_pc_e2e { 34 35 // Contains most part from PeerConnectionFactoryDependencies. Also all fields 36 // are optional and defaults will be provided by fixture implementation if 37 // any will be omitted. 38 // 39 // Separate class was introduced to clarify which components can be 40 // overridden. For example worker and signaling threads will be provided by 41 // fixture implementation. The same is applicable to the media engine. So user 42 // can override only some parts of media engine like video encoder/decoder 43 // factories. 44 struct PeerConnectionFactoryComponents { 45 std::unique_ptr<TaskQueueFactory> task_queue_factory; 46 std::unique_ptr<CallFactoryInterface> call_factory; 47 std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory; 48 std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory; 49 std::unique_ptr<NetworkControllerFactoryInterface> network_controller_factory; 50 std::unique_ptr<MediaTransportFactory> media_transport_factory; 51 std::unique_ptr<NetEqFactory> neteq_factory; 52 53 // Will be passed to MediaEngineInterface, that will be used in 54 // PeerConnectionFactory. 55 std::unique_ptr<VideoEncoderFactory> video_encoder_factory; 56 std::unique_ptr<VideoDecoderFactory> video_decoder_factory; 57 }; 58 59 // Contains most parts from PeerConnectionDependencies. Also all fields are 60 // optional and defaults will be provided by fixture implementation if any 61 // will be omitted. 62 // 63 // Separate class was introduced to clarify which components can be 64 // overridden. For example observer, which is required to 65 // PeerConnectionDependencies, will be provided by fixture implementation, 66 // so client can't inject its own. Also only network manager can be overridden 67 // inside port allocator. 68 struct PeerConnectionComponents { PeerConnectionComponentsPeerConnectionComponents69 explicit PeerConnectionComponents(rtc::NetworkManager* network_manager) 70 : network_manager(network_manager) { 71 RTC_CHECK(network_manager); 72 } 73 74 rtc::NetworkManager* const network_manager; 75 std::unique_ptr<webrtc::AsyncResolverFactory> async_resolver_factory; 76 std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator; 77 std::unique_ptr<rtc::SSLCertificateVerifier> tls_cert_verifier; 78 std::unique_ptr<IceTransportFactory> ice_transport_factory; 79 }; 80 81 // Contains all components, that can be overridden in peer connection. Also 82 // has a network thread, that will be used to communicate with another peers. 83 struct InjectableComponents { InjectableComponentsInjectableComponents84 explicit InjectableComponents(rtc::Thread* network_thread, 85 rtc::NetworkManager* network_manager) 86 : network_thread(network_thread), 87 pcf_dependencies(std::make_unique<PeerConnectionFactoryComponents>()), 88 pc_dependencies( 89 std::make_unique<PeerConnectionComponents>(network_manager)) { 90 RTC_CHECK(network_thread); 91 } 92 93 rtc::Thread* const network_thread; 94 95 std::unique_ptr<PeerConnectionFactoryComponents> pcf_dependencies; 96 std::unique_ptr<PeerConnectionComponents> pc_dependencies; 97 }; 98 99 // Contains information about call media streams (up to 1 audio stream and 100 // unlimited amount of video streams) and rtc configuration, that will be used 101 // to set up peer connection. 102 struct Params { 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 PeerConnectionInterface::BitrateParameters bitrate_params; 116 }; 117 118 } // namespace webrtc_pc_e2e 119 } // namespace webrtc 120 121 #endif // TEST_PC_E2E_PEER_CONNECTION_QUALITY_TEST_PARAMS_H_ 122