xref: /aosp_15_r20/external/webrtc/test/call_test.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1*d9f75844SAndroid Build Coastguard Worker /*
2*d9f75844SAndroid Build Coastguard Worker  *  Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3*d9f75844SAndroid Build Coastguard Worker  *
4*d9f75844SAndroid Build Coastguard Worker  *  Use of this source code is governed by a BSD-style license
5*d9f75844SAndroid Build Coastguard Worker  *  that can be found in the LICENSE file in the root of the source
6*d9f75844SAndroid Build Coastguard Worker  *  tree. An additional intellectual property rights grant can be found
7*d9f75844SAndroid Build Coastguard Worker  *  in the file PATENTS.  All contributing project authors may
8*d9f75844SAndroid Build Coastguard Worker  *  be found in the AUTHORS file in the root of the source tree.
9*d9f75844SAndroid Build Coastguard Worker  */
10*d9f75844SAndroid Build Coastguard Worker #ifndef TEST_CALL_TEST_H_
11*d9f75844SAndroid Build Coastguard Worker #define TEST_CALL_TEST_H_
12*d9f75844SAndroid Build Coastguard Worker 
13*d9f75844SAndroid Build Coastguard Worker #include <map>
14*d9f75844SAndroid Build Coastguard Worker #include <memory>
15*d9f75844SAndroid Build Coastguard Worker #include <string>
16*d9f75844SAndroid Build Coastguard Worker #include <vector>
17*d9f75844SAndroid Build Coastguard Worker 
18*d9f75844SAndroid Build Coastguard Worker #include "absl/types/optional.h"
19*d9f75844SAndroid Build Coastguard Worker #include "api/rtc_event_log/rtc_event_log.h"
20*d9f75844SAndroid Build Coastguard Worker #include "api/task_queue/task_queue_base.h"
21*d9f75844SAndroid Build Coastguard Worker #include "api/task_queue/task_queue_factory.h"
22*d9f75844SAndroid Build Coastguard Worker #include "api/test/video/function_video_decoder_factory.h"
23*d9f75844SAndroid Build Coastguard Worker #include "api/test/video/function_video_encoder_factory.h"
24*d9f75844SAndroid Build Coastguard Worker #include "api/units/time_delta.h"
25*d9f75844SAndroid Build Coastguard Worker #include "api/video/video_bitrate_allocator_factory.h"
26*d9f75844SAndroid Build Coastguard Worker #include "call/call.h"
27*d9f75844SAndroid Build Coastguard Worker #include "modules/audio_device/include/test_audio_device.h"
28*d9f75844SAndroid Build Coastguard Worker #include "test/encoder_settings.h"
29*d9f75844SAndroid Build Coastguard Worker #include "test/fake_decoder.h"
30*d9f75844SAndroid Build Coastguard Worker #include "test/fake_videorenderer.h"
31*d9f75844SAndroid Build Coastguard Worker #include "test/fake_vp8_encoder.h"
32*d9f75844SAndroid Build Coastguard Worker #include "test/frame_generator_capturer.h"
33*d9f75844SAndroid Build Coastguard Worker #include "test/rtp_rtcp_observer.h"
34*d9f75844SAndroid Build Coastguard Worker #include "test/run_loop.h"
35*d9f75844SAndroid Build Coastguard Worker #include "test/scoped_key_value_config.h"
36*d9f75844SAndroid Build Coastguard Worker 
37*d9f75844SAndroid Build Coastguard Worker namespace webrtc {
38*d9f75844SAndroid Build Coastguard Worker namespace test {
39*d9f75844SAndroid Build Coastguard Worker 
40*d9f75844SAndroid Build Coastguard Worker class BaseTest;
41*d9f75844SAndroid Build Coastguard Worker 
42*d9f75844SAndroid Build Coastguard Worker class CallTest : public ::testing::Test, public RtpPacketSinkInterface {
43*d9f75844SAndroid Build Coastguard Worker  public:
44*d9f75844SAndroid Build Coastguard Worker   CallTest();
45*d9f75844SAndroid Build Coastguard Worker   virtual ~CallTest();
46*d9f75844SAndroid Build Coastguard Worker 
47*d9f75844SAndroid Build Coastguard Worker   static constexpr size_t kNumSsrcs = 6;
48*d9f75844SAndroid Build Coastguard Worker   static const int kNumSimulcastStreams = 3;
49*d9f75844SAndroid Build Coastguard Worker   static const int kDefaultWidth = 320;
50*d9f75844SAndroid Build Coastguard Worker   static const int kDefaultHeight = 180;
51*d9f75844SAndroid Build Coastguard Worker   static const int kDefaultFramerate = 30;
52*d9f75844SAndroid Build Coastguard Worker   static constexpr TimeDelta kDefaultTimeout = TimeDelta::Seconds(30);
53*d9f75844SAndroid Build Coastguard Worker   static constexpr TimeDelta kLongTimeout = TimeDelta::Seconds(120);
54*d9f75844SAndroid Build Coastguard Worker   enum classPayloadTypes : uint8_t {
55*d9f75844SAndroid Build Coastguard Worker     kSendRtxPayloadType = 98,
56*d9f75844SAndroid Build Coastguard Worker     kRtxRedPayloadType = 99,
57*d9f75844SAndroid Build Coastguard Worker     kVideoSendPayloadType = 100,
58*d9f75844SAndroid Build Coastguard Worker     kAudioSendPayloadType = 103,
59*d9f75844SAndroid Build Coastguard Worker     kRedPayloadType = 118,
60*d9f75844SAndroid Build Coastguard Worker     kUlpfecPayloadType = 119,
61*d9f75844SAndroid Build Coastguard Worker     kFlexfecPayloadType = 120,
62*d9f75844SAndroid Build Coastguard Worker     kPayloadTypeH264 = 122,
63*d9f75844SAndroid Build Coastguard Worker     kPayloadTypeVP8 = 123,
64*d9f75844SAndroid Build Coastguard Worker     kPayloadTypeVP9 = 124,
65*d9f75844SAndroid Build Coastguard Worker     kPayloadTypeGeneric = 125,
66*d9f75844SAndroid Build Coastguard Worker     kFakeVideoSendPayloadType = 126,
67*d9f75844SAndroid Build Coastguard Worker   };
68*d9f75844SAndroid Build Coastguard Worker   static const uint32_t kSendRtxSsrcs[kNumSsrcs];
69*d9f75844SAndroid Build Coastguard Worker   static const uint32_t kVideoSendSsrcs[kNumSsrcs];
70*d9f75844SAndroid Build Coastguard Worker   static const uint32_t kAudioSendSsrc;
71*d9f75844SAndroid Build Coastguard Worker   static const uint32_t kFlexfecSendSsrc;
72*d9f75844SAndroid Build Coastguard Worker   static const uint32_t kReceiverLocalVideoSsrc;
73*d9f75844SAndroid Build Coastguard Worker   static const uint32_t kReceiverLocalAudioSsrc;
74*d9f75844SAndroid Build Coastguard Worker   static const int kNackRtpHistoryMs;
75*d9f75844SAndroid Build Coastguard Worker   static const std::map<uint8_t, MediaType> payload_type_map_;
76*d9f75844SAndroid Build Coastguard Worker 
77*d9f75844SAndroid Build Coastguard Worker  protected:
78*d9f75844SAndroid Build Coastguard Worker   void RegisterRtpExtension(const RtpExtension& extension);
79*d9f75844SAndroid Build Coastguard Worker 
80*d9f75844SAndroid Build Coastguard Worker   // RunBaseTest overwrites the audio_state of the send and receive Call configs
81*d9f75844SAndroid Build Coastguard Worker   // to simplify test code.
82*d9f75844SAndroid Build Coastguard Worker   void RunBaseTest(BaseTest* test);
83*d9f75844SAndroid Build Coastguard Worker 
84*d9f75844SAndroid Build Coastguard Worker   void CreateCalls();
85*d9f75844SAndroid Build Coastguard Worker   void CreateCalls(const Call::Config& sender_config,
86*d9f75844SAndroid Build Coastguard Worker                    const Call::Config& receiver_config);
87*d9f75844SAndroid Build Coastguard Worker   void CreateSenderCall();
88*d9f75844SAndroid Build Coastguard Worker   void CreateSenderCall(const Call::Config& config);
89*d9f75844SAndroid Build Coastguard Worker   void CreateReceiverCall(const Call::Config& config);
90*d9f75844SAndroid Build Coastguard Worker   void DestroyCalls();
91*d9f75844SAndroid Build Coastguard Worker 
92*d9f75844SAndroid Build Coastguard Worker   void CreateVideoSendConfig(VideoSendStream::Config* video_config,
93*d9f75844SAndroid Build Coastguard Worker                              size_t num_video_streams,
94*d9f75844SAndroid Build Coastguard Worker                              size_t num_used_ssrcs,
95*d9f75844SAndroid Build Coastguard Worker                              Transport* send_transport);
96*d9f75844SAndroid Build Coastguard Worker   void CreateAudioAndFecSendConfigs(size_t num_audio_streams,
97*d9f75844SAndroid Build Coastguard Worker                                     size_t num_flexfec_streams,
98*d9f75844SAndroid Build Coastguard Worker                                     Transport* send_transport);
99*d9f75844SAndroid Build Coastguard Worker   void SetAudioConfig(const AudioSendStream::Config& config);
100*d9f75844SAndroid Build Coastguard Worker 
101*d9f75844SAndroid Build Coastguard Worker   void SetSendFecConfig(std::vector<uint32_t> video_send_ssrcs);
102*d9f75844SAndroid Build Coastguard Worker   void SetSendUlpFecConfig(VideoSendStream::Config* send_config);
103*d9f75844SAndroid Build Coastguard Worker   void SetReceiveUlpFecConfig(
104*d9f75844SAndroid Build Coastguard Worker       VideoReceiveStreamInterface::Config* receive_config);
105*d9f75844SAndroid Build Coastguard Worker   void CreateSendConfig(size_t num_video_streams,
106*d9f75844SAndroid Build Coastguard Worker                         size_t num_audio_streams,
107*d9f75844SAndroid Build Coastguard Worker                         size_t num_flexfec_streams,
108*d9f75844SAndroid Build Coastguard Worker                         Transport* send_transport);
109*d9f75844SAndroid Build Coastguard Worker 
110*d9f75844SAndroid Build Coastguard Worker   void CreateMatchingVideoReceiveConfigs(
111*d9f75844SAndroid Build Coastguard Worker       const VideoSendStream::Config& video_send_config,
112*d9f75844SAndroid Build Coastguard Worker       Transport* rtcp_send_transport);
113*d9f75844SAndroid Build Coastguard Worker   void CreateMatchingVideoReceiveConfigs(
114*d9f75844SAndroid Build Coastguard Worker       const VideoSendStream::Config& video_send_config,
115*d9f75844SAndroid Build Coastguard Worker       Transport* rtcp_send_transport,
116*d9f75844SAndroid Build Coastguard Worker       bool send_side_bwe,
117*d9f75844SAndroid Build Coastguard Worker       VideoDecoderFactory* decoder_factory,
118*d9f75844SAndroid Build Coastguard Worker       absl::optional<size_t> decode_sub_stream,
119*d9f75844SAndroid Build Coastguard Worker       bool receiver_reference_time_report,
120*d9f75844SAndroid Build Coastguard Worker       int rtp_history_ms);
121*d9f75844SAndroid Build Coastguard Worker   void AddMatchingVideoReceiveConfigs(
122*d9f75844SAndroid Build Coastguard Worker       std::vector<VideoReceiveStreamInterface::Config>* receive_configs,
123*d9f75844SAndroid Build Coastguard Worker       const VideoSendStream::Config& video_send_config,
124*d9f75844SAndroid Build Coastguard Worker       Transport* rtcp_send_transport,
125*d9f75844SAndroid Build Coastguard Worker       bool send_side_bwe,
126*d9f75844SAndroid Build Coastguard Worker       VideoDecoderFactory* decoder_factory,
127*d9f75844SAndroid Build Coastguard Worker       absl::optional<size_t> decode_sub_stream,
128*d9f75844SAndroid Build Coastguard Worker       bool receiver_reference_time_report,
129*d9f75844SAndroid Build Coastguard Worker       int rtp_history_ms);
130*d9f75844SAndroid Build Coastguard Worker 
131*d9f75844SAndroid Build Coastguard Worker   void CreateMatchingAudioAndFecConfigs(Transport* rtcp_send_transport);
132*d9f75844SAndroid Build Coastguard Worker   void CreateMatchingAudioConfigs(Transport* transport, std::string sync_group);
133*d9f75844SAndroid Build Coastguard Worker   static AudioReceiveStreamInterface::Config CreateMatchingAudioConfig(
134*d9f75844SAndroid Build Coastguard Worker       const AudioSendStream::Config& send_config,
135*d9f75844SAndroid Build Coastguard Worker       rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
136*d9f75844SAndroid Build Coastguard Worker       Transport* transport,
137*d9f75844SAndroid Build Coastguard Worker       std::string sync_group);
138*d9f75844SAndroid Build Coastguard Worker   void CreateMatchingFecConfig(
139*d9f75844SAndroid Build Coastguard Worker       Transport* transport,
140*d9f75844SAndroid Build Coastguard Worker       const VideoSendStream::Config& video_send_config);
141*d9f75844SAndroid Build Coastguard Worker   void CreateMatchingReceiveConfigs(Transport* rtcp_send_transport);
142*d9f75844SAndroid Build Coastguard Worker 
143*d9f75844SAndroid Build Coastguard Worker   void CreateFrameGeneratorCapturerWithDrift(Clock* drift_clock,
144*d9f75844SAndroid Build Coastguard Worker                                              float speed,
145*d9f75844SAndroid Build Coastguard Worker                                              int framerate,
146*d9f75844SAndroid Build Coastguard Worker                                              int width,
147*d9f75844SAndroid Build Coastguard Worker                                              int height);
148*d9f75844SAndroid Build Coastguard Worker   void CreateFrameGeneratorCapturer(int framerate, int width, int height);
149*d9f75844SAndroid Build Coastguard Worker   void CreateFakeAudioDevices(
150*d9f75844SAndroid Build Coastguard Worker       std::unique_ptr<TestAudioDeviceModule::Capturer> capturer,
151*d9f75844SAndroid Build Coastguard Worker       std::unique_ptr<TestAudioDeviceModule::Renderer> renderer);
152*d9f75844SAndroid Build Coastguard Worker 
153*d9f75844SAndroid Build Coastguard Worker   void CreateVideoStreams();
154*d9f75844SAndroid Build Coastguard Worker   void CreateVideoSendStreams();
155*d9f75844SAndroid Build Coastguard Worker   void CreateVideoSendStream(const VideoEncoderConfig& encoder_config);
156*d9f75844SAndroid Build Coastguard Worker   void CreateAudioStreams();
157*d9f75844SAndroid Build Coastguard Worker   void CreateFlexfecStreams();
158*d9f75844SAndroid Build Coastguard Worker 
159*d9f75844SAndroid Build Coastguard Worker   void ConnectVideoSourcesToStreams();
160*d9f75844SAndroid Build Coastguard Worker 
161*d9f75844SAndroid Build Coastguard Worker   void Start();
162*d9f75844SAndroid Build Coastguard Worker   void StartVideoStreams();
163*d9f75844SAndroid Build Coastguard Worker   void Stop();
164*d9f75844SAndroid Build Coastguard Worker   void StopVideoStreams();
165*d9f75844SAndroid Build Coastguard Worker   void DestroyStreams();
166*d9f75844SAndroid Build Coastguard Worker   void DestroyVideoSendStreams();
167*d9f75844SAndroid Build Coastguard Worker   void SetFakeVideoCaptureRotation(VideoRotation rotation);
168*d9f75844SAndroid Build Coastguard Worker 
169*d9f75844SAndroid Build Coastguard Worker   void SetVideoDegradation(DegradationPreference preference);
170*d9f75844SAndroid Build Coastguard Worker 
171*d9f75844SAndroid Build Coastguard Worker   VideoSendStream::Config* GetVideoSendConfig();
172*d9f75844SAndroid Build Coastguard Worker   void SetVideoSendConfig(const VideoSendStream::Config& config);
173*d9f75844SAndroid Build Coastguard Worker   VideoEncoderConfig* GetVideoEncoderConfig();
174*d9f75844SAndroid Build Coastguard Worker   void SetVideoEncoderConfig(const VideoEncoderConfig& config);
175*d9f75844SAndroid Build Coastguard Worker   VideoSendStream* GetVideoSendStream();
176*d9f75844SAndroid Build Coastguard Worker   FlexfecReceiveStream::Config* GetFlexFecConfig();
task_queue()177*d9f75844SAndroid Build Coastguard Worker   TaskQueueBase* task_queue() { return task_queue_.get(); }
178*d9f75844SAndroid Build Coastguard Worker 
179*d9f75844SAndroid Build Coastguard Worker   // RtpPacketSinkInterface implementation.
180*d9f75844SAndroid Build Coastguard Worker   void OnRtpPacket(const RtpPacketReceived& packet) override;
181*d9f75844SAndroid Build Coastguard Worker 
182*d9f75844SAndroid Build Coastguard Worker   test::RunLoop loop_;
183*d9f75844SAndroid Build Coastguard Worker 
184*d9f75844SAndroid Build Coastguard Worker   Clock* const clock_;
185*d9f75844SAndroid Build Coastguard Worker   test::ScopedKeyValueConfig field_trials_;
186*d9f75844SAndroid Build Coastguard Worker 
187*d9f75844SAndroid Build Coastguard Worker   std::unique_ptr<TaskQueueFactory> task_queue_factory_;
188*d9f75844SAndroid Build Coastguard Worker   std::unique_ptr<webrtc::RtcEventLog> send_event_log_;
189*d9f75844SAndroid Build Coastguard Worker   std::unique_ptr<webrtc::RtcEventLog> recv_event_log_;
190*d9f75844SAndroid Build Coastguard Worker   std::unique_ptr<Call> sender_call_;
191*d9f75844SAndroid Build Coastguard Worker   std::unique_ptr<PacketTransport> send_transport_;
192*d9f75844SAndroid Build Coastguard Worker   std::vector<VideoSendStream::Config> video_send_configs_;
193*d9f75844SAndroid Build Coastguard Worker   std::vector<VideoEncoderConfig> video_encoder_configs_;
194*d9f75844SAndroid Build Coastguard Worker   std::vector<VideoSendStream*> video_send_streams_;
195*d9f75844SAndroid Build Coastguard Worker   AudioSendStream::Config audio_send_config_;
196*d9f75844SAndroid Build Coastguard Worker   AudioSendStream* audio_send_stream_;
197*d9f75844SAndroid Build Coastguard Worker 
198*d9f75844SAndroid Build Coastguard Worker   std::unique_ptr<Call> receiver_call_;
199*d9f75844SAndroid Build Coastguard Worker   std::unique_ptr<PacketTransport> receive_transport_;
200*d9f75844SAndroid Build Coastguard Worker   std::vector<VideoReceiveStreamInterface::Config> video_receive_configs_;
201*d9f75844SAndroid Build Coastguard Worker   std::vector<VideoReceiveStreamInterface*> video_receive_streams_;
202*d9f75844SAndroid Build Coastguard Worker   std::vector<AudioReceiveStreamInterface::Config> audio_receive_configs_;
203*d9f75844SAndroid Build Coastguard Worker   std::vector<AudioReceiveStreamInterface*> audio_receive_streams_;
204*d9f75844SAndroid Build Coastguard Worker   std::vector<FlexfecReceiveStream::Config> flexfec_receive_configs_;
205*d9f75844SAndroid Build Coastguard Worker   std::vector<FlexfecReceiveStream*> flexfec_receive_streams_;
206*d9f75844SAndroid Build Coastguard Worker 
207*d9f75844SAndroid Build Coastguard Worker   test::FrameGeneratorCapturer* frame_generator_capturer_;
208*d9f75844SAndroid Build Coastguard Worker   std::vector<std::unique_ptr<rtc::VideoSourceInterface<VideoFrame>>>
209*d9f75844SAndroid Build Coastguard Worker       video_sources_;
210*d9f75844SAndroid Build Coastguard Worker   DegradationPreference degradation_preference_ =
211*d9f75844SAndroid Build Coastguard Worker       DegradationPreference::MAINTAIN_FRAMERATE;
212*d9f75844SAndroid Build Coastguard Worker 
213*d9f75844SAndroid Build Coastguard Worker   std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory_;
214*d9f75844SAndroid Build Coastguard Worker   std::unique_ptr<NetworkStatePredictorFactoryInterface>
215*d9f75844SAndroid Build Coastguard Worker       network_state_predictor_factory_;
216*d9f75844SAndroid Build Coastguard Worker   std::unique_ptr<NetworkControllerFactoryInterface>
217*d9f75844SAndroid Build Coastguard Worker       network_controller_factory_;
218*d9f75844SAndroid Build Coastguard Worker 
219*d9f75844SAndroid Build Coastguard Worker   test::FunctionVideoEncoderFactory fake_encoder_factory_;
220*d9f75844SAndroid Build Coastguard Worker   int fake_encoder_max_bitrate_ = -1;
221*d9f75844SAndroid Build Coastguard Worker   test::FunctionVideoDecoderFactory fake_decoder_factory_;
222*d9f75844SAndroid Build Coastguard Worker   std::unique_ptr<VideoBitrateAllocatorFactory> bitrate_allocator_factory_;
223*d9f75844SAndroid Build Coastguard Worker   // Number of simulcast substreams.
224*d9f75844SAndroid Build Coastguard Worker   size_t num_video_streams_;
225*d9f75844SAndroid Build Coastguard Worker   size_t num_audio_streams_;
226*d9f75844SAndroid Build Coastguard Worker   size_t num_flexfec_streams_;
227*d9f75844SAndroid Build Coastguard Worker   rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory_;
228*d9f75844SAndroid Build Coastguard Worker   rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory_;
229*d9f75844SAndroid Build Coastguard Worker   test::FakeVideoRenderer fake_renderer_;
230*d9f75844SAndroid Build Coastguard Worker 
231*d9f75844SAndroid Build Coastguard Worker 
232*d9f75844SAndroid Build Coastguard Worker  private:
233*d9f75844SAndroid Build Coastguard Worker   absl::optional<RtpExtension> GetRtpExtensionByUri(
234*d9f75844SAndroid Build Coastguard Worker       const std::string& uri) const;
235*d9f75844SAndroid Build Coastguard Worker 
236*d9f75844SAndroid Build Coastguard Worker   void AddRtpExtensionByUri(const std::string& uri,
237*d9f75844SAndroid Build Coastguard Worker                             std::vector<RtpExtension>* extensions) const;
238*d9f75844SAndroid Build Coastguard Worker 
239*d9f75844SAndroid Build Coastguard Worker   std::unique_ptr<TaskQueueBase, TaskQueueDeleter> task_queue_;
240*d9f75844SAndroid Build Coastguard Worker   std::vector<RtpExtension> rtp_extensions_;
241*d9f75844SAndroid Build Coastguard Worker   rtc::scoped_refptr<AudioProcessing> apm_send_;
242*d9f75844SAndroid Build Coastguard Worker   rtc::scoped_refptr<AudioProcessing> apm_recv_;
243*d9f75844SAndroid Build Coastguard Worker   rtc::scoped_refptr<TestAudioDeviceModule> fake_send_audio_device_;
244*d9f75844SAndroid Build Coastguard Worker   rtc::scoped_refptr<TestAudioDeviceModule> fake_recv_audio_device_;
245*d9f75844SAndroid Build Coastguard Worker };
246*d9f75844SAndroid Build Coastguard Worker 
247*d9f75844SAndroid Build Coastguard Worker class BaseTest : public RtpRtcpObserver {
248*d9f75844SAndroid Build Coastguard Worker  public:
249*d9f75844SAndroid Build Coastguard Worker   BaseTest();
250*d9f75844SAndroid Build Coastguard Worker   explicit BaseTest(TimeDelta timeout);
251*d9f75844SAndroid Build Coastguard Worker   virtual ~BaseTest();
252*d9f75844SAndroid Build Coastguard Worker 
253*d9f75844SAndroid Build Coastguard Worker   virtual void PerformTest() = 0;
254*d9f75844SAndroid Build Coastguard Worker   virtual bool ShouldCreateReceivers() const = 0;
255*d9f75844SAndroid Build Coastguard Worker 
256*d9f75844SAndroid Build Coastguard Worker   virtual size_t GetNumVideoStreams() const;
257*d9f75844SAndroid Build Coastguard Worker   virtual size_t GetNumAudioStreams() const;
258*d9f75844SAndroid Build Coastguard Worker   virtual size_t GetNumFlexfecStreams() const;
259*d9f75844SAndroid Build Coastguard Worker 
260*d9f75844SAndroid Build Coastguard Worker   virtual std::unique_ptr<TestAudioDeviceModule::Capturer> CreateCapturer();
261*d9f75844SAndroid Build Coastguard Worker   virtual std::unique_ptr<TestAudioDeviceModule::Renderer> CreateRenderer();
262*d9f75844SAndroid Build Coastguard Worker   virtual void OnFakeAudioDevicesCreated(
263*d9f75844SAndroid Build Coastguard Worker       TestAudioDeviceModule* send_audio_device,
264*d9f75844SAndroid Build Coastguard Worker       TestAudioDeviceModule* recv_audio_device);
265*d9f75844SAndroid Build Coastguard Worker 
266*d9f75844SAndroid Build Coastguard Worker   virtual void ModifySenderBitrateConfig(BitrateConstraints* bitrate_config);
267*d9f75844SAndroid Build Coastguard Worker   virtual void ModifyReceiverBitrateConfig(BitrateConstraints* bitrate_config);
268*d9f75844SAndroid Build Coastguard Worker 
269*d9f75844SAndroid Build Coastguard Worker   virtual void OnCallsCreated(Call* sender_call, Call* receiver_call);
270*d9f75844SAndroid Build Coastguard Worker 
271*d9f75844SAndroid Build Coastguard Worker   virtual std::unique_ptr<test::PacketTransport> CreateSendTransport(
272*d9f75844SAndroid Build Coastguard Worker       TaskQueueBase* task_queue,
273*d9f75844SAndroid Build Coastguard Worker       Call* sender_call);
274*d9f75844SAndroid Build Coastguard Worker   virtual std::unique_ptr<test::PacketTransport> CreateReceiveTransport(
275*d9f75844SAndroid Build Coastguard Worker       TaskQueueBase* task_queue);
276*d9f75844SAndroid Build Coastguard Worker 
277*d9f75844SAndroid Build Coastguard Worker   virtual void ModifyVideoConfigs(
278*d9f75844SAndroid Build Coastguard Worker       VideoSendStream::Config* send_config,
279*d9f75844SAndroid Build Coastguard Worker       std::vector<VideoReceiveStreamInterface::Config>* receive_configs,
280*d9f75844SAndroid Build Coastguard Worker       VideoEncoderConfig* encoder_config);
281*d9f75844SAndroid Build Coastguard Worker   virtual void ModifyVideoCaptureStartResolution(int* width,
282*d9f75844SAndroid Build Coastguard Worker                                                  int* heigt,
283*d9f75844SAndroid Build Coastguard Worker                                                  int* frame_rate);
284*d9f75844SAndroid Build Coastguard Worker   virtual void ModifyVideoDegradationPreference(
285*d9f75844SAndroid Build Coastguard Worker       DegradationPreference* degradation_preference);
286*d9f75844SAndroid Build Coastguard Worker 
287*d9f75844SAndroid Build Coastguard Worker   virtual void OnVideoStreamsCreated(
288*d9f75844SAndroid Build Coastguard Worker       VideoSendStream* send_stream,
289*d9f75844SAndroid Build Coastguard Worker       const std::vector<VideoReceiveStreamInterface*>& receive_streams);
290*d9f75844SAndroid Build Coastguard Worker 
291*d9f75844SAndroid Build Coastguard Worker   virtual void ModifyAudioConfigs(
292*d9f75844SAndroid Build Coastguard Worker       AudioSendStream::Config* send_config,
293*d9f75844SAndroid Build Coastguard Worker       std::vector<AudioReceiveStreamInterface::Config>* receive_configs);
294*d9f75844SAndroid Build Coastguard Worker   virtual void OnAudioStreamsCreated(
295*d9f75844SAndroid Build Coastguard Worker       AudioSendStream* send_stream,
296*d9f75844SAndroid Build Coastguard Worker       const std::vector<AudioReceiveStreamInterface*>& receive_streams);
297*d9f75844SAndroid Build Coastguard Worker 
298*d9f75844SAndroid Build Coastguard Worker   virtual void ModifyFlexfecConfigs(
299*d9f75844SAndroid Build Coastguard Worker       std::vector<FlexfecReceiveStream::Config>* receive_configs);
300*d9f75844SAndroid Build Coastguard Worker   virtual void OnFlexfecStreamsCreated(
301*d9f75844SAndroid Build Coastguard Worker       const std::vector<FlexfecReceiveStream*>& receive_streams);
302*d9f75844SAndroid Build Coastguard Worker 
303*d9f75844SAndroid Build Coastguard Worker   virtual void OnFrameGeneratorCapturerCreated(
304*d9f75844SAndroid Build Coastguard Worker       FrameGeneratorCapturer* frame_generator_capturer);
305*d9f75844SAndroid Build Coastguard Worker 
306*d9f75844SAndroid Build Coastguard Worker   virtual void OnStreamsStopped();
307*d9f75844SAndroid Build Coastguard Worker };
308*d9f75844SAndroid Build Coastguard Worker 
309*d9f75844SAndroid Build Coastguard Worker class SendTest : public BaseTest {
310*d9f75844SAndroid Build Coastguard Worker  public:
311*d9f75844SAndroid Build Coastguard Worker   explicit SendTest(TimeDelta timeout);
312*d9f75844SAndroid Build Coastguard Worker 
313*d9f75844SAndroid Build Coastguard Worker   bool ShouldCreateReceivers() const override;
314*d9f75844SAndroid Build Coastguard Worker };
315*d9f75844SAndroid Build Coastguard Worker 
316*d9f75844SAndroid Build Coastguard Worker class EndToEndTest : public BaseTest {
317*d9f75844SAndroid Build Coastguard Worker  public:
318*d9f75844SAndroid Build Coastguard Worker   EndToEndTest();
319*d9f75844SAndroid Build Coastguard Worker   explicit EndToEndTest(TimeDelta timeout);
320*d9f75844SAndroid Build Coastguard Worker 
321*d9f75844SAndroid Build Coastguard Worker   bool ShouldCreateReceivers() const override;
322*d9f75844SAndroid Build Coastguard Worker };
323*d9f75844SAndroid Build Coastguard Worker 
324*d9f75844SAndroid Build Coastguard Worker }  // namespace test
325*d9f75844SAndroid Build Coastguard Worker }  // namespace webrtc
326*d9f75844SAndroid Build Coastguard Worker 
327*d9f75844SAndroid Build Coastguard Worker #endif  // TEST_CALL_TEST_H_
328