pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2014 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 | */ |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 10 | #ifndef TEST_CALL_TEST_H_ |
| 11 | #define TEST_CALL_TEST_H_ |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 | [diff] [blame] | 12 | |
Bjorn Terelius | 5c2f1f0 | 2019-01-16 16:45:05 | [diff] [blame] | 13 | #include <map> |
kwiberg | 4a206a9 | 2016-03-31 17:24:26 | [diff] [blame] | 14 | #include <memory> |
Bjorn Terelius | 5c2f1f0 | 2019-01-16 16:45:05 | [diff] [blame] | 15 | #include <string> |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 | [diff] [blame] | 16 | #include <vector> |
| 17 | |
Elad Alon | d8d3248 | 2019-02-18 22:45:57 | [diff] [blame] | 18 | #include "absl/types/optional.h" |
Danil Chapovalov | 83bbe91 | 2019-08-07 10:24:53 | [diff] [blame] | 19 | #include "api/rtc_event_log/rtc_event_log.h" |
Danil Chapovalov | 44db436 | 2019-09-30 02:16:28 | [diff] [blame] | 20 | #include "api/task_queue/task_queue_base.h" |
Danil Chapovalov | a92e624 | 2019-04-18 08:58:56 | [diff] [blame] | 21 | #include "api/task_queue/task_queue_factory.h" |
Danil Chapovalov | 99b71df | 2018-10-26 13:57:48 | [diff] [blame] | 22 | #include "api/test/video/function_video_decoder_factory.h" |
| 23 | #include "api/test/video/function_video_encoder_factory.h" |
Markus Handell | f4f2287 | 2022-08-16 11:02:45 | [diff] [blame] | 24 | #include "api/units/time_delta.h" |
Jiawei Ou | c2ebe21 | 2018-11-08 18:02:56 | [diff] [blame] | 25 | #include "api/video/video_bitrate_allocator_factory.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 26 | #include "call/call.h" |
Artem Titov | 3faa832 | 2018-03-07 13:44:00 | [diff] [blame] | 27 | #include "modules/audio_device/include/test_audio_device.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 28 | #include "test/encoder_settings.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 29 | #include "test/fake_decoder.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 30 | #include "test/fake_videorenderer.h" |
Ilya Nikolaevskiy | b0588e6 | 2018-08-27 12:12:27 | [diff] [blame] | 31 | #include "test/fake_vp8_encoder.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 32 | #include "test/frame_generator_capturer.h" |
| 33 | #include "test/rtp_rtcp_observer.h" |
Tommi | 553c869 | 2020-05-05 13:35:45 | [diff] [blame] | 34 | #include "test/run_loop.h" |
Jonas Oreland | 8ca0613 | 2022-03-14 11:52:48 | [diff] [blame] | 35 | #include "test/scoped_key_value_config.h" |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 | [diff] [blame] | 36 | |
| 37 | namespace webrtc { |
| 38 | namespace test { |
| 39 | |
| 40 | class BaseTest; |
| 41 | |
Tomas Gunnarsson | 8408c99 | 2021-02-14 13:19:12 | [diff] [blame] | 42 | class CallTest : public ::testing::Test, public RtpPacketSinkInterface { |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 | [diff] [blame] | 43 | public: |
| 44 | CallTest(); |
Stefan Holmer | 9fea80f | 2016-01-07 16:43:18 | [diff] [blame] | 45 | virtual ~CallTest(); |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 | [diff] [blame] | 46 | |
Ilya Nikolaevskiy | 255d1cd | 2017-12-21 17:02:59 | [diff] [blame] | 47 | static constexpr size_t kNumSsrcs = 6; |
| 48 | static const int kNumSimulcastStreams = 3; |
perkj | fa10b55 | 2016-10-03 06:45:26 | [diff] [blame] | 49 | static const int kDefaultWidth = 320; |
| 50 | static const int kDefaultHeight = 180; |
| 51 | static const int kDefaultFramerate = 30; |
Markus Handell | f4f2287 | 2022-08-16 11:02:45 | [diff] [blame] | 52 | static constexpr TimeDelta kDefaultTimeout = TimeDelta::Seconds(30); |
| 53 | static constexpr TimeDelta kLongTimeout = TimeDelta::Seconds(120); |
Ilya Nikolaevskiy | 465a5d9 | 2018-03-16 10:12:06 | [diff] [blame] | 54 | enum classPayloadTypes : uint8_t { |
| 55 | kSendRtxPayloadType = 98, |
| 56 | kRtxRedPayloadType = 99, |
| 57 | kVideoSendPayloadType = 100, |
| 58 | kAudioSendPayloadType = 103, |
| 59 | kRedPayloadType = 118, |
| 60 | kUlpfecPayloadType = 119, |
| 61 | kFlexfecPayloadType = 120, |
| 62 | kPayloadTypeH264 = 122, |
| 63 | kPayloadTypeVP8 = 123, |
| 64 | kPayloadTypeVP9 = 124, |
Rasmus Brandt | 5894b6a | 2019-06-13 14:28:14 | [diff] [blame] | 65 | kPayloadTypeGeneric = 125, |
| 66 | kFakeVideoSendPayloadType = 126, |
Ilya Nikolaevskiy | 465a5d9 | 2018-03-16 10:12:06 | [diff] [blame] | 67 | }; |
pbos@webrtc.org | 2bb1bda | 2014-07-07 13:06:48 | [diff] [blame] | 68 | static const uint32_t kSendRtxSsrcs[kNumSsrcs]; |
Stefan Holmer | 9fea80f | 2016-01-07 16:43:18 | [diff] [blame] | 69 | static const uint32_t kVideoSendSsrcs[kNumSsrcs]; |
| 70 | static const uint32_t kAudioSendSsrc; |
brandtr | 841de6a | 2016-11-15 15:10:52 | [diff] [blame] | 71 | static const uint32_t kFlexfecSendSsrc; |
Stefan Holmer | 9fea80f | 2016-01-07 16:43:18 | [diff] [blame] | 72 | static const uint32_t kReceiverLocalVideoSsrc; |
| 73 | static const uint32_t kReceiverLocalAudioSsrc; |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 | [diff] [blame] | 74 | static const int kNackRtpHistoryMs; |
minyue | 20c84cc | 2017-04-10 23:57:57 | [diff] [blame] | 75 | static const std::map<uint8_t, MediaType> payload_type_map_; |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 | [diff] [blame] | 76 | |
| 77 | protected: |
Elad Alon | d8d3248 | 2019-02-18 22:45:57 | [diff] [blame] | 78 | void RegisterRtpExtension(const RtpExtension& extension); |
| 79 | |
Fredrik Solenberg | 8f5787a | 2018-01-11 12:52:30 | [diff] [blame] | 80 | // RunBaseTest overwrites the audio_state of the send and receive Call configs |
| 81 | // to simplify test code. |
stefan | e74eef1 | 2016-01-08 14:47:13 | [diff] [blame] | 82 | void RunBaseTest(BaseTest* test); |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 | [diff] [blame] | 83 | |
Sebastian Jansson | 8e6602f | 2018-07-13 08:43:20 | [diff] [blame] | 84 | void CreateCalls(); |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 | [diff] [blame] | 85 | void CreateCalls(const Call::Config& sender_config, |
| 86 | const Call::Config& receiver_config); |
Sebastian Jansson | 8e6602f | 2018-07-13 08:43:20 | [diff] [blame] | 87 | void CreateSenderCall(); |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 | [diff] [blame] | 88 | void CreateSenderCall(const Call::Config& config); |
| 89 | void CreateReceiverCall(const Call::Config& config); |
Fredrik Solenberg | 4f4ec0a | 2015-10-22 08:49:27 | [diff] [blame] | 90 | void DestroyCalls(); |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 | [diff] [blame] | 91 | |
Ilya Nikolaevskiy | 255d1cd | 2017-12-21 17:02:59 | [diff] [blame] | 92 | void CreateVideoSendConfig(VideoSendStream::Config* video_config, |
| 93 | size_t num_video_streams, |
| 94 | size_t num_used_ssrcs, |
| 95 | Transport* send_transport); |
| 96 | void CreateAudioAndFecSendConfigs(size_t num_audio_streams, |
| 97 | size_t num_flexfec_streams, |
| 98 | Transport* send_transport); |
Sebastian Jansson | 3bd2c79 | 2018-07-13 11:29:03 | [diff] [blame] | 99 | void SetAudioConfig(const AudioSendStream::Config& config); |
| 100 | |
| 101 | void SetSendFecConfig(std::vector<uint32_t> video_send_ssrcs); |
| 102 | void SetSendUlpFecConfig(VideoSendStream::Config* send_config); |
Tommi | f6f4543 | 2022-05-20 13:21:20 | [diff] [blame] | 103 | void SetReceiveUlpFecConfig( |
| 104 | VideoReceiveStreamInterface::Config* receive_config); |
Stefan Holmer | 9fea80f | 2016-01-07 16:43:18 | [diff] [blame] | 105 | void CreateSendConfig(size_t num_video_streams, |
| 106 | size_t num_audio_streams, |
brandtr | 841de6a | 2016-11-15 15:10:52 | [diff] [blame] | 107 | size_t num_flexfec_streams, |
Stefan Holmer | 9fea80f | 2016-01-07 16:43:18 | [diff] [blame] | 108 | Transport* send_transport); |
ilnik | a014cc5 | 2017-03-07 12:21:04 | [diff] [blame] | 109 | |
Sebastian Jansson | 3bd2c79 | 2018-07-13 11:29:03 | [diff] [blame] | 110 | void CreateMatchingVideoReceiveConfigs( |
Ilya Nikolaevskiy | 255d1cd | 2017-12-21 17:02:59 | [diff] [blame] | 111 | const VideoSendStream::Config& video_send_config, |
| 112 | Transport* rtcp_send_transport); |
Sebastian Jansson | 3bd2c79 | 2018-07-13 11:29:03 | [diff] [blame] | 113 | void CreateMatchingVideoReceiveConfigs( |
| 114 | const VideoSendStream::Config& video_send_config, |
| 115 | Transport* rtcp_send_transport, |
| 116 | bool send_side_bwe, |
Niels Möller | cbcbc22 | 2018-09-28 07:07:24 | [diff] [blame] | 117 | VideoDecoderFactory* decoder_factory, |
Sebastian Jansson | 3bd2c79 | 2018-07-13 11:29:03 | [diff] [blame] | 118 | absl::optional<size_t> decode_sub_stream, |
| 119 | bool receiver_reference_time_report, |
| 120 | int rtp_history_ms); |
| 121 | void AddMatchingVideoReceiveConfigs( |
Tommi | f6f4543 | 2022-05-20 13:21:20 | [diff] [blame] | 122 | std::vector<VideoReceiveStreamInterface::Config>* receive_configs, |
Sebastian Jansson | 3bd2c79 | 2018-07-13 11:29:03 | [diff] [blame] | 123 | const VideoSendStream::Config& video_send_config, |
| 124 | Transport* rtcp_send_transport, |
| 125 | bool send_side_bwe, |
Niels Möller | cbcbc22 | 2018-09-28 07:07:24 | [diff] [blame] | 126 | VideoDecoderFactory* decoder_factory, |
Sebastian Jansson | 3bd2c79 | 2018-07-13 11:29:03 | [diff] [blame] | 127 | absl::optional<size_t> decode_sub_stream, |
| 128 | bool receiver_reference_time_report, |
| 129 | int rtp_history_ms); |
| 130 | |
Ilya Nikolaevskiy | 255d1cd | 2017-12-21 17:02:59 | [diff] [blame] | 131 | void CreateMatchingAudioAndFecConfigs(Transport* rtcp_send_transport); |
Sebastian Jansson | 3bd2c79 | 2018-07-13 11:29:03 | [diff] [blame] | 132 | void CreateMatchingAudioConfigs(Transport* transport, std::string sync_group); |
Tommi | 3176ef7 | 2022-05-22 18:47:28 | [diff] [blame] | 133 | static AudioReceiveStreamInterface::Config CreateMatchingAudioConfig( |
Sebastian Jansson | 3bd2c79 | 2018-07-13 11:29:03 | [diff] [blame] | 134 | const AudioSendStream::Config& send_config, |
| 135 | rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory, |
| 136 | Transport* transport, |
| 137 | std::string sync_group); |
| 138 | void CreateMatchingFecConfig( |
| 139 | Transport* transport, |
| 140 | const VideoSendStream::Config& video_send_config); |
pbos | 2d56668 | 2015-09-28 16:59:31 | [diff] [blame] | 141 | void CreateMatchingReceiveConfigs(Transport* rtcp_send_transport); |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 | [diff] [blame] | 142 | |
perkj | fa10b55 | 2016-10-03 06:45:26 | [diff] [blame] | 143 | void CreateFrameGeneratorCapturerWithDrift(Clock* drift_clock, |
| 144 | float speed, |
| 145 | int framerate, |
| 146 | int width, |
| 147 | int height); |
| 148 | void CreateFrameGeneratorCapturer(int framerate, int width, int height); |
oprypin | 92220ff | 2017-03-23 10:40:03 | [diff] [blame] | 149 | void CreateFakeAudioDevices( |
Artem Titov | 3faa832 | 2018-03-07 13:44:00 | [diff] [blame] | 150 | std::unique_ptr<TestAudioDeviceModule::Capturer> capturer, |
| 151 | std::unique_ptr<TestAudioDeviceModule::Renderer> renderer); |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 | [diff] [blame] | 152 | |
Stefan Holmer | 9fea80f | 2016-01-07 16:43:18 | [diff] [blame] | 153 | void CreateVideoStreams(); |
Sebastian Jansson | f33905d | 2018-07-13 07:49:00 | [diff] [blame] | 154 | void CreateVideoSendStreams(); |
| 155 | void CreateVideoSendStream(const VideoEncoderConfig& encoder_config); |
Stefan Holmer | 9fea80f | 2016-01-07 16:43:18 | [diff] [blame] | 156 | void CreateAudioStreams(); |
brandtr | 841de6a | 2016-11-15 15:10:52 | [diff] [blame] | 157 | void CreateFlexfecStreams(); |
eladalon | c0d481a | 2017-08-02 14:39:07 | [diff] [blame] | 158 | |
Sebastian Jansson | f33905d | 2018-07-13 07:49:00 | [diff] [blame] | 159 | void ConnectVideoSourcesToStreams(); |
| 160 | |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 | [diff] [blame] | 161 | void Start(); |
Sebastian Jansson | f33905d | 2018-07-13 07:49:00 | [diff] [blame] | 162 | void StartVideoStreams(); |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 | [diff] [blame] | 163 | void Stop(); |
Sebastian Jansson | 3bd2c79 | 2018-07-13 11:29:03 | [diff] [blame] | 164 | void StopVideoStreams(); |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 | [diff] [blame] | 165 | void DestroyStreams(); |
Sebastian Jansson | f33905d | 2018-07-13 07:49:00 | [diff] [blame] | 166 | void DestroyVideoSendStreams(); |
Per | ba7dc72 | 2016-04-19 13:01:23 | [diff] [blame] | 167 | void SetFakeVideoCaptureRotation(VideoRotation rotation); |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 | [diff] [blame] | 168 | |
Sebastian Jansson | f33905d | 2018-07-13 07:49:00 | [diff] [blame] | 169 | void SetVideoDegradation(DegradationPreference preference); |
| 170 | |
| 171 | VideoSendStream::Config* GetVideoSendConfig(); |
| 172 | void SetVideoSendConfig(const VideoSendStream::Config& config); |
| 173 | VideoEncoderConfig* GetVideoEncoderConfig(); |
| 174 | void SetVideoEncoderConfig(const VideoEncoderConfig& config); |
| 175 | VideoSendStream* GetVideoSendStream(); |
Sebastian Jansson | 3bd2c79 | 2018-07-13 11:29:03 | [diff] [blame] | 176 | FlexfecReceiveStream::Config* GetFlexFecConfig(); |
Danil Chapovalov | 1b66890 | 2019-11-13 10:19:53 | [diff] [blame] | 177 | TaskQueueBase* task_queue() { return task_queue_.get(); } |
Sebastian Jansson | f33905d | 2018-07-13 07:49:00 | [diff] [blame] | 178 | |
Tomas Gunnarsson | 8408c99 | 2021-02-14 13:19:12 | [diff] [blame] | 179 | // RtpPacketSinkInterface implementation. |
| 180 | void OnRtpPacket(const RtpPacketReceived& packet) override; |
| 181 | |
Tommi | 553c869 | 2020-05-05 13:35:45 | [diff] [blame] | 182 | test::RunLoop loop_; |
| 183 | |
pbos@webrtc.org | 2bb1bda | 2014-07-07 13:06:48 | [diff] [blame] | 184 | Clock* const clock_; |
Jonas Oreland | 8ca0613 | 2022-03-14 11:52:48 | [diff] [blame] | 185 | test::ScopedKeyValueConfig field_trials_; |
pbos@webrtc.org | 2bb1bda | 2014-07-07 13:06:48 | [diff] [blame] | 186 | |
Danil Chapovalov | a92e624 | 2019-04-18 08:58:56 | [diff] [blame] | 187 | std::unique_ptr<TaskQueueFactory> task_queue_factory_; |
Sebastian Jansson | 8e6602f | 2018-07-13 08:43:20 | [diff] [blame] | 188 | std::unique_ptr<webrtc::RtcEventLog> send_event_log_; |
| 189 | std::unique_ptr<webrtc::RtcEventLog> recv_event_log_; |
kwiberg | bfefb03 | 2016-05-01 21:53:46 | [diff] [blame] | 190 | std::unique_ptr<Call> sender_call_; |
| 191 | std::unique_ptr<PacketTransport> send_transport_; |
Sebastian Jansson | 3bd2c79 | 2018-07-13 11:29:03 | [diff] [blame] | 192 | std::vector<VideoSendStream::Config> video_send_configs_; |
| 193 | std::vector<VideoEncoderConfig> video_encoder_configs_; |
| 194 | std::vector<VideoSendStream*> video_send_streams_; |
Stefan Holmer | 9fea80f | 2016-01-07 16:43:18 | [diff] [blame] | 195 | AudioSendStream::Config audio_send_config_; |
| 196 | AudioSendStream* audio_send_stream_; |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 | [diff] [blame] | 197 | |
kwiberg | bfefb03 | 2016-05-01 21:53:46 | [diff] [blame] | 198 | std::unique_ptr<Call> receiver_call_; |
| 199 | std::unique_ptr<PacketTransport> receive_transport_; |
Tommi | f6f4543 | 2022-05-20 13:21:20 | [diff] [blame] | 200 | std::vector<VideoReceiveStreamInterface::Config> video_receive_configs_; |
| 201 | std::vector<VideoReceiveStreamInterface*> video_receive_streams_; |
Tommi | 3176ef7 | 2022-05-22 18:47:28 | [diff] [blame] | 202 | std::vector<AudioReceiveStreamInterface::Config> audio_receive_configs_; |
| 203 | std::vector<AudioReceiveStreamInterface*> audio_receive_streams_; |
brandtr | 841de6a | 2016-11-15 15:10:52 | [diff] [blame] | 204 | std::vector<FlexfecReceiveStream::Config> flexfec_receive_configs_; |
| 205 | std::vector<FlexfecReceiveStream*> flexfec_receive_streams_; |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 | [diff] [blame] | 206 | |
Sebastian Jansson | 3bd2c79 | 2018-07-13 11:29:03 | [diff] [blame] | 207 | test::FrameGeneratorCapturer* frame_generator_capturer_; |
Niels Möller | 1c931c4 | 2018-12-18 15:08:11 | [diff] [blame] | 208 | std::vector<std::unique_ptr<rtc::VideoSourceInterface<VideoFrame>>> |
| 209 | video_sources_; |
Sebastian Jansson | 3bd2c79 | 2018-07-13 11:29:03 | [diff] [blame] | 210 | DegradationPreference degradation_preference_ = |
| 211 | DegradationPreference::MAINTAIN_FRAMERATE; |
| 212 | |
| 213 | std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory_; |
Ying Wang | cab77fd | 2019-04-16 09:12:49 | [diff] [blame] | 214 | std::unique_ptr<NetworkStatePredictorFactoryInterface> |
| 215 | network_state_predictor_factory_; |
Sebastian Jansson | 1391ed2 | 2019-04-30 12:23:51 | [diff] [blame] | 216 | std::unique_ptr<NetworkControllerFactoryInterface> |
| 217 | network_controller_factory_; |
Sebastian Jansson | 3bd2c79 | 2018-07-13 11:29:03 | [diff] [blame] | 218 | |
Niels Möller | 4db138e | 2018-04-19 07:04:13 | [diff] [blame] | 219 | test::FunctionVideoEncoderFactory fake_encoder_factory_; |
| 220 | int fake_encoder_max_bitrate_ = -1; |
Niels Möller | cbcbc22 | 2018-09-28 07:07:24 | [diff] [blame] | 221 | test::FunctionVideoDecoderFactory fake_decoder_factory_; |
Jiawei Ou | c2ebe21 | 2018-11-08 18:02:56 | [diff] [blame] | 222 | std::unique_ptr<VideoBitrateAllocatorFactory> bitrate_allocator_factory_; |
Sebastian Jansson | 3bd2c79 | 2018-07-13 11:29:03 | [diff] [blame] | 223 | // Number of simulcast substreams. |
Stefan Holmer | 9fea80f | 2016-01-07 16:43:18 | [diff] [blame] | 224 | size_t num_video_streams_; |
| 225 | size_t num_audio_streams_; |
brandtr | 841de6a | 2016-11-15 15:10:52 | [diff] [blame] | 226 | size_t num_flexfec_streams_; |
Niels Möller | 2784a03 | 2018-03-28 12:16:04 | [diff] [blame] | 227 | rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory_; |
| 228 | rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory_; |
sakal | 55d932b | 2016-09-30 13:19:08 | [diff] [blame] | 229 | test::FakeVideoRenderer fake_renderer_; |
Stefan Holmer | 9fea80f | 2016-01-07 16:43:18 | [diff] [blame] | 230 | |
eladalon | 413ee9a | 2017-08-22 11:02:52 | [diff] [blame] | 231 | |
Stefan Holmer | 9fea80f | 2016-01-07 16:43:18 | [diff] [blame] | 232 | private: |
Elad Alon | d8d3248 | 2019-02-18 22:45:57 | [diff] [blame] | 233 | absl::optional<RtpExtension> GetRtpExtensionByUri( |
| 234 | const std::string& uri) const; |
| 235 | |
| 236 | void AddRtpExtensionByUri(const std::string& uri, |
| 237 | std::vector<RtpExtension>* extensions) const; |
| 238 | |
Danil Chapovalov | 1b66890 | 2019-11-13 10:19:53 | [diff] [blame] | 239 | std::unique_ptr<TaskQueueBase, TaskQueueDeleter> task_queue_; |
Elad Alon | d8d3248 | 2019-02-18 22:45:57 | [diff] [blame] | 240 | std::vector<RtpExtension> rtp_extensions_; |
peah | a9cc40b | 2017-06-29 15:32:09 | [diff] [blame] | 241 | rtc::scoped_refptr<AudioProcessing> apm_send_; |
| 242 | rtc::scoped_refptr<AudioProcessing> apm_recv_; |
Artem Titov | 3faa832 | 2018-03-07 13:44:00 | [diff] [blame] | 243 | rtc::scoped_refptr<TestAudioDeviceModule> fake_send_audio_device_; |
| 244 | rtc::scoped_refptr<TestAudioDeviceModule> fake_recv_audio_device_; |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 | [diff] [blame] | 245 | }; |
| 246 | |
| 247 | class BaseTest : public RtpRtcpObserver { |
| 248 | public: |
philipel | e828c96 | 2017-03-21 10:24:27 | [diff] [blame] | 249 | BaseTest(); |
Markus Handell | f4f2287 | 2022-08-16 11:02:45 | [diff] [blame] | 250 | explicit BaseTest(TimeDelta timeout); |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 | [diff] [blame] | 251 | virtual ~BaseTest(); |
| 252 | |
| 253 | virtual void PerformTest() = 0; |
| 254 | virtual bool ShouldCreateReceivers() const = 0; |
| 255 | |
Stefan Holmer | 9fea80f | 2016-01-07 16:43:18 | [diff] [blame] | 256 | virtual size_t GetNumVideoStreams() const; |
| 257 | virtual size_t GetNumAudioStreams() const; |
brandtr | 841de6a | 2016-11-15 15:10:52 | [diff] [blame] | 258 | virtual size_t GetNumFlexfecStreams() const; |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 | [diff] [blame] | 259 | |
Artem Titov | 3faa832 | 2018-03-07 13:44:00 | [diff] [blame] | 260 | virtual std::unique_ptr<TestAudioDeviceModule::Capturer> CreateCapturer(); |
| 261 | virtual std::unique_ptr<TestAudioDeviceModule::Renderer> CreateRenderer(); |
| 262 | virtual void OnFakeAudioDevicesCreated( |
| 263 | TestAudioDeviceModule* send_audio_device, |
| 264 | TestAudioDeviceModule* recv_audio_device); |
oprypin | 92220ff | 2017-03-23 10:40:03 | [diff] [blame] | 265 | |
Niels Möller | de8e6e6 | 2018-11-13 14:10:33 | [diff] [blame] | 266 | virtual void ModifySenderBitrateConfig(BitrateConstraints* bitrate_config); |
| 267 | virtual void ModifyReceiverBitrateConfig(BitrateConstraints* bitrate_config); |
Sebastian Jansson | 7258224 | 2018-07-13 11:19:42 | [diff] [blame] | 268 | |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 | [diff] [blame] | 269 | virtual void OnCallsCreated(Call* sender_call, Call* receiver_call); |
stefan | e74eef1 | 2016-01-08 14:47:13 | [diff] [blame] | 270 | |
Danil Chapovalov | 44db436 | 2019-09-30 02:16:28 | [diff] [blame] | 271 | virtual std::unique_ptr<test::PacketTransport> CreateSendTransport( |
| 272 | TaskQueueBase* task_queue, |
eladalon | 413ee9a | 2017-08-22 11:02:52 | [diff] [blame] | 273 | Call* sender_call); |
Danil Chapovalov | 44db436 | 2019-09-30 02:16:28 | [diff] [blame] | 274 | virtual std::unique_ptr<test::PacketTransport> CreateReceiveTransport( |
| 275 | TaskQueueBase* task_queue); |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 | [diff] [blame] | 276 | |
stefan | ff48361 | 2015-12-21 11:14:00 | [diff] [blame] | 277 | virtual void ModifyVideoConfigs( |
pbos@webrtc.org | be9d2a4 | 2014-06-30 13:19:09 | [diff] [blame] | 278 | VideoSendStream::Config* send_config, |
Tommi | f6f4543 | 2022-05-20 13:21:20 | [diff] [blame] | 279 | std::vector<VideoReceiveStreamInterface::Config>* receive_configs, |
pbos@webrtc.org | bbe0a85 | 2014-09-19 12:30:25 | [diff] [blame] | 280 | VideoEncoderConfig* encoder_config); |
perkj | fa10b55 | 2016-10-03 06:45:26 | [diff] [blame] | 281 | virtual void ModifyVideoCaptureStartResolution(int* width, |
| 282 | int* heigt, |
| 283 | int* frame_rate); |
Åsa Persson | cb7eddb | 2018-11-05 13:11:44 | [diff] [blame] | 284 | virtual void ModifyVideoDegradationPreference( |
| 285 | DegradationPreference* degradation_preference); |
| 286 | |
stefan | ff48361 | 2015-12-21 11:14:00 | [diff] [blame] | 287 | virtual void OnVideoStreamsCreated( |
pbos@webrtc.org | be9d2a4 | 2014-06-30 13:19:09 | [diff] [blame] | 288 | VideoSendStream* send_stream, |
Tommi | f6f4543 | 2022-05-20 13:21:20 | [diff] [blame] | 289 | const std::vector<VideoReceiveStreamInterface*>& receive_streams); |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 | [diff] [blame] | 290 | |
Stefan Holmer | 9fea80f | 2016-01-07 16:43:18 | [diff] [blame] | 291 | virtual void ModifyAudioConfigs( |
| 292 | AudioSendStream::Config* send_config, |
Tommi | 3176ef7 | 2022-05-22 18:47:28 | [diff] [blame] | 293 | std::vector<AudioReceiveStreamInterface::Config>* receive_configs); |
Stefan Holmer | 9fea80f | 2016-01-07 16:43:18 | [diff] [blame] | 294 | virtual void OnAudioStreamsCreated( |
| 295 | AudioSendStream* send_stream, |
Tommi | 3176ef7 | 2022-05-22 18:47:28 | [diff] [blame] | 296 | const std::vector<AudioReceiveStreamInterface*>& receive_streams); |
Stefan Holmer | 9fea80f | 2016-01-07 16:43:18 | [diff] [blame] | 297 | |
brandtr | 841de6a | 2016-11-15 15:10:52 | [diff] [blame] | 298 | virtual void ModifyFlexfecConfigs( |
| 299 | std::vector<FlexfecReceiveStream::Config>* receive_configs); |
| 300 | virtual void OnFlexfecStreamsCreated( |
| 301 | const std::vector<FlexfecReceiveStream*>& receive_streams); |
| 302 | |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 | [diff] [blame] | 303 | virtual void OnFrameGeneratorCapturerCreated( |
| 304 | FrameGeneratorCapturer* frame_generator_capturer); |
skvlad | 11a9cbf | 2016-10-07 18:53:05 | [diff] [blame] | 305 | |
Fredrik Solenberg | 73276ad | 2017-09-14 12:46:47 | [diff] [blame] | 306 | virtual void OnStreamsStopped(); |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 | [diff] [blame] | 307 | }; |
| 308 | |
| 309 | class SendTest : public BaseTest { |
| 310 | public: |
Markus Handell | f4f2287 | 2022-08-16 11:02:45 | [diff] [blame] | 311 | explicit SendTest(TimeDelta timeout); |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 | [diff] [blame] | 312 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 | [diff] [blame] | 313 | bool ShouldCreateReceivers() const override; |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 | [diff] [blame] | 314 | }; |
| 315 | |
| 316 | class EndToEndTest : public BaseTest { |
| 317 | public: |
philipel | e828c96 | 2017-03-21 10:24:27 | [diff] [blame] | 318 | EndToEndTest(); |
Markus Handell | f4f2287 | 2022-08-16 11:02:45 | [diff] [blame] | 319 | explicit EndToEndTest(TimeDelta timeout); |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 | [diff] [blame] | 320 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 | [diff] [blame] | 321 | bool ShouldCreateReceivers() const override; |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 | [diff] [blame] | 322 | }; |
| 323 | |
| 324 | } // namespace test |
| 325 | } // namespace webrtc |
| 326 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 327 | #endif // TEST_CALL_TEST_H_ |