blob: 1753741c06e8d30b4d9bca5069645a6d8d187612 [file] [log] [blame]
Sebastian Janssonc5017132018-02-02 16:24:16 +01001/*
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>
Danil Chapovalov44db4362019-09-30 04:16:28 +020015#include <memory>
Sebastian Janssonc5017132018-02-02 16:24:16 +010016
Danil Chapovalov44db4362019-09-30 04:16:28 +020017#include "api/task_queue/task_queue_base.h"
Sebastian Janssonc5017132018-02-02 16:24:16 +010018#include "call/call.h"
19#include "test/direct_transport.h"
20#include "test/frame_generator_capturer.h"
21
22namespace 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.
25class 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
Danil Chapovalov1242d9c2019-11-08 16:17:41 +010038 MultiStreamTester();
Sebastian Janssonc5017132018-02-02 16:24:16 +010039
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);
Danil Chapovalov44db4362019-09-30 04:16:28 +020055 virtual std::unique_ptr<test::DirectTransport> CreateSendTransport(
56 TaskQueueBase* task_queue,
Sebastian Janssonc5017132018-02-02 16:24:16 +010057 Call* sender_call);
Danil Chapovalov44db4362019-09-30 04:16:28 +020058 virtual std::unique_ptr<test::DirectTransport> CreateReceiveTransport(
59 TaskQueueBase* task_queue,
Sebastian Janssonc5017132018-02-02 16:24:16 +010060 Call* receiver_call);
Sebastian Janssonc5017132018-02-02 16:24:16 +010061};
62} // namespace webrtc
63#endif // VIDEO_END_TO_END_TESTS_MULTI_STREAM_TESTER_H_