1 /*
2  *  Copyright 2018 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 
11 #ifndef VIDEO_END_TO_END_TESTS_MULTI_STREAM_TESTER_H_
12 #define VIDEO_END_TO_END_TESTS_MULTI_STREAM_TESTER_H_
13 
14 #include <map>
15 #include <memory>
16 
17 #include "api/task_queue/task_queue_base.h"
18 #include "call/call.h"
19 #include "test/direct_transport.h"
20 #include "test/frame_generator_capturer.h"
21 
22 namespace webrtc {
23 // Test sets up a Call multiple senders with different resolutions and SSRCs.
24 // Another is set up to receive all three of these with different renderers.
25 class MultiStreamTester {
26  public:
27   static constexpr size_t kNumStreams = 3;
28   const uint8_t kVideoPayloadType = 124;
29   const std::map<uint8_t, MediaType> payload_type_map_ = {
30       {kVideoPayloadType, MediaType::VIDEO}};
31 
32   struct CodecSettings {
33     uint32_t ssrc;
34     int width;
35     int height;
36   } codec_settings[kNumStreams];
37 
38   MultiStreamTester();
39 
40   virtual ~MultiStreamTester();
41 
42   void RunTest();
43 
44  protected:
45   virtual void Wait() = 0;
46   // Note: frame_generator is a point-to-pointer, since the actual instance
47   // hasn't been created at the time of this call. Only when packets/frames
48   // start flowing should this be dereferenced.
49   virtual void UpdateSendConfig(size_t stream_index,
50                                 VideoSendStream::Config* send_config,
51                                 VideoEncoderConfig* encoder_config,
52                                 test::FrameGeneratorCapturer** frame_generator);
53   virtual void UpdateReceiveConfig(size_t stream_index,
54                                    VideoReceiveStream::Config* receive_config);
55   virtual std::unique_ptr<test::DirectTransport> CreateSendTransport(
56       TaskQueueBase* task_queue,
57       Call* sender_call);
58   virtual std::unique_ptr<test::DirectTransport> CreateReceiveTransport(
59       TaskQueueBase* task_queue,
60       Call* receiver_call);
61 };
62 }  // namespace webrtc
63 #endif  // VIDEO_END_TO_END_TESTS_MULTI_STREAM_TESTER_H_
64