blob: af747f684637dd107f37f6db716998d2012291f8 [file] [log] [blame]
Ivo Creusen55de08e2018-09-03 11:49:27 +02001/*
2 * Copyright (c) 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 API_TEST_NETEQ_SIMULATOR_FACTORY_H_
12#define API_TEST_NETEQ_SIMULATOR_FACTORY_H_
13
14#include <memory>
Ivo Creusen5ec61562019-03-20 10:52:18 +010015#include <string>
Ivo Creusen55de08e2018-09-03 11:49:27 +020016
Ivo Creusen5ec61562019-03-20 10:52:18 +010017#include "absl/strings/string_view.h"
Ivo Creusencee751a2020-01-16 17:17:09 +010018#include "api/neteq/neteq_factory.h"
Ivo Creusen55de08e2018-09-03 11:49:27 +020019#include "api/test/neteq_simulator.h"
20
21namespace webrtc {
22namespace test {
23
24class NetEqTestFactory;
25
26class NetEqSimulatorFactory {
27 public:
28 NetEqSimulatorFactory();
29 ~NetEqSimulatorFactory();
Ivo Creusen5ec61562019-03-20 10:52:18 +010030 struct Config {
Ivo Creusen99a20962019-10-07 13:18:18 +020031 // The maximum allowed number of packets in the jitter buffer.
Ivo Creusen5ec61562019-03-20 10:52:18 +010032 int max_nr_packets_in_buffer = 0;
Ivo Creusen99a20962019-10-07 13:18:18 +020033 // The number of audio packets to insert at the start of the simulation.
34 // Since the simulation is done with a replacement audio file, these
35 // artificial packets will take a small piece of that replacement audio.
36 int initial_dummy_packets = 0;
37 // The number of simulation steps to skip at the start of the simulation.
38 // This removes incoming packets and GetAudio events from the start of the
39 // simulation, until the requested number of GetAudio events has been
40 // removed.
41 int skip_get_audio_events = 0;
42 // A WebRTC field trial string to be used during the simulation.
43 std::string field_trial_string;
Ivo Creusencee751a2020-01-16 17:17:09 +010044 // A custom NetEqFactory can be used.
45 NetEqFactory* neteq_factory = nullptr;
Ivo Creusen5ec61562019-03-20 10:52:18 +010046 };
Ivo Creusen55de08e2018-09-03 11:49:27 +020047 // This function takes the same arguments as the neteq_rtpplay utility.
48 std::unique_ptr<NetEqSimulator> CreateSimulator(int argc, char* argv[]);
Ivo Creusen5ec61562019-03-20 10:52:18 +010049 std::unique_ptr<NetEqSimulator> CreateSimulatorFromFile(
50 absl::string_view event_log_filename,
51 absl::string_view replacement_audio_filename,
52 Config simulation_config);
53 // The same as above, but pass the file contents as a string.
54 std::unique_ptr<NetEqSimulator> CreateSimulatorFromString(
55 absl::string_view event_log_file_contents,
56 absl::string_view replacement_audio_file,
57 Config simulation_config);
Ivo Creusen55de08e2018-09-03 11:49:27 +020058
59 private:
60 std::unique_ptr<NetEqTestFactory> factory_;
61};
62
63} // namespace test
64} // namespace webrtc
65
66#endif // API_TEST_NETEQ_SIMULATOR_FACTORY_H_